Author Topic: Magic Lantern (RAW) Video format v2.0 (mlv_rec.mo)  (Read 1396391 times)

AnotherDave

  • Senior
  • ****
  • Posts: 348
Re: Magic Lantern (RAW) Video format v2.0
« Reply #400 on: August 20, 2013, 10:01:03 PM »
Now all we need is one for all of us in Macland... :-/

gnarr

  • New to the forum
  • *
  • Posts: 44
Re: Magic Lantern (RAW) Video format v2.0
« Reply #401 on: August 20, 2013, 10:10:07 PM »
as soon as I finish downloading an OsX vmware image I will compile and post it here :)

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
Re: Magic Lantern (RAW) Video format v2.0
« Reply #402 on: August 20, 2013, 10:20:53 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: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

oddname

  • New to the forum
  • *
  • Posts: 45
Re: Magic Lantern (RAW) Video format v2.0
« Reply #403 on: August 20, 2013, 11:56:02 PM »
Is an Alpha/beta in sight soon for the mark2?
Cant wait to try this new format out :)

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
Re: Magic Lantern (RAW) Video format v2.0
« Reply #404 on: August 21, 2013, 12:00:08 AM »
not yet, sorry.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

Canon eos m

  • Hero Member
  • *****
  • Posts: 562
  • 5D Mark III, Canon EOS M
Re: Magic Lantern (RAW) Video format v2.0
« Reply #405 on: August 21, 2013, 02:08:25 AM »
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 :-)

SDX

  • Guest
Re: Magic Lantern (RAW) Video format v2.0
« Reply #406 on: August 21, 2013, 02:21:00 AM »
I suggest you to start looking here: http://www.magiclantern.fm/forum/index.php?board=49.0

kitp

  • New to the forum
  • *
  • Posts: 2
Re: Magic Lantern (RAW) Video format v2.0
« Reply #407 on: August 21, 2013, 11:01:03 AM »
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

  • Hero Member
  • *****
  • Posts: 845
Re: Magic Lantern (RAW) Video format v2.0
« Reply #408 on: August 21, 2013, 11:07:12 AM »
Sound recording does not work(yet).
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 1031
  • raw2cdng
Re: Magic Lantern (RAW) Video format v2.0
« Reply #409 on: August 21, 2013, 10:13:37 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

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
Re: Magic Lantern (RAW) Video format v2.0
« Reply #410 on: August 22, 2013, 02:04:33 AM »
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?

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:

Code: [Select]
[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: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Magic Lantern (RAW) Video format v2.0
« Reply #411 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
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

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
Re: Magic Lantern (RAW) Video format v2.0
« Reply #412 on: August 23, 2013, 12:13:10 AM »
same pink frames with mlv_dump and raw2dng?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Magic Lantern (RAW) Video format v2.0
« Reply #413 on: August 23, 2013, 12:42:22 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

  • Member
  • ***
  • Posts: 163
Re: Magic Lantern (RAW) Video format v2.0
« Reply #414 on: August 23, 2013, 05:01:17 PM »
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

  • Hero Member
  • *****
  • Posts: 562
  • 5D Mark III, Canon EOS M
Re: Magic Lantern (RAW) Video format v2.0
« Reply #415 on: August 23, 2013, 05:56:53 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

  • New to the forum
  • *
  • Posts: 45
Re: Magic Lantern (RAW) Video format v2.0
« Reply #416 on: August 23, 2013, 10:32:45 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

  • Hero Member
  • *****
  • Posts: 606
Re: Magic Lantern (RAW) Video format v2.0
« Reply #417 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

guentergunter

  • Member
  • ***
  • Posts: 144
  • 5D2
Re: Magic Lantern (RAW) Video format v2.0
« Reply #418 on: August 24, 2013, 10:17:09 PM »
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:

swinxx

  • Hero Member
  • *****
  • Posts: 606
Re: Magic Lantern (RAW) Video format v2.0
« Reply #419 on: August 25, 2013, 11:09:02 AM »
thank you.
i see the mlvdump is available for windows and linux..
is there a mac version?
thx.

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Magic Lantern (RAW) Video format v2.0
« Reply #420 on: August 25, 2013, 11:51:17 PM »
thank you.
i see the mlvdump is available for windows and linux..
is there a mac version?
thx.

Try this: http://www.magiclantern.fm/forum/index.php?topic=7802.0
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

  • Hero Member
  • *****
  • Posts: 606
Re: Magic Lantern (RAW) Video format v2.0
« Reply #421 on: August 26, 2013, 03:11:02 PM »
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

  • Senior
  • ****
  • Posts: 348
Re: Magic Lantern (RAW) Video format v2.0
« Reply #422 on: August 26, 2013, 03:30:02 PM »
Where is the link to the latest build?  This post is getting confusing... :-/

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
Re: Magic Lantern (RAW) Video format v2.0
« Reply #423 on: August 26, 2013, 08:58:54 PM »
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: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

Steve Kahn

  • New to the forum
  • *
  • Posts: 23
Re: Magic Lantern (RAW) Video format v2.0
« Reply #424 on: August 26, 2013, 09:27:23 PM »
Sorry, I'm a bit confused as well. 

Does this new format currently support synced audio?