Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow DCF for DVR storage #418

Merged

Conversation

sanderpuh
Copy link
Contributor

  • Store DVR files in folder /DCIM/100HDZRO/
  • Extend index length to 4 (hdz_xxx to hdz_xxxx)

Design rule for Camera File system (DCF)

- Store DVR files in /DCIM/100HDZRO/
- Extend index length to 4 (hdz_xxx to hdz_xxxx)
@ligenxxxx
Copy link
Member

#define REC_filePathGet(BUFF, PATH, PREFIX, INDEX, FILEFMT)
Does INDEX need to be changed to %04d?

@ligenxxxx
Copy link
Member

ligenxxxx commented Jun 5, 2024

When the file index is 9999, what is the next index? I don't seem to find the code to clear the index to 0, I guess the index will become 10000. Is this acceptable?

@sanderpuh
Copy link
Contributor Author

sanderpuh commented Jun 5, 2024

#define REC_filePathGet(BUFF, PATH, PREFIX, INDEX, FILEFMT) Does INDEX need to be changed to %04d?

Good call, overlooked that one. Yes, INDEX needs to be changed to %04d.

Regarding the next index after 9999 - I don't think we'll ever get to that point, so it is acceptable for now. DVR files have a large size, SD card will be filled long before we hit 9999 files. Using DCF in general allows us to review DVR files on iOS.

In a future release we can further enhance the DCF format. Each DCF directory may contain up to 9999 DCF objects, numbered from "0001" to "9999". This number is also known as a "file number".
First DCF directory starts with 100, in my code it's hard coded as "100HDZRO". For example, the next file after hdz_9999 should create a new folder "101HDZRO", starting with file number hdz_0000 again. So it would also require an index for the subdirectory in the DCIM folder.

@sanderpuh sanderpuh mentioned this pull request Jun 5, 2024
@ligenxxxx ligenxxxx merged commit dc571ac into hd-zero:main Jun 5, 2024
1 check passed
@sanderpuh sanderpuh deleted the Follow-DCF-standard-for-media-storage-(DVR) branch June 5, 2024 11:14
@ligenxxxx
Copy link
Member

@sanderpuh
image
You should also change this, otherwise the folder will not be created.

@ligenxxxx
Copy link
Member

If users use time to name video files, can they satisfy DCF?

@sanderpuh
Copy link
Contributor Author

sanderpuh commented Jun 6, 2024

You should also change this, otherwise the folder will not be created.

You mean this should change in case we're generating multiple subdirectories, correct? As is, the directory /DCIM/100HDZRO/ is generated and recorded files are stored, starting with hdz_0000.


If users use time to name video files, can they satisfy DCF?

If users use date / time to name video files, ánd you want to satisfy DCF, you have to stay within the rules of DCF. You could use the subdirectory and file numbering to include the date in naming.

Subdirectories
The file system contains a DCIM directory, which can contain multiple subdirectories with names such as "123ABCDE" that consist of a unique directory number (in the range 100…999) and five alphanumeric characters (or any valid filename characters), which may be freely chosen.

Files
The directories contain files with names such as "ABCD1234.JPG" that consist of four alphanumeric characters, followed by a number in the range 0001...9999.

For example:

  • DCIM
    • xxxYMMDD
      • HHMMzzzz

/DCIM/xxxYMMDD/HHMMzzzz.mp4

xxx: unique directory number 100...999
Y: year (2024-06-06)
MM: month (2024-06-06)
DD: day (2024-06-06)
HH: hour (08:55)
MM: minute (08:55)
zzzz: unique file number 0001...9999

The final file in the above example would be /DCIM/10040606/08550001.mp4

NOTE: I have not tested the above directory example as DCF structure yet! This requires further testing, perhaps there's better naming structures as well.

@ligenxxxx
Copy link
Member

Currently this PR will cause the recording to not start because the DCIM/100HDZRO folder is not created correctly.
mkdir("/DCIM/100HDZRO", 0777) will fail because the DCIM folder does not exist.
I recommend using system("mkdir -p /DCIM/100HDZRO"), Of course you need to introduce variables.

The option to name the DVR by date is in the menu, please test it.

@ligenxxxx
Copy link
Member

DCF is satisfied when Naming Scheme is set to Digits.
/DCIM/100HDZRO/hdz_001.ts
DCF is not satisfied when Naming Scheme is set to Date.
/DCIM/100GDZRO/20240606-175934.ts
Do you think this is ok?

@sanderpuh sanderpuh restored the Follow-DCF-standard-for-media-storage-(DVR) branch June 6, 2024 12:40
@sanderpuh
Copy link
Contributor Author

sanderpuh commented Jun 6, 2024

@ligenxxxx please see #422 - Subdirectory is now created correctly, and permissions set to 777.

Naming Scheme options are best of both worlds, people can then choose between DCF format or Date format. The option to change the Naming Scheme is greyed out because I don't have the RTC battery installed in the goggles, so I could not test that option (yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants