12-bit (and 10-bit) RAW video development discussion

Started by d, May 22, 2013, 10:58:34 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.


50D | EFS 18-55 | last build crop_rec-3744x1080_24fps_50D-eXperimental.4.57pm.2020May06.50D109.zip


Quote from: SkalickyJ on April 24, 2017, 03:19:55 PM
Hi, I tried to shoot 1728x736 10 bit ml-raw on canon 700d. But i get files full of green,pink and blue dots, its almost impossible to see the original image i shot, because its covered with this dots.  Any idea, what could be wrong? Thanks! https://ibb.co/dF9GLk

btw. card speed should be ok, 14bit raw video at 1280x720 is working great...

Your workflow process did not support 10-12bit
Use MLVProducer (the best,fastest software i used in MLV files Process) (also support 10-12-14bit and removing focus point automatically)
Download From Here:
after installing the program you must change some settings to encod MLV To DNG

Now Use in file menu Open MLV/RAW >> Chose your mlv file >> and again click File >> Render Task
You can open multiple MLVs And Click Render Queue



Working on 10-12bit 1:1 on 5D2 , as we know 3x crop works with 10 & 12 bit reduction but not 1:1 really well .
Thou in 12bit 1:1 you can record with corruption on every other frame on the top 100 or so lines .
I'm currently seeing the feasible of using bit reduction in a up coming documentary I been hired to shoot in 2 weeks for the sierra club (usa)
My needs are long shoot times , so low bite rate fits the bill .
Here a list of resolution's size I was possibly thinking of using with 12bit in 1:1 (as there corruption on the top of frame)
with the adjusted crop to remove corruption. I also listed the file size for 60 second or so to get max time for minimum card space
The base line is 14 bit 1856x928 23.976 fps (My minimum spec. for HD broadcast as it need to be up upscaled)
1856x928  23.976 14bit 59.9 seconds 1437 frames 4.05 GB 1:1 Liveview  ( 2:1 A.R.)
1856x1114 23.976 12bit 64.8 seconds 1554 frames 4.51 GB (crop adjust 1856x988) 126 line crop 1.878542510121457 A.R.
1856x1044 23.976 12bit 64.8 seconds 1554 frames 4.23 GB (Crop Adjust 1856x953) 91 line crop  1.947534102833158 A.R.
1856x1004 23.976 12bit 60.3 seconds 1447 frames 3.78 GB (crop Adjust 1856x932) 72 lines crop 1.991416309012876 A.R.
1856x928  23.976 12bit 60.1 seconds 1442 frames 3.49 GB (crop adjust 1856x895) 33 lines crop 2.073743016759777 A.R.

So There is really no saving after cropping , but 3x crop mode is a different matter all together .
Here 10bit really save me , as I can have to 20min per 64GB Card @ 1920x1076 @ 23.976fps
Thou the field of view is reduced , looks like the 24mm will gets a work out  :D
1920x1076 23.976 10bit 59.9 seconds 1437 frames 3.47 GB  (3x Crop Mode)  1.784386617100372 A.R.
So I save about 500 MB per minute which will add up fast. 4x 64gb card should be around 80 min's of 10bit 2K or 1920x1076.
Now I can use my slower 60MB/s CF cards to get
1856x928 23.976  10bit 60.1 seconds 1443 frames 2.91 GB  (3x crop)  (2:1  A.R.)

It looks like I'll being shooting in 10bit 3x crop for this doc.

Now for the real reason I started this post , as I said I'm work on 1:1 liveview 5d2 10-12bit.
I've being working on older code with .raw , just to keep it as simple as possible before I move on to .mlv full & mlv_lite.
At this Point I can record 10bit & 12bit , with out any lockups or screen freezes all overlays are working while recording bit reduction.
When not in bit reduction it return to 14bit and of course it work without problems.

Now the Problem  ::) there is always a problem , my issue is decoding the .raw to  dngs
My question is can I convert the .raw to .mlv ? as mlv_dump seem not to understand .raw
I'm currently uploading some of the .raw file to my Google drive to share , when done I'll post the links.


Should have taken my own advice "search box"  :P
Any ways yes you can convert .raw to .mlv with raw2dng .
now I have a more workable file .

After All that , it's reading as a 14bit file , so the image is totally corrupted
should be either 10 or 12 bit .
Top file is my 10-12bit .raw file that I converted to .mlv
Second files is 14bit , was recorded in the session as the bit reduction files
Third is a older 2k 10bit .mlv  , just to be sure it's decoding correctly .

by RedDeerCityTV, on Flickr

With MLVFS quick mount on PC I get this from the cdng's from the .raw converted to .mlv , black level is way out to lunch , but it's a start .
ExifTool Version Number         : 10.33
File Name                       : m07-1552_000000.dng
Directory                       : C:/New
File Size                       : 3.3 MB
File Modification Date/Time     : 2017:01:07 14:51:59-07:00
File Access Date/Time           : 2017:05:07 21:01:52-06:00
File Creation Date/Time         : 2017:05:07 21:01:52-06:00
File Permissions                : rw-rw-rw-
File Type                       : DNG
File Type Extension             : dng
MIME Type                       : image/x-adobe-dng
Exif Byte Order                 : Little-endian (Intel, II)
Subfile Type                    : Full-resolution Image
Image Width                     : 1872
Image Height                    : 1054
Bits Per Sample                 : 16
Compression                     : Uncompressed
Photometric Interpretation      : Color Filter Array
Fill Order                      : Normal
Make                            : Canon
Camera Model Name               : Canon EOS 5D Mark II
Strip Offsets                   : 65536
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 1
Rows Per Strip                  : 1054
Strip Byte Counts               : 3384466
Planar Configuration            : Chunky
Software                        : MLVFS
Modify Date                     : 2017:00:07 15:51:59
CFA Repeat Pattern Dim          : 2 2
CFA Pattern 2                   : 0 1 1 2
Exposure Time                   : 1/50
F Number                        : 1.0
ISO                             : 81
Sensitivity Type                : ISO Speed
Exif Version                    : 0230
Subject Distance                : 0 m
Focal Length                    : 50.0 mm
Lens Model                      : Some Great 50mm f/1
DNG Version                     :
Unique Camera Model             : Canon EOS 5D Mark II
Linearization Table             : (Binary data 87187 bytes, use -b option to ext
Black Level                     : 7794
White Level                     : 15000
Default Crop Origin             : 0 0
Default Crop Size               : 1872 1054
Color Matrix 1                  : 0.4716 0.0603 -0.083 -0.7798 1.5474 0.248 -0.1
496 0.1937 0.6651
As Shot Neutral                 : 0.3885467303 1 0.7199849091
Baseline Exposure               : 0
Calibration Illuminant 1        : D65
Active Area                     : 0 0 1054 1872
Frame Rate                      : 23.976
Baseline Exposure Offset        : 0
Aperture                        : 1.0
CFA Pattern                     : [Red,Green][Green,Blue]
Image Size                      : 1872x1054
Megapixels                      : 2.0
Shutter Speed                   : 1/50
Focal Length                    : 50.0 mm
Light Value                     : 5.9
-- press RETURN --


i didnt read the last bunch of thread-entries. is it my tool or something else? if its my tool, give me some advice to fix.
[size=2]phreekz * blog * twitter[/size]


@chmee  , No your app is fine I was showing the issue I was having with my custom raw_rec module exporting to 10 or 12bit for 5d2 1:1
As 14bit & 10bit 3x crop .raw works fine from 5D2 .


After checking my 10-12bit 1:1 files with  mlvdiag.1.0.1. from chmee (converted .raw to .mlv with raw2dng) I notice I'm missing the Null Block (Alignment Fill)
Or is it just a block for .mlv format ?
Is the bit depth written in the MLVI block or RAWI block ? or is it in a different block .
my file read as 14bit in MLVProducer & raw2cdng when I recorded in 10 & 12 bit , thou the 14bit .raw are fine .
I guess I will have too go check my code .   


Bitdepth is in the raw_info structure which is part of the RAWI block; raw_info can be found in raw.h in src folder


I'm a little closer , I being working on 2 different branch's Compressed Raw & Memspy with the Old ML core ( why the old core , because raw_rec is very simple and easier to understand)
actually the only problem I'm having with the Old core is decoding the different bit depth's from the .raw files (excluding 14bit)  , I have even implemented 16bit encoding as a test .
You my ask how do I know it's recording at 10 , 12 , 16 ? By the data rata , reference to the old dec.1/2016 10-12bit build in my bitbucket downloads and 16bit say's it's data rate is
91MB/s @ 1872x1054 23.976 , Thou I can only save about 200 frames , yes 16bit is not realistic to record , it was to see if my coding was correct . I'll discuss the decoding problem later on .

I wanted to talk about the compressed raw branch with 10-12bit , thou I'm not trying to implement compressed raw just yet it was a way to get a cleaner 10bit 1:1 image
Source Code is here  magic-lantern_compressed_raw.zip and there is a build I made for testing magiclantern-Nightly.Compressed.Raw.Bit.Reduction.2017.May11.5D2212.zip .
Caveat , 10bit is only cleaner with Auto preview , there is a from of sheering but both halfs of the image are clean
and there is movement in all frames no frozen images , it's far from perfect to say the least but no pink corrupted frame , 12bit still have the same top 100 or so line of corrupted .
As nominal , this build could brick your camera  ::) and you get to keep both halves  :P

Edit: Just a note about the old core .raw decoding problem , basically for some reason be on my understanding the .raw files keep writting14bit to the RAWI block instead of 10 or 12 etc...
I tried this from a1ex , but seem not to work , thou I'm very sure I have not implemented it correctly 
QuoteTo get clean image, you will have to change raw_info.bits_per_pixel from the raw recording module

   strcpy((char*)footer.magic, "RAWM");
    footer.xRes = res_x;
    footer.yRes = res_y;
    footer.frameSize = frame_size;
    footer.frameCount = frame_count - 1; /* last frame is usually gibberish */
    footer.frameSkip = 1;
    footer.sourceFpsx1000 = fps_get_current_x1000();
    footer.raw_info.bits_per_pixel = raw_info.bits_per_pixel;

    int written = FIO_WriteFile(save_file, &footer, sizeof(lv_rec_file_footer_t));

Where it say's "footer.raw_info" I add ".bits_per_pixel"
Any help would be greatly appreciated .



@reddeercity Can't tell if you've got things working :-\ Have you got reduced bitdepths working?

andy kh

@chmee adding an option to change black level would be great. some 10bit raws are unusable because of wrong black level
5D Mark III - 70D


Quote from: Ilia3101 on May 11, 2017, 09:11:47 AM
@reddeercity Can't tell if you've got things working :-\ Have you got reduced bitdepths working?
In compressed raw branch , yes with full mlv+audio  haven't tried with mlv lite yet ( I need audio so mlv lite is low on my list)
As you know 3x crop is good , this is for 1:1.
The video in my dropbox link is a 10bit  1:1 23.976fps , normally the image is half pink corruption , so improvement there
Also yes bit reduction in the old core but still can't decode the .raw file reads as a 14bit .
If I could get this fixed I can move on to mlv.

Edit: is there a way to extract frames at low level with correct bit depth and bypass the header ?


I asked a question "is there a way to extract frames at low level with correct bit depth and bypass the header ?"
Will I answered my own question , In a way yes . What do I mean by that , will you need to modify blocks with something like
HxD a hex editor , that on wins platform there should be a Mac version hex editor out there.
I loaded a true 10bit MLV_Lite file (1872x1052) and then my .RAW Old ML Core custom build raw_rec.mo 10bit recorded (1872x1054) with wrong bit depth information
Reads as 14bit as per post #1256 . Thought trial & error I found which blocks are for depth bit & black/white levels
Offset 00000060 :   0A 00 00 00 6F 00
That's from the  donor file (10bit mlv lite)
Offset 00000060:   0E 00 00 00 FF 06
Blocks from the original .raw which is wrong bit depth (14bit) should have been 10bit.
So "0A" is 10bit & "0E" is 14bit  and "6F 00" gives correct white & black levels @ 10bit pixel depth

Original .raw converted to .mlv with raw2dng with wrong bit depth (14) recorded as 10bit in 1:1 5d2
Modified block bit depth blocks & black/white levels
Corrected 10bit Cdngs from MLVProducer (frames , M08-1755-3_00001.dng & M08-1755-3_00002.dng)

by RedDeerCityTV, on Flickr

by RedDeerCityTV, on Flickr

by RedDeerCityTV, on Flickr


Hello! I can fix this 12bit dng from 5d mark 2 ?
I deleted my mlv file and I only have a dng sequence.


Quote from: reddeercity on May 16, 2017, 07:03:47 AMI asked a question "is there a way to extract frames at low level with correct bit depth and bypass the header ?"
At the start of MLVP's, I wanted to implement the header editor. But nobody was interested.
I think it could be useful.
MLVProducer. p.s. sorry for my bad english.


Quote from: AWPStar on May 17, 2017, 08:43:42 PM
At the start of MLVP's, I wanted to implement the header editor. But nobody was interested.
I think it could be useful.
Yes , You got my vote


Quote from: AWPStar on May 17, 2017, 08:43:42 PM
At the start of MLVP's, I wanted to implement the header editor. But nobody was interested.
I think it could be useful.

Quote from: reddeercity on May 18, 2017, 03:48:19 AM
Yes , You got my vote

5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109


Quote from: AWPStar on May 17, 2017, 08:43:42 PM
At the start of MLVP's, I wanted to implement the header editor. But nobody was interested.
I think it could be useful.

see this, might be useful.

-- MLV autopsy --
--skip-block <block#>        skip given block number
--skip-type <type>           skip given block type (e.g. VIDF, AUDF etc)
--extract <block#>           extract only the block at given into output file
--replace <block#>           replace block with data from given source file
--autopsy-file <file>        extract/insert from this file
--payload-only               features above extract/replace affect not the whole block, but only payload
--header-only                features above extract/replace affect not the whole block, but only header
--relaxed                    do not exit on every error, skip blocks that are erroneous
-m                           write only metadata, no audio or video frames
-n                           write no metadata, only audio and video frames
-I <mlv_file>                inject data from given MLV file right after MLVI header
-X type                      extract only block type

example use case:

./mlv_dump corrupt.mlv --extract 15 --header-only --autopsy-file header.bin
<edit header.bin>
./mlv_dump corrupt.mlv --replace 15 --header-only --autopsy-file header.bin -o fixed.mlv

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!


Hey guys im new here, but ive got some info that might help some people working on the 550D builds.

From my experiences with mlv_rec based on the 01-14 build
10 bit : works well except every second frame the top third of the image is shifted right. Making a constant shift in video (back and forth)
12 bit : no problems with frames however every second frame is a repeat of frame 1. therefore in a 24p video only 12 unique frames.
14 bit: works as expected
no dropped frames with mlv_rec which is v good.

Finally i can't really figure out how to compile and i noticed nothing new has been put out for the 550D.
So i was just wondering if someone could compile a new one (unless you guys stopped working on it)
because i would love to keep testing builds and giving feedback!



Can someone please share a stable version of the 10 - 12bit Build with me..  I've tried the last Build and I'm getting Pink frames all over the place, and I can't find the older Builds.