Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - aprofiti

Pages: 1 ... 6 7 [8]
Sorry, unable to test more right now; maybe over the weekend. Overall I like where this is heading.

While testing again I noticed that when LV is black, pressing info button will let you switch to Canon overlay and pressing again will let you see ML overlay (it's frozen), but again on both screens no image from sensor... Like if LV wasn't correctly enabled again.

This happens also with mlv_lite which is still unmodified. Tracing usage in code will not help finding more functions to be updated to make they work with extended length.

Hope those infos are useful for debugging.. Let me know if you had time to check

experimenting sounds like a good way to go forward

I still can't figure out why I get a black LV and no Ml menu when switching in and out from LV after a raw video...
LV works good when using Silent Pictures.

@a1ex or @g3gg0 Can you review this Patch to see if I missed something or there is something wrong with my camera? Problem will occur also when changing only the length of without implementing ELNS Block, this let me think there is something related to update.

Also I get wrong prefix for .xmp files like "NIL0185.xmp". I tried to reset Canon's config but It didn't solved the issue

Got it!

Was a problem with missing '\0' in mlv.c when strncpy() of legacy lensName.
I made some tests with mlv_rec and mlv_dump and I can find "ELNS" Block and extended name using a Hex Editor, but i need to figure out why mlv_dump prints an empty name in ELNS Block.

Note: I get Black screen in LV when entering again after a raw recording. Need to test if it's a bug from those changes or not.

Also found what was the problem with Silent Pictures: I was using .mo compiled from lua_fix because in manual_lens_info branch it won't compile. I updated src and compiled it from scratch and now it's working with 64 byte lensName.

Should I commit to this branch or maybe it's better to merge PR first and then experiment with longer Lens Name?

That's a common user error. Silent Pictures only works in manual exposure mode and you need to setup back button focus.

The problem with extending the lens name in MLV is that it will break some (most?) of the MLV processing apps.
I was in M Mode and checked Iso and Shutter time, but wasn't able to take pictures. It's first time I see this error, maybe is related to length? What about back button focus?

As name is internal to ML my general idea was to change his length, then check MLV should return lens name as before in LENS Block (because it copies only the first 32 characters) and then experimenting by adding ELNS Block to get a working export of full name's length. Could it works?

I'll be a little busy in next days. I don't know if I can work on it  :-\

Updated PR with autoload functionality and made some tests to solve aperture with AF Chip.

Here is some ideas to solve issue no.2:
1. Make HALF_SHUTTER handler to works outside live view and update aperture from here (appear to be the easiest, any Hints?)
2. Change camera aperture by make it works from camera.aperture API (At the moment camera will freeze)
3. "Emulating" MPU or EF protocol messages

I'm sounding like a broken record asking for more characters in the lens name but the main developers agreed that it should be fixed. Not that I'm complaining--just bringing @aprofiti up to speed on this. Maybe this could be incorporated into all the great changes he's making to this branch. It is after all an "Experimental" branch.  :D
How many characters in I think a minimum of 48-64 should be addressed to cover most lenses.
Some lenses use a very long name, especially Carl Zeiss (ex. Carl Zeiss Vario-Sonnar T* 100-300 mm f/ 4.5-5.6 C/Y -> 52 characters).

I tried with 64 byte in lens.h and after updating lua_lens.c wrapper to avoid weird aperture values, I have got full name in .xmp file but Silent Pictures wasn't working anymore (error: "Manual exposure is required."). I wasn't able to test .mlv

Knowing where to look makes things really easy - fix committed.

Sorry, didn't test further yet.
Really thank you a1ex! At the moment I am unable to test it, I'll try in next days.

I also tried another lens with a long name and this time the Aperture isn't listed properly (float issue?):

Code: [Select]
{ name = "Samyang 12mm f/2.8 ED AS NCS Fisheye", focal_length =  12, manual_aperture = 2.8 }, --  12mm T3.1 Cine
Code: [Select]
Block: LENS
  Offset: 0x00000184
  Number: 5
    Size: 96
    Time: 0.881000 ms
     Name:        'Samyang 12mm f/2.8 ED AS NCS Fi'
     Serial:      '' (no valid S/N)
     Focal Len:   12 mm
     Focus Dist:  0 mm
     Aperture:    f/1.00
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x00000000
     Flags:       0x00000000
Yes, It's from floating point issue. Value 1.0 is selected by Ml (first index in Fnumbers) because Aperture wasn't found in submenu choices.

Can you try with a1ex commit or by merging PR into lua_fix (use lastest lual_lens.c changes to resolve conflict)?

I have pushed pushed more changes to PR:
1. Values are automatically copied from lenses array when changing shooting mode (Need more testing. WIP: persist previusly selected aperture and focal length)
2. Added custom aperture value to choose from and auto lower bound for aperture
3. Fixed Focal length and aperture in LV

Know Issues:
1. [Solved] Lua's behavior has side effect on some decimal values, they can't be assigned in menu aperture field when script select lens. Values are saved correctly in metadata but they are overwritten when opening Manual Lens menu (see
2. Apertute is changed to adapter's default value after pressing Shutter button in canon GUI when using lens with AF Chip

Can someone review it or better to test it on field? I have only one working AF adapter, so I need to know if others adapters return lens Name and focal length as script checks

I'm checking last things to be able to close PR and I have found a problem when using f-number with a dot (ex. 2.8, 4.5 ...)
Value is written correctly in Lens Info, MLV and .xmp sidecar but not in Manual Lens submenu (but it works when setting value in submenu itself)... It set automatically aperture to 1.0 when menu is opened

After reading again ML Lua Documentation and digging deep in lua's source code, I have now understood how value for a submenu with attribute "choices" is set.

I believe the problem here is in function update_menu() when assigning aperture... It expect a String but when assigning from lenses[].manual_aperture it return a Number

Code: [Select]
lenses = {
    { name = "Portrait 85mm", focal_length = 85, manual_aperture = 2.8 },
    { name = "Portrait 105mm", focal_length = 105, focal_min = 105, focal_max = 105, manual_aperture = 4.5 },

-- f-number values in 1/2 Stop
Fnumbers = {"1.0","1.2","1.4","1.7","2","2.4","2.8","3.3","4","4.8","5.6","6.7","8","9.5","11","13","16","19","22","27","32"}

lens_menu =
    submenu =
            name    = "Aperture",
            help    = "Set Aperture to metadata",
            choices = Fnumbers,
            -- Update Aperture with selected value from submenu
            update = function(this)
                      if lensSelected == true then
                        lens.manual_aperture = tonumber(this.value)
                        -- Reset menu value to the corrected one
                        this.value = lens.manual_aperture
                      end end,
            warning = function()
                        if lensSelected == false then
                          return "this value is not supported for non-manual lens"
                      end end,

-- Update the menu with values for Focal Length and Aperture from selected Lens
-- To be called when switching manual lens
function update_menu()
  lens_menu.submenu["Aperture"].value = lens.manual_aperture

I tried converting to string by using:
Code: [Select]
lens_menu.submenu["Aperture"].value = tostring(lens.manual_aperture)
Doesn't works... instead this works when aperture value chosen is in Fnumbers{}:
Code: [Select]
lens_menu.submenu["Aperture"].value = "2.8"
Someone can explain to me why can't get it working? I have also tried to merge into lua_fix to get latest fixes, but nothing usefull happened.

Question: Should I include also 1/3 stop values to Fnumbers? Currently if an aperture value of the lens isn't found in Fnumbers when opening Manual Lens submenu, it get set to first index (ex. aperture 4.5 not found -> set by script to 1.0)

It's a problem of floating points rapresentation in lua:
Code: [Select]
1.4 -> 1.399999
2.8 -> 2.799999
4.5 -> 4.5 (ok)
5.6 -> 5.59999

Added possibility to change value while using lens:

Could be nice to have direct access to submenu on keypress for a fast change of aperture and focal

Thank you Danne and dfort!

Here it is:
Code: [Select]
Block: LENS
  Offset: 0x000001f0
  Number: 7
    Size: 96
    Time: 8.662000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '0075BCD15' (123456789)
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x00000000
     Flags:       0x00000000

With no valid serial in mlv file:
Code: [Select]
Block: LENS
  Offset: 0x000001f0
  Number: 7
    Size: 96
    Time: 9.048000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '' (no valid S/N)
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x0000001B
     Flags:       0x00000000
Good work g3gg0!

Little sneak peek: I'm trying to add submenus to be able to change aperture and focal length when using the lens; at the moment it works but can't retrive value from lens.focal_len to set starting value in menu and bounds for min and max. Hope I have time to finish in next days

@aprofiti -- mlv_dump is in modules/mlv_rec

I get this: (OSX)

Code: [Select]
PCAlessandro:mlv_rec alex$ make mlv_dump
[ HOST_CC  ]
clang: error: unknown argument: '-mno-ms-bitfields'
make: *** [] Error 1

can you also update mlv_dump? it should show you the serial as plain number.
How do I do to recompile it? I can’t find it in any ml folder

can you try the latest patches, please?

It works! I have manually copied changes regarding Serial Number from your commits

Code: [Select]
Block: LENS
  Offset: 0x000001f0
    Size: 96
    Time: 8.662000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '0075BCD15'
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x00000000
     Flags:       0x00000000

Serial: 123456789 is saved as in Lens Info Menu format

I have pushed more changes to PR. Currently I am trying to save Serial Number in MLV File

This is what i get from MLV metadata:
Code: [Select]
Block: LENS
  Offset: 0x000001f0
    Size: 96
    Time: 9.048000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '0'
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x0000001B
     Flags:       0x00000000

This is what I modified in modules/mlv_rec/mlv.c:
Code: [Select]
void mlv_fill_lens(mlv_lens_hdr_t *hdr, uint64_t start_timestamp)
    strncpy((char *)hdr->lensName,, 32);
    //Changed this one with snprintf()
    //strncpy((char *)hdr->lensSerial, "", 32);
    snprintf((char *)hdr->lensSerial, 32, "%d", lens_info.lens_serial);

    //strncpy((char *)hdr->lensName, lens_info.lens_serial, 32); Doesn't works well, It print a weird string

Is this a valid way to copy value from lens_info struct?


It would be great if you can make a pull request for this.

Here is the PR, take a look please.

I had to remove the check for switching shoot mode as sometimes it was responsible for breaking lens name value in Lens Info, but I didn't checked if values were saved correctly in MLV metadata.
I noticed a strange behavior in the handler's execution... For some reason it reached the end of the function only after a second call occured, maybe it can be the problem or I am missing some information on how lua property works.

Here is the script i was using if you want to try:
Code: [Select]
-- Manual Lens Information V2
-- Supplies lens information for manual lenses
-- Whenever there is a non-chipped lens detected, we prompt the user to select the attached manual lens from a list


lenses =
--  The following is for testing purposes. Comment out the following lines then either uncomment only the lenses
--  that you want to use from the list or add your own lenses. Tip: Put your most used lenses at the top of the list.

    { name = "My Lens", focal_length = 50 },
    { name = "My Other Lens", focal_length = 25 },
    { name = "Yashica ML 50mm f1.9", focal_length = 50 },
    { name = "Pentax SMC 80-200mm f4,5", focal_length = 200, manual_aperture = 4.5 },

--  Zeiss ZF.2 manual lenses Nikon mount - these work with the lens profiles that ship with Adobe Camera Raw

--  { name = "Zeiss Distagon T* 2.8/15 ZF.2",        focal_length =  15, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 3.5/18 ZF.2",        focal_length =  18, manual_aperture = 3.5 },
--  { name = "Zeiss Distagon T* 2.8/21 ZF.2",        focal_length =  21, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 2.8/25 ZF.2",        focal_length =  25, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 2/25 ZF.2",          focal_length =  25, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 2/28 ZF.2",          focal_length =  28, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 2/35 ZF.2",          focal_length =  35, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 1.4/35 ZF.2",        focal_length =  35, manual_aperture = 1.4 },
--  { name = "Zeiss Makro-Planar T* 2/50 ZF.2",      focal_length =  50, manual_aperture = 2   },
--  { name = "Zeiss Planar T* 1.4/50 ZF.2",          focal_length =  50, manual_aperture = 1.4 },
--  { name = "Zeiss Planar T* 1.4/85 ZF.2",          focal_length =  85, manual_aperture = 1.4 },
--  { name = "Zeiss Makro-Planar T* 2/100 ZF.2",     focal_length = 100, manual_aperture = 2   },
--  { name = "Zeiss Apo Sonnar T* 2/135 ZF.2",       focal_length = 135, manual_aperture = 2   },

--  Nikon lenses
--  { name = "Nikon Zoom Ais ED 50-300",             focal_length = 300, manual_aperture = 4.5 },
--  { name = "Nikon AF NIKKOR 28mm f/1.4D",          focal_length =  28, manual_aperture = 1.4 },

--  Samyang manual lenses - also branded as Rokinon and Bower. Cine versions use the same lens profile.
--  The lens profiles for Samyang manual lenses that ship with Adobe Camera raw must be modified in order
--  for automatic lens detection to work.
--  More information here:

--  { name = "Samyang 8mm f/2.8 UMC Fisheye",        focal_length =   8, manual_aperture = 2.8 },
--  { name = "Samyang 8mm f/2.8 UMC Fisheye II",     focal_length =   8, manual_aperture = 2.8 }, --   8mm T3.1 Cine
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS",    focal_length =   8, manual_aperture = 3.5 },
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS II", focal_length =   8, manual_aperture = 3.5 }, --   8mm T3.8 Cine
--  { name = "Samyang 10mm f/2.8 ED AS NCS CS",      focal_length =  10, manual_aperture = 2.8 }, --  10mm T3.1 Cine
--  { name = "Samyang 12mm f/2 NCS CS",              focal_length =  12, manual_aperture = 2   }, --  12mm T2.2 Cine
--  { name = "Samyang 12mm f/2.8 ED AS NCS Fisheye", focal_length =  12, manual_aperture = 2.8 }, --  12mm T3.1 Cine
--  { name = "Samyang 14mm f/2.8 ED AS IF UMC",      focal_length =  14, manual_aperture = 2.8 }, --  14mm T3.1 Cine
--  { name = "Samyang 16mm f/2 ED AS UMC CS",        focal_length =  16, manual_aperture = 2   }, --  16mm T2.2 Cine
--  { name = "Samyang 21mm f/1.4 ED AS UMC CS",      focal_length =  21, manual_aperture = 1.4 }, --  21mm T1.5 Cine
--  { name = "Samyang 24mm f/1.4 ED AS IF UMC",      focal_length =  24, manual_aperture = 1.4 }, --  24mm T1.5 Cine
--  { name = "Samyang 35mm f/1.4 AS IF UMC",         focal_length =  35, manual_aperture = 1.4 }, --  35mm T1.5 Cine
--  { name = "Samyang 50mm f/1.2 AS UMC CS",         focal_length =  50, manual_aperture = 1.2 },
--  { name = "Samyang 50mm f/1.4 AS UMC",            focal_length =  50, manual_aperture = 1.4 }, --  50mm T1.5 Cine
--  { name = "Samyang 85mm f/1.4 AS IF UMC",         focal_length =  85, manual_aperture = 1.4 }, --  85mm T1.5 Cine
--  { name = "Samyang 100mm f/2.8 ED UMC MACRO",     focal_length = 100, manual_aperture = 2.8 }, -- 100mm T3.1 Cine
--  { name = "Samyang 135mm f/2 ED UMC",             focal_length = 135, manual_aperture = 2   }, -- 135mm T2.2 Cine
--  { name = "Samyang 300mm f/6.3 ED UMC CS",        focal_length = 300, manual_aperture = 6.3 },

--  Lensbaby lenses

--  { name = "Lensbaby Sweet 35",                    focal_length =  35, manual_aperture = 2.5 },
--  { name = "Lensbaby Sweet 50",                    focal_length =  50, manual_aperture = 2.5 },
--  { name = "Lensbaby Twist 60",                    focal_length =  60, manual_aperture = 2.5 },
--  { name = "Lensbaby Edge 50",                     focal_length =  50, manual_aperture = 3.2 },
--  { name = "Lensbaby Edge 80",                     focal_length =  80, manual_aperture = 2.8 },
--  { name = "Lensbaby Circular Fisheye",            focal_length = 5.8, manual_aperture = 3.5 },
--  { name = "Lensbaby Soft Focus Optic",            focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Double Glass Optic",          focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Single Glass Optic",          focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Plastic Optic",               focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Pinhole Optic",               focal_length =  50, manual_aperture = 19  },
--  { name = "Lensbaby Fisheye Optic",               focal_length =  12, manual_aperture = 4   },
--  { name = "Lensbaby Velvet 56",                   focal_length =  56, manual_aperture = 1.6 },
--  { name = "Lensbaby Velvet 85",                   focal_length =  85, manual_aperture = 1.8 },
--  { name = "Lensbaby Creative Aperture",           focal_length =  50, manual_aperture = 2   },


selector_instance = selector.create("Select Manual Lens", lenses, function(l) return end, 600)

lens_config = config.create({})

if ~= nil and ~= nil then
    for i,v in ipairs(lenses) do
        if == then
            selector_instance.index = i

-- Property to be written in .xmp file
xmp:add_property(xmp.lens_name, function() return end)
xmp:add_property(xmp.focal_length, function() return lens.focal_length end)
xmp:add_property(xmp.aperture, function() return math.floor(camera.aperture.value * 10) end)

-- Flag variable to avoid selecting lens when switching shott mode
lensSelected = 0

function is_manual_focus()
  console.write("In is_manual_focus()\n")

  if (lens.lens_id == 0 or lens.lens_id == "(no lens)" or == "1-65535mm" or lens.focal_length == "1-65535mm") then
    console.write("In is_manual_focus() - TRUE\n")
    return true
    console.write("In is_manual_focus() - FALSE\n")
    return false

--  Handler for lens_name property
--  Get Called when:
--  Switching lens
--  Switching shoot mode
function property.LENS_NAME:handler(value)
    console.write("In Handler - LensSelected:\n")

    -- Check if lens has already been selected by menu
    if lensSelected == 0 then
      if is_manual_focus() then
        -- Not a manual Lens, no need to write sidecart file
        if selector_instance ~= nil then
            selector_instance.cancel = true
            console.write("Selector_instance is NULL")
        -- Clear flag variable for next run
        lensSelected = 0
        console.write("XMP STOP")


    console.write("Exiting from Handler\n")

function select_lens()
    if #lenses > 1 then
        local menu_already_open = menu.visible
        if not menu_already_open then
            display.rect(0, 0, display.width, display.height, COLOR.BLACK, COLOR.BLACK)
        if selector_instance:select() then
        if not menu_already_open then
    elseif #lenses == 1 then

-- Copy lens attribute from
function update_lens()
    console.write("In update_lens()\n")

    for k,v in pairs(lenses[selector_instance.index]) do
        lens[k] = v
    end = { name = lenses[selector_instance.index].name }

    -- Avoid to select lens again when switching shoot mode
    lensSelected = 1
    -- Enable to read values for Lens Info and MLV file
    lens.lens_exists = true
    console.write("Setting lens_exists to TRUE\n")

lens_menu =
    parent = "Lens Info Prefs",
    name = "Manual Lens V2",
    help = "Info to use for attached non-chipped lens",
    icon_type = ICON_TYPE.ACTION,
    select = function()
        if is_manual_focus() then
    rinfo = function()
    warning = function()
        flag = is_manual_focus()
        if flag == false then
            return "Chipped lens is attached"

-- Check lens on start
if is_manual_focus() then

Note: I get a compilation error for silent.o from manual_lens_info even without my changes, it need some investigation but I copied a compiled version to run the test

I managed to make the script works with manual lens with AF confirm Chip.
Also possibly found a way to avoid selecting lens everytime shoot mode is changed (this also avoid getting errors when changing more mode at a time without selecting lens from menu) but it need more testing.

Right now my main interest is to get the metadata into an mlv file.
then when the dngs are generated in post this metadata will be put inside the dng files.

My knowledge of how the metadata is written in mlv video is limited.

Anyone know how its written in the mlv?

for stills it would be nice to have it in the cr2 but this might be more difficult. then the xmp route might be best for stills.

I have found a way to get Lens Info to work with Manual Lenses and consequently Lens Name and Focal Length (maybe also Aperture value) get written in Mlv file generated by Silent Pictures. Don't know if it also works for raw video files.

I can push changes to the repository (if someone find this interesting) after testing a cleaner way to get values and finished to optimize the script

General Development / Re: Flexible info screen
« on: December 13, 2017, 11:09:23 PM »
I'm triyng to port flexinfo to 50D.

I enabled "FEATURE_FLEXINFO" in "features.h", copied a test configuration from 7D or 5D2 in "flexinfo.c" and used "CONFIG_50D" instead, but it doesn't show up on camera.
How can I debug it?

Also I have found a compilation error when "FEATURE_FLEXINFO_FULL" is defined:
Code: [Select]
../../src/flexinfo.c:3137:44: error: initializer element is not constant
         .children =  (struct menu_entry[]) {
../../src/flexinfo.c:3137:44: note: (near initialization for 'info_menus[0]')
make: *** [flexinfo.o] Error 1
Checking syntax from other sources seems coherent to this one. Solving it will maybe help understanding if is loaded but not showed.

Reverse Engineering / Re: TFT SIO communication (
« on: November 30, 2017, 12:46:25 AM »
Here is a brief summary of which registers do something on 50D

0x03 (V) Half resolution with odd values
0x04 (H) from value 0xa0 we get green screen on half of the values

0x06 Value format: 0xYZ
 Y in 9, b, d, f
 Z in 2 (flip vertical), 4 (flip horizontal), 6 (flip both vertical and horizontal)

 ex. value 0x92, 0xb4, 0xd6, 0xf2 etc...

Color calibration:
0x0b (Thermal Camera Effect)
0x12 (Color Saturation)

Screen adjustment:
0x10 (I think is Contrast)
0x11 (Brightness)

Affect LiveView:
0x00 (Screen Gain??)


Note: I have missed how to invert screen color, not sure if it is present

Hope it helps!

Reverse Engineering / Re: TFT SIO communication (
« on: November 29, 2017, 10:18:31 PM »
Hi, I tried to compile and test the module for 50D from dfort commit, but it doesn't work.

Brute force will end immediatly without any consistent output and when I try to change registers value by hand the camera will freeze

Pages: 1 ... 6 7 [8]