Fix FFmpeg Error: "Tag GPMD incompatible output codec id 0" when Concatenating Trimmed GoPro Videos
GoPro cameras are widely used for action video recording. Often, users want to concatenate trimmed clips from their GoPro footage using FFmpeg. However, they might encounter an error saying:
"Tag GPMD incompatible output codec id 0"
Understanding the Error
This error occurs because the GPMD (Global Positioning and Motion Decoder) tag, specific to GoPro's metadata, is not compatible with the default output codec (codec id 0) of FFmpeg. This tag contains information like GPS coordinates, speed, and other details about the video recording.
How to Resolve the Error
You can resolve this issue by explicitly specifying the output codec that supports the GPMD tag in your FFmpeg command.
Recommended FFmpeg Command
Given the task at hand, the recommended FFmpeg command for concatenating trimmed GoPro videos is as follows:
ffmpeg -f concat -i list_videos.txt -c copy -map 0:v -map 0:a -map 0:3 -metadata:s:g GPS=$GPS -fflags +genpts "ab.mp4"
Explanation of the Command
-f concat: Tells FFmpeg to concatenate video files specified in thelist_videos.txtfile.-i list_videos.txt: Defines the input file listing trimmed videos to be concatenated.-c copy: Instructs FFmpeg to copy the input streams without any re-encoding.-map 0:v: Maps all video streams in the input file list to the output.-map 0:a: Maps all audio streams in the input file list to the output.-map 0:3: Maps the GPMD tag in the input file list to the output.-metadata:s:g GPS=$GPS: Sets the GPMD tag metadata."ab.mp4": Specifies the output filename.
The list_videos.txt file must include the file paths relative to the current working directory, with each entry on a new line. For example:
file '/path/to/clip1.mp4'
file '/path/to/clip2.mp4'
Preserving Timestamps
Using the -fflags +genpts flag will allow FFmpeg to generate timestamps for the concatenated output file.
- Error
"Tag GPMD incompatible output codec id 0"occurs when concatenating trimmed GoPro videos using FFmpeg due to GPMD tag incompatibility. - This can be resolved by using the appropriate FFmpeg command with the correct output codec and GPMD tag metadata.