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.

a1ex

I've changed it to prevent wrong code from being emitted on 64-bit systems (you were casting a 32-bit integer to a 64-bit pointer, which has undefined behavior). I think it's better for the compilation to fail, rather than having to hunt for random bugs with apparently no explanation.

escho

So, it´s the best to setup a 32bit machine with vmware, right?

Edgar
https://sternenkarten.com/
600D, 6D, openSUSE Tumbleweed

a1ex

Aren't 32-bit executables compatible with 64-bit systems? I remember running them on 64-bit Windows a few years ago, and on Linux they just work (I think I've installed some 32-bit libraries and that was it). No idea about Mac.

arrinkiiii

Quote from: g3gg0 on October 28, 2013, 11:32:36 AM
because i want you to try it and tell me if it is better there ;)

Hi,

Today i recorded again some MLV with the latest tragic lantern and i have a lot of pink/corrupt frames ...and this time i have try with mlv_viewer  :)   


[7D]


escho

Quote from: a1ex on October 31, 2013, 06:30:22 PM
Aren't 32-bit executables compatible with 64-bit systems? I remember running them on 64-bit Windows a few years ago, and on Linux they just work (I think I've installed some 32-bit libraries and that was it). No idea about Mac.

Not sure, which  32-bit libraries for linux you mean.

Edgar
https://sternenkarten.com/
600D, 6D, openSUSE Tumbleweed

marekk

RAW format 2.0 specification has info about mlv_wbal_hdr_t. As far I understand we can read values of wbgain_r and wbgain_b. I think we can save white balance info to DNG (AsShotNeutral) like this:


WB RGGB Levels As Shot          : 1967 1024 1024 1796

1024/wbgain_r = 1024/1967 = 0,52059
1
1024/wbgain_b = 1024/1796 = 0,57015


static int cam_AsShotNeutral[]          = {100000,100000,100000,100000,100000,100000};
cam_AsShotNeutral[0] = 52059;
cam_AsShotNeutral[4] = 57015;

Am I mistaken ?

g3gg0

> http://www.magiclantern.fm/forum/index.php?topic=3409.msg17485#msg17485

i dont really understand how to provide either the RGB multipliers or kelvin value in an useful format for DNG.
any try causes totally weird color values, because it is unclear how canon calculates the WB stuff :(
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!

marekk

I've found this paper: http://users.soe.ucsc.edu/~rcsumner/papers/RAWguide.pdf

look at page 8, 4.3 White Balancing


Quote from: g3gg0 on October 31, 2013, 10:49:22 PM
> http://www.magiclantern.fm/forum/index.php?topic=3409.msg17485#msg17485

i dont really understand how to provide either the RGB multipliers or kelvin value in an useful format for DNG.
any try causes totally weird color values, because it is unclear how canon calculates the WB stuff :(

a1ex

It doesn't answer our questions. These are:

1) what is the relationship between WBGain multipliers and RGB multipliers? (only for Custom WB)
2) what RGB multipliers should we save in the DNG when the EXIF says 2500K or any other Kelvin value? (of course, only for Kelvin WB)

swinxx

there is one thing i do not understand.
when i go to downloads and see the changelog from e.g. 5d3.. i can see that there are some changes in mlv.rec
but when i download the latest nightly (e.g. 1.nov) the module is not there..
so why? i have downloaded the latest prebuild in this thread.. but all in all the changelog displays changes that are not made within that build (because the module is not included)

so is it useable?

rsterran

Please forgive me if I misunderstand the question, but I think A1ex's question 1) asks about the relationship between the various arrays of "WB RGGB" (e.g. four ints) values and the actual values to scale each color channel by to white balance?

If so, then marekk is right but has the values inverted. The ratio of the WB RGGB integers is the same as what should be used for the color channel scaling values. Thus, as in marekk's example and setting the green multiplier to be 1 (since only the ratio of them matters), we get

WB RGGB Levels As Shot          : 1967 1024 1024 1796
becomes
wbgain_r = 1967/1024 = 1.9209
wbgain_g = 1
wbgain_b = 1796/1024 = 1.7539

These directly applied to the color channels will neutralize the color of the light, but not correct for being in the camera's color space.

The second question is much more complicated, and I'm not sure if there's any standard way to do it. It might be different for every camera, requiring some calibration. If the "WB RGGB Levels" EXIF tag or the "Red/Blue Multiplier" tags are available those should be used instead of the Kelvin. Are there cameras where only Kelvin is available?

a1ex

If you click on the link above, posted by g3gg0, you will notice this answer is not the one I'm looking for. WBGain are Canon multipliers used for custom WB, and they are different from RGGB multipliers (they look like 1/x at first sight, but they are not).

marekk

I finally compiled mlv_dump on mac but when I'm trying to convert do dng files it ends with Bus error 10 (recorded on 60D), on linux - segmentation fault.

small mlv file:
https://drive.google.com/file/d/0B-HdscXfsKpgWW5aeXF3OXdvSlk/edit?usp=sharing


Quotemlv_dump -v --no-cs --dng M02-1733.MLV

MLV Dumper v1.0
-----------------

Mode of operation:
   - Input MLV file: 'M02-1733.MLV'
   - Verbose messages
   - Verify file structure
   - Dump all block information
File M02-1733.MLV opened
Processing...
File Header (MLVI)
    Size        : 0x00000034
    Ver         : v2.0
    GUID        : 4679971695627853972
    FPS         : 24.000000
    File        : 0 / 0
    Frames Video: 29
    Frames Audio: 0
Block: RAWI
  Offset: 0x00000034
    Size: 180
    Time: 12.857000 ms
    Res:  1600x680
    raw_info:
      api_version      0x00000001
      height           1182
      width            1888
      pitch            3304
      frame_size       0x003B9730
      bits_per_pixel   14
      black_level      2048
      white_level      15000
      active_area.y1   26
      active_area.x1   152
      active_area.y2   1182
      active_area.x2   1886
      exposure_bias    0, 0
      cfa_pattern      0x02010100
      calibration_ill  1
Block: INFO
  Offset: 0x000000e8
    Size: 16
    Time: 21.395000 ms
Block: RTCI
  Offset: 0x000000f8
    Size: 44
    Time: 24.897000 ms
     Date:        02.10.2013
     Time:        17:33:40 (GMT+0)
     Zone:        ''
     Day of week: 0
     Day of year: 0
     Daylight s.: 0
Block: EXPO
  Offset: 0x00000124
    Size: 40
    Time: 25.451000 ms
     ISO Mode:   0
     ISO:        100
     ISO Analog: 72
     ISO DGain:  0/1024 EV
     Shutter:    21318 µs (1/46.91)
Block: LENS
  Offset: 0x0000014c
    Size: 96
    Time: 25.488000 ms
     Name:        '1-65535mm'
     Serial:      ''
     Focal Len:   50 mm
     Focus Dist:  0 mm
     Aperture:    f/1.40
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x0000001B
     Flags:       0x00000000
Block: IDNT
  Offset: 0x000001ac
    Size: 84
    Time: 25.501000 ms
     Camera Name:   'ERR:1 md:0x       0 ml:0'
     Camera Serial: ''
     Camera Model:  0x00000000
Block: WBAL
  Offset: 0x00000200
    Size: 44
    Time: 25.547000 ms
     Mode:   0
     Kelvin:   6500
     Gain R:   489
     Gain G:   1024
     Gain B:   1024
     Shift GM:   0
     Shift BA:   0
Block: STYL
  Offset: 0x0000022c
    Size: 52
    Time: 25.559000 ms
     picStyle:   33
     contrast:   -4
     sharpness:  1
     saturation: -2
     colortone:  0
Block: NULL
  Offset: 0x00000260
    Size: 36
Unknown Block: NULL, skipping

Block: EXPO
  Offset: 0x00000284
    Size: 40
    Time: 4.878000 ms
     ISO Mode:   0
     ISO:        100
     ISO Analog: 72
     ISO DGain:  0/1024 EV
     Shutter:    21318 µs (1/46.91)
Block: LENS
  Offset: 0x000002ac
    Size: 96
    Time: 4.915000 ms
     Name:        '1-65535mm'
     Serial:      ''
     Focal Len:   50 mm
     Focus Dist:  0 mm
     Aperture:    f/1.40
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x0000001B
     Flags:       0x00000000
Block: WBAL
  Offset: 0x0000030c
    Size: 44
    Time: 5.187000 ms
     Mode:   0
     Kelvin:   6500
     Gain R:   489
     Gain G:   1024
     Gain B:   1024
     Shift GM:   0
     Shift BA:   0
Block: VIDF
  Offset: 0x00000338
    Size: 1906344
    Time: 35.575000 ms
   Frame: #0
    Crop: 216x264
     Pan: 216x264
   Space: 2312
Bus error: 10

g3gg0

does it only happen with one file or with anything you record?
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!

g3gg0

just saw that you updated your post after i read it.
thanks for the sample footage, converts fine on linux and windows.

can you tell me which compiler you use? is it a 64 bit system or anything weird? (old m68k mac?)
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!

g3gg0

ah forget about it.
you didnt specify any output file with -o - this causes an error.

didnt catch this case. sorry, will fix it.
it should use a default file pattern of course.
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!

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!

marekk

Now it works, thx

... But somenthing is wrong with camera identification:

QuoteBlock: IDNT
  Offset: 0x000001ac
    Size: 84
    Time: 25.501000 ms
     Camera Name:   'ERR:1 md:0x       0 ml:0'
     Camera Serial: ''
     Camera Model:  0x00000000

marekk

