'How do I preserve side data when concatenating files in ffmpeg?
I have multiple 360 videos that I'm trying to concatenate in ffmpeg. The command it self is pretty straightforward:
ffmpeg -f concat -i 0036_concat.txt -c copy -strict unofficial 36.mp4
where 0036_concat.txt is just a list of the individual files. The issue I'm having is that I can't get ffmpeg to preserve side data. Very simply put, ffprobe on any of the source files includes this:
Side data:
spherical: equirectangular (0.000000/0.000000/0.000000)
And I can't, for the life of me, get that to propagate to the output file.
this question has a solution that works for single files, but it doesn't work when concatenating multiple files.
I'd be perfectly fine injecting that entire string if anyone knows how.
Solution 1:[1]
Apparently ffmpeg doesn't support that. Many people suggest developing your own extension for FFmpeg, but i found it overkill.
Instead, I have successfully done it using google spatialmedia to add the side data to the output video resulting from the FFmpeg concat. It is as simple as
python spatialmedia -i 36.mp4 equirectangular.mp4
You can get spatialmedia from its official repo. Download the latest release, unzip it, and you will be able to run the above command directly.
In case you don't have it, you need to install python first.
That is all you need.
Bellow I add an example in my local with your own video.
I downloaded your sample file, and created the below file list
Run ffprobe GS020101.mp4, we can see that Side data: spherical: equirectangular (0.000000/0.000000/0.000000) is there
Run ffmpeg -f concat -i 0036_concat.txt -c copy -strict unofficial output.mp4
Run ffprobe output.mp4, as you expected, side data is not there
Run python spatialmedia -i output.mp4 equirectangular.mp4
Run ffprobe equirectangulat.mp4, this time you can see successfully the expected side data.
Solution 2:[2]
Although it seems like ffmpeg doesn't support this, I found that ExifTool seems to do the job. Run this command after your ffmpeg concat:
exiftool -tagsFromFile first_file_inside_concat_file.mp4 -all:all 36.mp4
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Mikael Finstad |





