c2patool icon indicating copy to clipboard operation
c2patool copied to clipboard

Don't rely on file extensions

Open hackerfactor opened this issue 2 years ago • 4 comments

The current code uses file extensions to determine the type of file.

  • It assumes that "image.jpg" and "image.jpeg" is a JPEG.
  • It assume that "image.png" is a PNG.

However, it is very common to have a file without an extension ("image.dat") or to have the wrong extension ("image.jpeg" that is really a GIF or PNG).

The current code cannot process the file if it has the wrong extension.

The code should really be using 'magic' to determine the file type, rather than relying on the file extension.

hackerfactor avatar Oct 23 '23 01:10 hackerfactor

c2patool fails to recognize .m4v, .3gp, and other common mp4/mov compatible files. Renaming the files to .mp4 or .mov allows them to be processed.

If the code used 'magic' to determine the file type, then it would handle all of these other video formats without requiring manual renaming.

hackerfactor avatar Mar 08 '24 07:03 hackerfactor

Thanks, sorry for the slow response. I'm planning to add that functionality to the c2pa-rs code and c2patool will inherit it.

gpeacock avatar Apr 26 '24 15:04 gpeacock

It is not that simple, not all BMFF files will be supported by the tool. We prefer to test before we simply add to the list.

mauricefisher64 avatar Jul 30 '24 18:07 mauricefisher64

No matter what c2patool supports, not requiring file extensions would still be very helpful.

makew0rld avatar Jul 30 '24 19:07 makew0rld