uncompressed 14-bit RAW video recording

Started by g3gg0, April 27, 2013, 12:07:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

g3gg0

UPDATE:
Initially this thread was about my lv_rec module that allowed recording YUV422 and RAW video on an experimental basis.
In this module I found out a lot about the EDMAC (DMA controller) and wrote it down in our wiki. (http://magiclantern.wikia.com/wiki/Register_Map)
Since then we were able to use this high speed engine to copy portions of the image into our own buffers.

Meanwhile alex refactored all the code and optimized buffering, so that we are able to record 14 bit raw bayer data.
the result is a module named 'raw_rec' which he highly optimized to get the maximum out of our beloved canon cameras.

Since then we are constantly trying to improve the usability.
Our focused target is the 5D Mark III, but the devs are porting it to other models as you can see (thanks 1%, coutts, nanomad)

Yet this code is EXPERIMENTAL. It will cause any random failures that lead from data loss to crashing cameras.
As you know, ML is very stable, but sometimes code at this early stage causes unforseen problems.
Prepare yourself for that before you go shooting. (a backup CF card, ML-free SD card)

Key ingredients:
- canon has an internal buffer that contains the RAW data
- we understand the high speed DMA controller "EDMAC" a lot better now and know how to crop areas out of an image
- we know how to get the maximum rate out of the CF card and so achieve to get up to 90MiB/s
- we provided a reference tool that converts the Magic Lantern .RAW movie into single .DNG frames plus a MJPEG script

All together sums up to the most advanced 14-bit RAW recording system people can get for less than 3 kEUR.
We will prepare a full article as soon we see this code being stable enough for public testing.


Again. This is EXPERIMENTAL, so:
- bloody beginners and non-geeks should not touch the whole thing. wait until it is "beginner-proof". we will tell you on the website.
- you know that you are a bloody beginner, when you read the whole thread and you still cannot get it to work.
- DON'T be disappointed if it doesn't work or we figure out the whole thing is unstable and/or unusable
- NO, there is no manual yet
- NO, there is no all-in-one tool that fits every use case
- NO, we don't have tutorials how to use it
- NO, not all models are supported yet ;)
- we are just at the moment testing how good it works and what we have missed and what to improve
- you are welcome to post comparisons, experiences (both good and bad), or even deep analysis or just cool videos
- if you are a programmer and you see potential for improvements, grab the source and support :)

As always we want to remind you of these things:
- Magic Lantern Team will not be responsible or liable for any kind of direct or indirect damage to your camera. (nothing new anyway)
- The software provided for download is not related to Canon in any way
- Do not contact Canon about issues related with this software
- Do not blame Canon for not-implementing this feature! Why? This is no feature that is stable enough so that a company like Canon would ever release.
- Prepare for footage loss due to frame drops, tinted frames, corrupted frames etc.
- THIS IS EXPERIMENTAL. Deal with it. Don't blame anyone.

About sensor heating rumors:
The only thing that could get warmer is DIGiC and the CF circuitry, but i am sure that the power dissipation that reaches the sensor
through all that plastic housing will not have any noticeable temperature raise.

detailed: when doing that much DMA transfers and CF writing, we may cause a bit more current drain (which causes squared power dissipation)
but we do not encode any H.264 while recording, so we use less power there.
its *possible* that the CF writing will consume less energy than the encoding with H.264, which will result in *less* power consumption.
raw is being produced by the DIGiC for every single frame anyway. we "just" save it away.

still this is a *theory*, but i expect the consumption and the temperatures not to raise at all.




old post:
Currently i am working on a module that records YUV422 data to card.
This code will only work when compiled from repository (there is no release yet)

5D3: can record 1904x1274 @ 12.5 fps

here some example video:
https://docs.google.com/file/d/0BwQ2MOkAZTFHdU1tR1pITXFVVXM/edit?usp=sharing
(not sure how to make it look better and not take 600MiB)

here some sample images:
https://docs.google.com/file/d/0BwQ2MOkAZTFHdFFsV1BGU0Nmd2s/edit?usp=sharing

there are three major options
- Frame skipping: record every n-th frame. choose 2 on 5D3 in 25 fps mode to record with 12.5 fps *continuously*
- Single file: save some processing time by writing a single file. you have to split it later on your computer. (maybe the 422 converters will somewhen support this?)
- RAW mode: not working yet, just saving gibberish ;)

right now the module is not user-friendly. press start and it will record 2000 frames.
it will abort if the buffers are exhausted.
you can also abort by removing battery ;)

All questions regarding RAW VIDEO POST PROCESSING on any OS
HERE: http://www.magiclantern.fm/forum/index.php?topic=5404.0

All questions regarding RAW_REC MODULE COMPILATION/INSTALLATION/USAGE
HERE: http://www.magiclantern.fm/forum/index.php?topic=5405.0

And this thread here should from now on just be used for video results, and open discussion.
NOT for any installation or processing help.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%

Working here... stops after the buffer fills. I dunno how FPS is yet or how to split up the 422 files. Got 39 frames as single, 33 as multiple.

Yoshiyuki Blade

Quote from: g3gg0 on April 27, 2013, 12:07:12 AM
here some example video:
https://docs.google.com/file/d/0BwQ2MOkAZTFHdU1tR1pITXFVVXM/edit?usp=sharing
(not sure how to make it look better and not take 600MiB)

You can try compressing with x264. I compressed the 45 frames in the other zip file and it came out to about 25MB lossless.

g3gg0

for the posted video i used these settings (x264 in virtualdub):
--profile high444 --qp 0 --preset placebo --tune stillimage --demuxer raw --input-csp i420 --input-res %(width)x%(height) --fps %(fpsnum)/%(fpsden) -o "%(tempvideofile)" -

edit: damn, i used i420 instead of i422. retrying
edit2: causes image distortion :
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

Yoshiyuki Blade

Here's an output I made at 4:2:2, PC levels (0-255)
....

The image will probably look darker than it should because the levels aren't rescaled to TV (16-235), similar to how a clip from a Canon camera would look unprocessed.

Used these settings from MeGUI: --preset veryslow --crf 0 --colorprim bt709 --transfer bt709 --colormatrix bt709 --output-csp i422

Here's a "standard" 4:2:0 at TV levels. it should look as intended:
....

Edit: (Links removed due to excessive dropbox traffic causing suspension. :o)


1%

for the old school 422 single frames I just threw them into after effects as an image sequence and exported to whatever... cineform, h264, dnxhd, animated gif, lol.

g3gg0

added crop modes to record 1904x720 @ 25 fps.

the module is recording into a single file where all frames are concatenated.
use a splitting tool to split to single files. the frame size is displayed in menu.

maybe a popular .422 converter will add a feature to split the files automatically?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%

With crop and some frame skip it keeps going with only 1 frame buffered.

There needs to be a way to stop this thing tho because when it keeps going I have to turn the camera off.

I can split on linux with HJsplit but need to know the frame size.

g3gg0

> There needs to be a way to stop this thing tho because when it keeps going I have to turn the camera off.
>> stop recording when leaving LV and movie mode
>> https://bitbucket.org/hudson/magic-lantern/commits/a0b2ac64c625356f618757f1d48d938406f5e770

> I can split on linux with HJsplit but need to know the frame size.
>> the frame size is displayed in menu.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%

So just shut down LV?


Ha, looks like anamorphic. Splitting first one..

Heh, frame size is only in WxH... i went into a hex editor and found start then start again and took 1 frame out to get size.

g3gg0

Quote from: 1% on April 27, 2013, 11:56:32 PM
Heh, frame size is only in WxH... i went into a hex editor and found start then start again and took 1 frame out to get size.

no just see the help when you are over the resolution.
it tells you the frame size.

Quote from: 1% on April 27, 2013, 11:56:32 PM
So just shut down LV?
yep, just leave LV or video mode.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%

Ah... I see it. Totally usable... wonder if it will roll with audio. Maybe would be in sync if lv_rec threw it the semaphore when writing the first frame. Also then you'd have FPS, get X frames over the lenght of the audio.

Heh, need more frame skip when audio is recording... maybe for 5d3 wav can go to SD and video to CF... but 6D is fucked. At least the audio didn't skip.

g3gg0

hmm then we would have to lower the resolution a bit more.
with 720 lines its at the limit already.

yeah, writing to SD is a good idea.
thought about doing that for higher fps or resolution, but didnt think about audio :)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

squig

Is the YUV422 displaying the same level of detail as the RAW video?

If so and if you're able to lower the vertical resolution a little it's not going to be a drama to upscale the image a little in post. Cropping it horizontally to 500 pixels for a 1.5x anamorphic mode is gonna produce better resolution.

g3gg0

cropping horizontally isnt feasible as it will reduce write speed a lot.

well, it will be possible if EDMAC is understood better.
but for now its not doable.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

squig

Can you get the audio recording 8bit?

1%

Sure, you don't save that much though and it sounds like shit.

squig

8bit doesn't actually sound that bad, we used 8bit samplers back in the day. 22khz sounds like shit. I'm just thinking in terms of a sync track not audio you'd actually use. Is there a way you could just record the first 10 seconds of audio for sync?

1%

Probably, you can start/stop it at will.

I bet tho 8 bit vs 16 bit won't matter. The write rate just doesn't seem to be there. I only have ~150MB of buffer... maybe 5d3 has more.

squig

If you guys need help testing builds on the MK3 I'm up for it. I don't know jack about code but I'm a fully qualified crash test dummy. I've got a 1000x Lexar card.

Kabuto1138

I'm with squig, I have a 5d2(don't know if this patch is working for the 5d2) and I also have a 1000x Lexar card

1%

Should it write start time and end time to the file name?

Michael Zöller

Quote from: 1% on April 28, 2013, 08:57:01 AM
Should it write start time and end time to the file name?
Its nice to have. Audio wise many use an external recorder and sync with Pluraleyes. Just buffer-recording the first (and last?) two seconds might be enough for it to sync. But we wouldn't store audio into the resulting video file anyway, would we?
neoluxx.de
EOS 5D Mark II | EOS 600D | EF 24-70mm f/2.8 | Tascam DR-40

1%

When I record wav with it, run time is reduced. 

N/A

Uncompressed video with audio would be ok BUT I'd sacrifice audio to have better video. And besides, you can still do the clapboard trick if absolutely necessary.

Edit: First page!  ;D
7D. 600D. Rokinon 35 cine. Sigma 30 1.4
Audio and video recording/production, Random Photography
Want to help with the latest development but don't know how to compile?