File format change

Started by Vik_S, March 03, 2019, 10:45:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Vik_S

Hello. Help please. How to implement silent picture mode with the ability to save dng as cr2? In this case, let only the extension and not the file format change. This is necessary in order to pick up files by usb cable.

Vik_S

no answer  :-[ please help somebody. this is very important to me

scrax

if you are able to compile ML you could edit/expand FEATURE_EYEFI_TRICKS that is doing same thing for CR2 (renaming the extension to AVI so eye-fi card will transfer them and then rename back AVI file to CR2 on the pc).

EDIT: after taking a look at it i've ported the feat to a module and added the option to rename .DNG to .CR2


/*
* EyeFi Tricks (EyeFi confirmed working only on 600D-60D)
*/

#include <module.h>
#include <dryos.h>
#include <bmp.h>
#include <beep.h>

int check_eyefi();
void EyeFi_RenameCR2toAVI(char* dir);
void EyeFi_RenameAVItoCR2(char* dir);

void EyeFi_Rename422toMP4(char* dir);
void EyeFi_RenameMP4to422(char* dir);

void EyeFi_RenameDNGtoCR2(char* dir);
void EyeFi_RenameCR2toDNG(char* dir);

/* since now it's a module is up to the user install on eye-fi card or not
int check_eyefi()
{
    FILE * f = FIO_OpenFile("EYEFI/REQC", 0);
    if (f)
    {
        FIO_CloseFile(f);
        return 1;
    }
    return 0;
}*/

void change_extension(char* dir, char* oldext, char* newext)
{
    struct fio_file file;
    struct fio_dirent * dirent = FIO_FindFirstEx( dir, &file );
    if( IS_ERROR(dirent) )
        return;

    do {
        if (file.mode & 0x10) continue; // is a directory
        if (file.name[0] == '.') continue;
        if (!streq(file.name + 8, oldext)) continue;

        static char oldname[50];
        static char newname[50];
        snprintf(oldname, sizeof(oldname), "%s/%s", dir, file.name);
        strcpy(newname, oldname);
        newname[strlen(newname) - 4] = 0;
        STR_APPEND(newname, newext);
        bmp_printf(FONT_LARGE, 0, 0, "%s...", newname);
        FIO_RenameFile(oldname, newname);
    } while( FIO_FindNextEx( dirent, &file ) == 0);
    FIO_FindClose(dirent);
}

void EyeFi_RenameCR2toAVI(char* dir)
{
    change_extension( dir, ".CR2", ".AVI");
    beep();
    redraw();
}

void EyeFi_RenameAVItoCR2(char* dir)
{
    change_extension( dir, ".AVI", ".CR2");
    beep();
    redraw();
}

void EyeFi_Rename422toMP4(char* dir)
{
    change_extension( dir, ".422", ".MP4");
    beep();
    redraw();
}

void EyeFi_RenameMP4to422(char* dir)
{
    change_extension( dir, ".MP4", ".422");
    beep();
    redraw();
}

void EyeFi_RenameDNGtoCR2(char* dir)
{
    change_extension( dir, ".DNG", ".CR2");
    beep();
    redraw();
}

void EyeFi_RenameCR2toDNG(char* dir)
{
    change_extension( dir, ".CR2", ".DNG");
    beep();
    redraw();
}

static void CR2toAVI(void* priv, int delta)
{
    EyeFi_RenameCR2toAVI((char*)get_dcim_dir());
}

static void AVItoCR2(void* priv, int delta)
{
    EyeFi_RenameAVItoCR2((char*)get_dcim_dir());
}

static void f422toMP4(void* priv, int delta)
{
    EyeFi_Rename422toMP4(get_dcim_dir());
}

static void MP4to422(void* priv, int delta)
{
    EyeFi_RenameMP4to422(get_dcim_dir());
}
static void DNGtoCR2(void* priv, int delta)
{
    EyeFi_RenameDNGtoCR2(get_dcim_dir());
}

static void CR2toDNG(void* priv, int delta)
{
    EyeFi_RenameCR2toDNG(get_dcim_dir());
}

static struct menu_entry eyefi_menus[] = {
    {
        .name        = "EyeFi Trick",
        .select        = menu_open_submenu,
        .help = "Rename CR2 files to AVI (trick for EyeFi cards).",
        .children =  (struct menu_entry[]) {
            {
                .name        = "Rename CR2 to AVI",
                .select        = CR2toAVI,
                .help = "Rename CR2 files to AVI (trick for EyeFi cards)."
            },
            {
                .name        = "Rename AVI to CR2",
                .select        = AVItoCR2,
                .help = "Rename back AVI files to CR2 (trick for EyeFi cards)."
            },
            {
                .name        = "Rename 422 to MP4",
                .select        = f422toMP4,
                .help = "Rename 422 files to MP4 (trick for EyeFi cards)."
            },
            {
                .name        = "Rename MP4 to 422",
                .select        = MP4to422,
                .help = "Rename back MP4 files to 422 (trick for EyeFi cards)."
            },
            {
                .name        = "Rename DNG to CR2",
                .select        = DNGtoCR2,
                .help = "Rename DNG files to CR2."
            },
            {
                .name        = "Rename CR2 to DNG",
                .select        = CR2toDNG,
                .help = "Rename back CR2 files to DNG."
            },
            MENU_EOL
        },
    },
};

static unsigned int eyefi_trik_init()
{
    //if (check_eyefi()) {
        menu_add( "Shoot", eyefi_menus, COUNT(eyefi_menus) );
    //}
    return 0;
}

static unsigned int eyefi_trik_deinit()
{
    return 0;
}

MODULE_INFO_START()
    MODULE_INIT(eyefi_trik_init)
    MODULE_DEINIT(eyefi_trik_deinit)
MODULE_INFO_END()



now is up to you to compile it with your preferred branch and test, I've did not tested it just verified if compiles...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Walter Schulz

Haven't tested it:
silent.c, line 170
        extension = "DNG";
change to
        extension = "CR2";


Vik_S


The difficulty is that this is not a programmer.  :-[  I turned to programmers familiar but they could not compile the module. how to compile them?

Walter Schulz

Try https://www.magiclantern.fm/forum/index.php?board=25.0 sticky topics
"Compiling Magic Lantern on a Macintosh"
or
"Compiling Magic Lantern on Windows 10 (using its Linux subsystem)" for starters. I'm not a programmer either and have no clue how to build a development environment on my own. Following dforts instructions worked pretty well.
I have to assume the programmers you contacted are not familiar with Bitbucket/Mercurial and GCC. You can do it with and without them, believe me.

Disclaimer: Being familiar with command line interfaces is actually helping ...

scrax

As Walter says following the guides is easy to install a toolchain and compile ML without development experiences but some command line expp. is better.
If you manage to have the toolchain and compile ML you will then find out that it's not hard do make small changes to the code for personal needs.

Try this module, you have to use one of the last experimental versions but I'm not sure it will work. If camera freeze pull battery and disable the module.

If it loads you will have the new option eyefi tricks in Shoot

Report back how it works, or not. thanks
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Walter Schulz

@a1ex: Some hint about the EyeFi section in Shoot menu, please.
I inserted my Eye-Fi card into 650D with latest nightly, enabled EyeFi support in Canon menu. There should be a entry called "EyeFi Trick" in Shoot menu. According to feature matrix 650D is supported (Prefs -> EYEFI_TRICKS).
Nothing there. Failure to detect my EyeFI? Does it have to be connected?

a1ex

In order to display that menu, ML checks for a file named EYEFI/REQC. If that file is not there, ML assumes there's no EyeFi card installed.

However, this feature could be useful for other purposes, not just EyeFi. I'd rather be tempted to rewrite it as a Lua script, so users can customize the file renaming tricks as needed.

For existing code, I believe the EyeFi support can be diagnosed in QEMU. You will need to run it as root, as it needs raw access to the SD card. No idea if or how it works under Windows.

Or, to test that code, just comment out the check.

Walter Schulz

Thanks, will remove the check! Looks like check is not working for my cam at all.

@scrax: Tried your module with 650D, latest lua_fix build. Works!
With nightly build module won't load with "OldAPI" message which seems a bit odd.

Vik_S

Quote from: scrax on March 05, 2019, 02:34:30 PM
As Walter says following the guides is easy to install a toolchain and compile ML without development experiences but some command line expp. is better.
If you manage to have the toolchain and compile ML you will then find out that it's not hard do make small changes to the code for personal needs.

Try this module, you have to use one of the last experimental versions but I'm not sure it will work. If camera freeze pull battery and disable the module.

If it loads you will have the new option eyefi tricks in Shoot

Report back how it works, or not. thanks


I have version 7 (7D) when I loaded the module, I saw the inscription version 6 is expected. nothing appeared in the shoot menu

Vik_S

Quote from: Walter Schulz on March 05, 2019, 02:00:18 PM
Try https://www.magiclantern.fm/forum/index.php?board=25.0 sticky topics
"Compiling Magic Lantern on a Macintosh"
or
"Compiling Magic Lantern on Windows 10 (using its Linux subsystem)" for starters. I'm not a programmer either and have no clue how to build a development environment on my own. Following dforts instructions worked pretty well.
I have to assume the programmers you contacted are not familiar with Bitbucket/Mercurial and GCC. You can do it with and without them, believe me.

Disclaimer: Being familiar with command line interfaces is actually helping ...

Many thanks for the replies. I will try what you recommend

Walter Schulz

Scrax's module works perfectly fine on 7D with experimental lua_fix build. Top of page -> Downloads -> Downloads (drop down menu) -> Experiments

Vik_S

Quote from: scrax on March 05, 2019, 02:34:30 PM
As Walter says following the guides is easy to install a toolchain and compile ML without development experiences but some command line expp. is better.
If you manage to have the toolchain and compile ML you will then find out that it's not hard do make small changes to the code for personal needs.

Try this module, you have to use one of the last experimental versions but I'm not sure it will work. If camera freeze pull battery and disable the module.

If it loads you will have the new option eyefi tricks in Shoot

Report back how it works, or not. thanks


I checked with lua_fix build and yes it works for me too but after I restart or open and close the cover for the memory card. Another minus is the long renaming. Let's say if I have 30 frames then it will take time, but it's better than nothing. :) Thank you so much!

scrax

Quote from: Walter Schulz on March 05, 2019, 07:22:14 PM
Thanks, will remove the check! Looks like check is not working for my cam at all.

@scrax: Tried your module with 650D, latest lua_fix build. Works!
With nightly build module won't load with "OldAPI" message which seems a bit odd.
I think becaue I build t from a bleading edge branch i suppose the lua_fix branch added one more version number probably the error don'r make difference from "too old or too new api"

btw, I removed the card check in the module because I think that you can install/enable it if you have the card (or whatever reason) that way

EDIT: Here there is a PR to include the module without the eyefi check in the nightly: If the module works on your camera please report back camera model
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

I've compiled the module with unified build and now it should works on those builds, instead of the bleeding edge

[ HGDIFF   ]   hgdiff.tmp
[ MODULE   ]   eyefitrk.mo
[ STRIP    ]   eyefitrk.mo
[ OBJCOPY  ]   eyefitrk.mo
[ RM       ]   hgdiff.tmp
[ EXPORTS  ]   eyefitrk.sym
0000002c change_extension
00000134 EyeFi_RenameCR2toAVI
00000168 EyeFi_RenameAVItoCR2
0000019c EyeFi_RenameDNGtoCR2
000001d0 EyeFi_RenameCR2toDNG
[ DEPENDS  ]   eyefitrk.dep
Will load on:
    1100D, 500D, 50D, 550D, 5D2, 5D3.113, 5D3.123, 600D, 60D, 650D, 6D, 700D, 7D, EOSM


Atached here the compiled module, as usual please take time to report back if worked or not.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-