G7X Mark I extended video time - beginning of a patch - DryOS Development - CHDK Forum

G7X Mark I extended video time - beginning of a patch

  • 1 Replies
  • 67 Views
G7X Mark I extended video time - beginning of a patch
« on: 08 / December / 2024, 15:40:07 »
Advertisements
I want to film longer videos with my G7X. Maximum recording length for 720p and 1080p is 29m29s.

The attached patch is a start. It only works for firmware revision 100d. It's not hooked into the config system yet. It just overrides the hardcoded frame limits. I have successfully used it to record 720p@30fps longer than 30mins.

The real problem is the 4gb file size limit though. At 1080p 30fps, I can record only about 25mins before hitting 4gb. Changing video compression is not implemented for the G7X mkI.

I took a look at the FILE structure. As the 'pos' field seems to be a 32-bit uint, writing longer files is likely very hard or impossible even with the new exFat support. Or is it?

Maybe we could split larger video files automatically when reaching the 4gb limit? Has anyone researched this?

It took me quite a while to even get this far. I really came to appreciate all the amazing work that must have gone into CHDK. Thanks a lot to everybody involved. You rock!

*

Offline reyalp

  • ******
  • 14126
Re: G7X Mark I extended video time - beginning of a patch
« Reply #1 on: 08 / December / 2024, 20:13:45 »
I want to film longer videos with my G7X. Maximum recording length for 720p and 1080p is 29m29s.

The attached patch is a start. It only works for firmware revision 100d. It's not hooked into the config system yet. It just overrides the hardcoded frame limits. I have successfully used it to record 720p@30fps longer than 30mins.
Nice work. I don't do much with video by I'll try to check it out.

Quote
The real problem is the 4gb file size limit though. At 1080p 30fps, I can record only about 25mins before hitting 4gb. Changing video compression is not implemented for the G7X mkI.

I took a look at the FILE structure. As the 'pos' field seems to be a 32-bit uint, writing longer files is likely very hard or impossible even with the new exFat support. Or is it?
The stdio (Fut) functions definitely only work with 32 bit values. You see this looking at Fseek_Fut and the underlying function fseek_low which only take 32 bit arguments and only set a 32 bit value in pos. Lseek (used with file descriptors from Open rather than FILE *) similarly only takes single word offset, though from a cursory look I think some of the underlying functions (like FUN_fc56c4d8) might use 64 bit. So it seems like normal file IO APIs in these firmwares is not prepared to handle larger files.

Quote
Maybe we could split larger video files automatically when reaching the 4gb limit? Has anyone researched this?
It's certainly come up before but I'm not aware of anyone researching it for CHDK in a significant way. The closest is scripts (https://chdk.fandom.com/wiki/Continuous_Video_Scripts) that re-start recording periodically. It might be doable in in principle, but my impression is the camera tries to finalizes some of the container metadata when you stop recording, and this could be very confused by large / split files. There might also be data structures related to the in-progress recording that would overflow or break in some way. But I haven't tried or looked at the code.

A note on the patch: Where there's a bunch of data in the middle of a function, it's because Canon's compiler put a literal pool there https://developer.arm.com/documentation/dui0801/l/Writing-A32-T32-Assembly-Language/Literal-pools
Since the constant refs in your code will get their own literals generated by your compiler, you don't need to copy the Canon ones. I usually put a .ltorg and comment where the Canon one was.
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal