FFmpeg 7.1 Won't Copy GoPro Metadata Streams Back to MP4: Here's How to Keep GPS Data
If you're a fan of GoPro cameras, you know that they produce high-quality MP4 video files with embedded metadata streams, including GPS data. This data can be very useful for geotagging your videos and adding context to your shots. However, when you use FFmpeg 7.1 to compress these MP4 files, you may find that the metadata streams are not being copied back to the output file, particularly the GPS data.
The Problem with FFmpeg 7.1 and GoPro Metadata Streams
FFmpeg is a powerful and popular open-source multimedia framework that can be used for a variety of tasks, including video compression and conversion. However, as of version 7.1, it has a bug that prevents it from correctly copying metadata streams from GoPro MP4 files.
This means that if you use FFmpeg 7.1 to compress a GoPro MP4 file, you will lose the GPS data and other metadata streams in the process. This can be frustrating, especially if you rely on this data to organize and analyze your videos.
The Solution: Use MOV Output Instead
Fortunately, there is a workaround for this problem. Instead of using MP4 as the output format, you can use MOV. This format is fully supported by FFmpeg, and it will preserve the metadata streams from the GoPro MP4 file, including the GPS data.
How to Compress GoPro MP4 Files with FFmpeg and Keep GPS Data
Here are the steps you can follow to compress your GoPro MP4 files with FFmpeg and keep the GPS data:
- First, make a backup copy of your GoPro MP4 file, just in case something goes wrong.
- Next, open a terminal window (on MacOS) or command prompt (on Windows) and navigate to the folder containing the GoPro MP4 file.
- Now, run the following FFmpeg command, replacing
input.MP4with the name of your GoPro MP4 file, andoutput.MOVwith the name you want to give to the output file:ffmpeg -i input.MP4 -codec:v libx264 -crf 23 -map 0 output.MOVThis command will compress the video using the H.264 codec with a quality setting of 23 (
-crf 23), and it will map all streams from the input file to the output file (-map 0). Because the output format is MOV, the metadata streams will be preserved, including the GPS data. - Once the compression is complete, you can rename the output file to have a .mp4 extension instead of .mov if you prefer. This will not affect the metadata streams or the video quality.
That's it! With these simple steps, you can compress your GoPro MP4 files with FFmpeg and keep the GPS data and other metadata streams intact.
Problem: FFmpeg 7.1 won't copy GoPro metadata streams back to MP4 output, particularly GPS data.
Workaround: Use MOV output instead of MP4.
Solution: Use the following FFmpeg command to compress GoPro MP4 files with MOV output and keep GPS data:
ffmpeg -i input.MP4 -codec:v libx264 -crf 23 -map 0 output.MOVReferences: