Added sequence number to RAW file name within bracketing mode - General Discussion and Assistance - CHDK Forum

Added sequence number to RAW file name within bracketing mode

  • 23 Replies
  • 15167 Views
Added sequence number to RAW file name within bracketing mode
« on: 08 / October / 2008, 03:24:03 »
Advertisements
Hi CHDK fans,

i addes a sequence number to the raw file names when shooting in bracketing mode:

Example directory list:
CRW_1000.CRW
CRW_1001.CRW
CRW_1002_01.CRW
CRW_1003_02.CRW
CRW_1004_03.CRW
CRW_1005_01.CRW
CRW_1006_02.CRW
CRW_1007_03.CRW

In this example I took 2 "normal" shots. Then I switched to "bracketing in continous mode" and took two EV bracketing sequences, containing of each 3 pictures. This makes it easyer to idetify the shots, belonging together.

Do you think, this might be important for all CHDK users?
If yes, thhis ist my diff to the CHDK trunk:

Code: [Select]
Index: trunk/core/raw.c
===================================================================
--- trunk/core/raw.c   (Revision 524)
+++ trunk/core/raw.c   (Arbeitskopie)
@@ -9,6 +9,7 @@
 #define RAW_TARGET_DIRECTORY    "A/DCIM/%03dCANON"
 //#define RAW_TMP_FILENAME        "HDK_RAW.TMP"
 #define RAW_TARGET_FILENAME     "%s%04d%s"
+#define RAW_BRACKETING_FILENAME "%s%04d_%02d%s"
 
 //-------------------------------------------------------------------
 static char fn[64];
@@ -26,6 +27,7 @@
 int raw_savefile() {
       int fd, m=(mode_get()&MODE_SHOOTING_MASK);
     static struct utimbuf t;
+    static int br_counter;
 
     if (state_kbd_script_run && shot_histogram_enabled) build_shot_histogram();
 
@@ -46,6 +48,15 @@
 
     shooting_bracketing();
 
+    if(conf.tv_bracket_value || conf.av_bracket_value || conf.iso_bracket_value || conf.subj_dist_bracket_value) {
+        if(state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)
+            br_counter = 1;
+        else
+            br_counter++;
+    }
+    else
+        br_counter=0;
+
     // got here second time in a row. Skip second RAW saving.
     if (conf.raw_save_first_only && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) {
         return 0;
@@ -65,7 +76,10 @@
         mkdir(dir);
 
         sprintf(fn, "%s/", dir);
-        sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
+        if(br_counter)
+            sprintf(fn+strlen(fn), RAW_BRACKETING_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), br_counter, img_exts[conf.raw_ext]);
+        else
+            sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
 
         fd = open(fn, O_WRONLY|O_CREAT, 0777);
         if (fd>=0) {

Have fun
Randolf



*

Offline reyalp

  • ******
  • 14118
Re: Added sequence number to RAW file name within bracketing mode
« Reply #1 on: 08 / October / 2008, 03:59:02 »
Note that this no longer conforms to Design rule for Camera File system - Wikipedia, the free encyclopedia

This changes how the camera treats the files in various ways, see here Some notes on file prefix and extension treatment

ISTR that dryos also has issues with long filenames, but I might be mistaken there. You might want to use a different 8.3 pattern instead. For example BNN_NNNN.CRW

Or you maybe you could abuse the stitch assist naming convention: ST[A-Z]_NNNN.CRW
Don't forget what the H stands for.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Added sequence number to RAW file name within bracketing mode
« Reply #2 on: 08 / October / 2008, 04:28:20 »
ISTR that dryos also has issues with long filenames, but I might be mistaken there.

AFAIK, DryOS can create (read etc.) files with long names, but filebrowser in CHDK can operate only with short filenames. Here it is discussed

Re: Added sequence number to RAW file name within bracketing mode
« Reply #3 on: 08 / October / 2008, 05:37:47 »
OK, while trying different things, I recovered, that filenames up to 18 characters will work. Maybe that this is different with other camera models. Even I'm using Linux instead of Canon ZoomBrowser...

The idea with the stitch naming seems good. For bracketing the raw files might be named

BRA_1000.CRW / BRB_1000.CRW / BRC_1000.CRW  or
B01_1000.CRW / B02_1000.CRW / B03_1000.CRW

I'll read the notes on file prefix and extension treatment to find a solution.
An update will take until tomorrow. I don't have my camera with me.
Randolf
« Last Edit: 08 / October / 2008, 06:08:43 by rr807 »


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Added sequence number to RAW file name within bracketing mode
« Reply #4 on: 08 / October / 2008, 06:18:00 »
well if you keep the ST[A-Z] scheme, people can download the raws without having to use a cardreader.

Re: Added sequence number to RAW file name within bracketing mode
« Reply #5 on: 08 / October / 2008, 06:38:45 »
well if you keep the ST[A-Z] scheme, people can download the raws without having to use a cardreader.

Hi PhyrePhoX,

do you mean to use "ST[A-Z]" or just this scheme?

"ST" means "stitch". I'd like to use "BR" for "bracket".
But if ZoomBrowser only supports "ST[A-Z]" I'll take this...

Randolf



*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Added sequence number to RAW file name within bracketing mode
« Reply #6 on: 08 / October / 2008, 06:56:25 »
well yeah, i meant to use ST, for convenience. however, i dont know how many people who use raw are using the canon utilities.

Re: Added sequence number to RAW file name within bracketing mode
« Reply #7 on: 08 / October / 2008, 07:06:30 »
If the information about sequence number is not present in EXIF, you can add it there.
Paul


Re: Added sequence number to RAW file name within bracketing mode
« Reply #8 on: 08 / October / 2008, 08:33:38 »
If the information about sequence number is not present in EXIF, you can add it there.
Paul

This is what I tried first, but I don't know, if it is possible to write to an exif tag.
I searced for a related function in CHDK, but didn't find one.

This would even match only JPG files. CHDK raw files don't contain any exif data...

Randolf


*

Offline reyalp

  • ******
  • 14118
Re: Added sequence number to RAW file name within bracketing mode
« Reply #9 on: 08 / October / 2008, 21:31:31 »
This is what I tried first, but I don't know, if it is possible to write to an exif tag.
I searced for a related function in CHDK, but didn't find one.

This would even match only JPG files. CHDK raw files don't contain any exif data...

Randolf
Correct, CHDK does not yet have control of the exif data.

The CRWs don't have metadata, but programs such as dng4ps2 can get it from the jpeg.

The "special" treatment of the various prefixes and extensions isn't just canons ZoomBrowser, AFAIK it affects anything that accesses the camera using PTP, i.e. using the USB cable, and also affects how the camera itself deals with the files.

If you don't use one of the recognized prefixes, deleting the jpeg on the camera will not delete the raw, but otherwise it should be fine. If you don't use a recognized extension, you would have to use a card reader to transfer.

I'm not sure what will happen if you have IMG_XXXX.JPG and ST<char>_XXXX.CRW with the same number, but if it works, the fact that ST is also used for stitch assist shouldn't be a problem, since stitch+bracketing really doesn't make much sense (and is not currently possible AFAIK)

Note that all my information on this is from experimenting with one camera, it's quite possible they don't all work exactly the same.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal