Issue with GoPro Hero 12 and Video Continuations

Started by scr255, February 01, 2025, 08:03:01 AM

Previous topic - Next topic

scr255

Hi, I'm trying to rename media files based on their timestamps using ExifTool and Python. You can find the repository here: https://github.com/scr255/Rename-By-Metadata

It works as expected for all my videos, except those captured with the GoPro Hero 12.

The issue arises when a video exceeds the chapter size (~12GB). In such cases, the camera closes the first file and starts a new one. This behavior is common in older GoPros as well. However, older models recorded the QuickTime:CreateDate in the correct order, whereas on the GoPro Hero 12, the second file (i.e., the continuation) is sometimes recorded before the first one.

Since I'm relying on ExifTool for metadata extraction, I believe this issue originates from GoPro itself. As a workaround, I'm looking for a metadata tag that indicates whether a file is a continuation or has a continuation.

greybeard

I know nothing about these files at all but the first thing to do with this type of problem would be to run the following exiftool command against sample files (the first and second in a continuation set):

exiftool -a -G1 -u firstFile -diff secondFile

you can then look for a tag that is unique to either the first or second file (it might throw up too many differences but would be somewhere to start)

scr255

#2
By looking at the diff, I noticed a tag called QuickTime:GoPro_CPIN, which provides the progressive number associated with different chapters (separate files) in a continuous capture.

I wasn't retrieving that tag in Python, so I updated the code as follows:

# ---------------------------------------------------------------------
# 2) Extract metadata with ExifTool
# ---------------------------------------------------------------------
abs_paths = [os.path.join(self.dir_sc, f) for f in collected_files]
metadata_list = []

with exiftool.ExifTool() as et:
    for path_chunk in tqdm(abs_paths, desc="Extracting metadata"):
        metadata_list.extend(
            et.execute_json("-ee", "-G1", "-u", "-api", "largefilesupport=1", path_chunk)
        )

df = pd.DataFrame(metadata_list)

Thank you for your help!

Phil Harvey

I'll add support for extracting this tag as ChapterNumber in ExifTool 13.18, so you'll have to change your Python code for this version.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

scr255

Do you intend for the new tag ChapterNumber to replace QuickTime:GoPro_CPIN, or is it meant to be a more universal tag that can be used with various video cameras, not just GoPro?
Keep up the amazing work!

Phil Harvey

The unknown GoPro_CPIN tag will become a known tag named ChapterNumber.  There are other ChapterNumber tags in other types of metadata already, but none that I know written by cameras.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).