Magic Lantern (RAW) Video format v2.0 (mlv_rec.mo)

Started by g3gg0, July 15, 2013, 10:58:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AnotherDave

Now all we need is one for all of us in Macland... :-/

gnarr

as soon as I finish downloading an OsX vmware image I will compile and post it here :)

g3gg0

Quote from: chmee on August 20, 2013, 07:05:08 PM
thinking about the definition, it would be good to write down some restrictions and/or principles. (lot of that sounds logical, but it's worth to say!)


yep, good point. let me paraphrase them.

[MLV Format]
- the Magic Lantern Video format is a block-based file format
- every information, no matter if audio or video data or metadata is written as data block with the same basic structure
- this basic structure includes block type information, block size and timestamp (exception to this is the file header, which has no timestamp, but a version string)
- the timestamp field in every block is a) to determine the logical order of data blocks in the file and b) to calculate the wall time distance between any of the blocks in the files
- the file format allows multiple chunks which basically are in the same format with file header and blocks
- chunks are either sequentially written (due to e.g. 4 GiB file size limitation) or parallel (spanning over mutiple media)
- the first chunk has the extension .mlv, subsequent chunks are numbered .m00, m01, m02, ...
- there is no restriction what may be in which chunk and what not

[processing]
- to accurately process MLV files, first all blocks and their timestamps and offset in source files should get sorted in memory
- when sorting, the sorted data can be written into a XREF block and saved to an additional chunk
- files that only contain a XREF block should get named .idx to clarify their use
- do not rely on any order at all, no matter in which order they were written into a file
- the only reliable indicator is the timestamp in all headers

[MLVI]
- MLVI block is the first block in every .mlv file
- the MLVI block has no timestamp, it is assumed to have timestamp value 0 if necessary
- the MLVI block contains a GUID field which is a random value generated per video shoot
- using the GUID a tool can detect which partial or spanning files belong together, no matter how they are named
- it is the only block that has a fixed position, all other blocks may follow in random order
- fileCount field in the header may get set to the number of total chunks in this recording

[VIDF] (periodic)
- the VIDF block contains encoded video data in any format (H.264, raw, YUV422, ...)
- the format of the data in VIDF blocks have to be determined using MLVI.videoClass
- if the video format requires more information, additional format specific "content information" blocks have to be defined (e.g. RAWI)
- VIDF blocks have a variable sized frameSpace which is meant for optimizing in-memory copy operations for address alignment. it may be set to zero or any other value
- the data right after the header is of the size specified in frameSpace and considered random, unusable data. just ignore it.
- the data right after frameSpace is the video data which fills up the rest until blockSize is reached
- the blockSize of a VIDF is therefore sizeof(mlv_vidf_hdr_t) + frameSpace + video_data which means that a VIDF block is a composition of those three data fields
- if frames were skipped, either a VIDF block with zero sized payload may get written or it may be completele omitted
- the format of the data in VIDF frames may change during recording (e.g. resolution, bit depth etc)
- whenever in time line a new content information block (e.g. RAWI) appears, the format has to get parsed and applies to all following blocks

[AUDF] (periodic)
- see [VIDF] block. same applies to audio

[RTCI] (periodic, event triggered)
- contains the current time of day information that can be gathered from the camera
- may appear with any period, maybe every second or more often
- should get written before any VIDF block appears, else post processing tools cannot reliable extract frame time

[LENS] / [EXPO] / ... (periodic, event triggered)
- whenever a change in exposure settings or lens status (ISO, aperture, focal length, focus dist, ...) is detected a new block is inserted
- all video/audio blocks after these blocks should use those parameters


...to be continued
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!

oddname

Is an Alpha/beta in sight soon for the mark2?
Cant wait to try this new format out :)

g3gg0

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!

Canon eos m

Quote from: Toffifee on August 12, 2013, 07:33:55 PM
How about making a benchmark test that checks the different methods and logs it?

In a similar fashion A1ex made when RAW video first came out.
A bunch of people can do the tests and you could merge the data into one to compare the differences.

Where can I find A1ex's version of the RAW video module (with the binary) or is there no such thing?
Canon 5D Mark III, Gopro Hero Blacks with 3D Casing, A Few Lenses, Adobe CC 2014, MacBook Pro, Windows 8 PC, Lots of Video Rig!

Started Nuke. Loved it but then the 15 day trial ran out. Back to After Effects and loving it :-)


kitp

Works great, thank you, I was able to unpack both to DNGs and to RAW. But I can't see wav file and it doesn't seems that sound is recording - how to switch it on?

ilguercio

Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

chmee

Quote from: g3gg0 on August 20, 2013, 10:20:53 PM
[MLV Format]
..
- there is no restriction what may be in which chunk and what not

[processing]
- to accurately process MLV files, first all blocks and their timestamps and offset in source files should get sorted in memory
..
- do not rely on any order at all, no matter in which order they were written into a file
- the only reliable indicator is the timestamp in all headers

[MLVI]
..
- it is the only block that has a fixed position, all other blocks may follow in random order

- whenever in time line a new content information block (e.g. RAWI) appears, the format has to get parsed and applies to all following blocks

...to be continued
@g3gg0 excellent work. i quoted some points i'm not that sure.. i'm a little bit scared about seeking thru the chunks, finding all important info blocks. it's also possible, that in spanned-mode f.i. idnt or wbal could be found in the second file - thats the freedom of the format-description - am i right?

regards chmee
[size=2]phreekz * blog * twitter[/size]

g3gg0

Quote from: chmee on August 21, 2013, 10:13:37 PMit's also possible, that in spanned-mode f.i. idnt or wbal could be found in the second file - thats the freedom of the format-description - am i right?

thats the point. it might be at the end of the last file or in the middle of the first. anywhere.

this is the reason why there is a XREF block (defined) which contains file number and offsets to the blocks.
the entries in this block are in order, lowest timestamp first, highest timestamp as last.
it looks like this:


[XREF]
(fileNum) (fileOffset)
0          0x100
0          0x120
0          0x1A0
1          0x80
0          0x180
1          0xA0
...


which means: first block is in file 0 at offset 0x100, second in file 0 at 0x120, next in file 0 at 0x1A0, next is in file 1 at offset 0xA0.
... and so on.
of course tools have to build this index and (optionally, but recommended) save it into another file called .idx

if you have this index, reading in correct temporal order, is just going throug that XREF list.
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!

RenatoPhoto

Ran some video test which I converted directly to dng mlv2dng.exe

1920x1080 at 29.97 - Perfect
Cropped 1920x1080 at 29.97 - Some pink frames and pink noise frames
60 fps 1600x560 at 60 fps - Some pink frames and pink noise frames
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

g3gg0

same pink frames with mlv_dump and raw2dng?
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!

RenatoPhoto

Quote from: g3gg0 on August 23, 2013, 12:13:10 AM
same pink frames with mlv_dump and raw2dng?
Yes, exactly the same frame number if processed with mlv2dng or mlv_dump + raw2dng
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

dariSSight

Quote from: g3gg0 on August 23, 2013, 12:13:10 AM
same pink frames with mlv_dump and raw2dng?

I was checking out the Pre-Built Module of MLV, I only use the rec-mo file because I work on a Mac and the exe files are irrelevant to me on a Mac, but when I use the module on my Canon 5D Mark II, it freeze so I have no choice but to reboot.
Canon 5D Mark II

Canon eos m

Quote from: RenatoPhoto on August 22, 2013, 11:01:50 PM
Ran some video test which I converted directly to dng mlv2dng.exe

1920x1080 at 29.97 - Perfect
Cropped 1920x1080 at 29.97 - Some pink frames and pink noise frames
60 fps 1600x560 at 60 fps - Some pink frames and pink noise frames

Sorry to point this out here but the topic is related. On the EOS M, I find if you increase the fps beyond 30, the camera will throw a few pink frames first before it stabilized. Anything up to 30 of less fps is fine.
Canon 5D Mark III, Gopro Hero Blacks with 3D Casing, A Few Lenses, Adobe CC 2014, MacBook Pro, Windows 8 PC, Lots of Video Rig!

Started Nuke. Loved it but then the 15 day trial ran out. Back to After Effects and loving it :-)

oddname

Quote from: dariSSight on August 23, 2013, 05:01:17 PM
I was checking out the Pre-Built Module of MLV, I only use the rec-mo file because I work on a Mac and the exe files are irrelevant to me on a Mac, but when I use the module on my Canon 5D Mark II, it freeze so I have no choice but to reboot.


It is not made for the Mark II, yet =)

swinxx

hello,
this all sounds very interesting..
can anyone please post a link to a 5dmk3 build with the new format.. i am looking forward to test it.
thank you.
sw

guentergunter

Quote from: swinxx on August 24, 2013, 11:14:04 AM
hello,
this all sounds very interesting..
can anyone please post a link to a 5dmk3 build with the new format.. i am looking forward to test it.
thank you.
sw
What about a look into the very first post in this threat?


By the way: 5D2 support is much appreciated ;)
5D2 ML RAW + VAF-5D2b: http://vimeo.com/69350650

swinxx

thank you.
i see the mlvdump is available for windows and linux..
is there a mac version?
thx.

RenatoPhoto

http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

swinxx

thx, will check that link.

is it possible that someone can provide a new raw rec mlv module? i can see that there were changes.. but the module is from 13_8..
thx.

AnotherDave

Where is the link to the latest build?  This post is getting confusing... :-/

g3gg0

latest build is in first post.
it contains the smpte module, which you have to disable if you dont use smpte. (audio menu or disable module loading)
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!

Steve Kahn

Sorry, I'm a bit confused as well. 

Does this new format currently support synced audio?