Quoteexiftool -a test1000005.dng
ExifTool Version Number         : 9.33
File Name                       : test1000005.dng
Directory                       : .
File Size                       : 1892 kB
File Modification Date/Time     : 2013:11:02 16:57:08+01:00
File Access Date/Time           : 2013:11:02 16:57:57+01:00
File Inode Change Date/Time     : 2013:11:02 16:57:08+01:00
File Permissions                : rw-r--r--
File Type                       : DNG
MIME Type                       : image/x-adobe-dng
Exif Byte Order                 : Little-endian (Intel, II)
Subfile Type                    : Reduced-resolution image
Image Width                     : 128
Image Height                    : 84
Bits Per Sample                 : 8 8 8
Compression                     : Uncompressed
Photometric Interpretation      : RGB
Image Description               : (MLV Video without INFO blocks)
Make                            : Canon
Camera Model Name               : ERR:1 md:0x       0 ml:0
Strip Offsets                   : 1536
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 3
Rows Per Strip                  : 84
Strip Byte Counts               : 32256
Planar Configuration            : Chunky
Software                        : Magic Lantern
Modify Date                     :
Artist                          :
Subfile Type                    : Full-resolution Image
Image Width                     : 1600
Image Height                    : 680
Bits Per Sample                 : 14
Compression                     : Uncompressed
Photometric Interpretation      : Color Filter Array
Strip Offsets                   : 33792
Samples Per Pixel               : 1
Rows Per Strip                  : 680
Strip Byte Counts               : 1904000
X Resolution                    : 180
Y Resolution                    : 180
Planar Configuration            : Chunky
Resolution Unit                 : inches
CFA Repeat Pattern Dim          : 2 2
CFA Pattern 2                   : 0 1 1 2
Black Level                     : 2048
White Level                     : 15000
Default Crop Origin             : 0 0
Default Crop Size               : 1600 680
Active Area                     : 0 0 680 1600
Opcode List 1                   : (Binary data 28 bytes, use -b option to extract)
Copyright                       :
Exposure Time                   : 1/46
F Number                        : 1.4
Exposure Program                : Not Defined
ISO                             : 100
Exif Version                    : 0221
Date/Time Original              :
Shutter Speed Value             : 1
Aperture Value                  : 1.0
Exposure Compensation           : 0
Max Aperture Value              : 1.0
Metering Mode                   : Unknown
Flash                           : No Flash
Focal Length                    : 50.0 mm
Sub Sec Time                    :
Sub Sec Time Original           :
Focal Length In 35mm Format     : 0 mm
TIFF-EP Standard ID             : 1 0 0 0
DNG Version                     : 1.3.0.0
DNG Backward Version            : 1.3.0.0
Unique Camera Model             : ERR:1 md:0x       0 ml:0
Color Matrix 1                  : 0.6719 -0.0994 -0.0925 -0.4408 1.2426 0.2211 -0.0887 0.2129 0.6051
Analog Balance                  : 1 1 1
As Shot Neutral                 : 0.473635 1 0.624
Baseline Exposure               : undef
Baseline Noise                  : 1
Baseline Sharpness              : 1.333333333
Linear Response Limit           : 1
Calibration Illuminant 1        : Standard Light A
Calibration Illuminant 2        : D65
Frame Rate                      : 24
Serial Number                   :
Lens Model                      : 1-65535mm
Aperture                        : 1.4
CFA Pattern                     : [Red,Green][Green,Blue]
Image Size                      : 1600x680
Shutter Speed                   : 1/46
Focal Length                    : 50.0 mm
Light Value                     : 6.5

g3gg0

Quote from: marekk on November 02, 2013, 05:05:04 PM
Now it works, thx

... But somenthing is wrong with camera identification:

this is most likely due to property handlers not made public in your camera model.
which model is it?

this must be done in ML Core.
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!


g3gg0

solution 1:
can you add these two lines to your stubs.S in platforms/60D... ?

/** corectly named canon property reading functions **/
NSTUB( 0xff05b210, PROP_GetMulticastProperty)
NSTUB( 0xff05be34, PROPAD_GetPropertyData)

then rebuild ML core and try.

solution 2:
add those two lines to your .sym file on your CF in ML/MODULES/

ff05b210 PROP_GetMulticastProperty
ff05be34 PROPAD_GetPropertyData

and then try again without recompiling.
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!

marekk

now it works, thx

Quote from: g3gg0 on November 02, 2013, 05:26:30 PM
solution 1:
can you add these two lines to your stubs.S in platforms/60D... ?

/** corectly named canon property reading functions **/
NSTUB( 0xff05b210, PROP_GetMulticastProperty)
NSTUB( 0xff05be34, PROPAD_GetPropertyData)

then rebuild ML core and try.

solution 2:
add those two lines to your .sym file on your CF in ML/MODULES/

ff05b210 PROP_GetMulticastProperty
ff05be34 PROPAD_GetPropertyData

and then try again without recompiling.

g3gg0

ok pushed this change. the next nightly will contain it then.
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!

swinxx

what do you mean by the next nightly..
5dmk3 had no mlv rec module added til now.. so this means that its added now? am i right?
thx.