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.
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 asYou 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 thatSide data: spherical: equirectangular (0.000000/0.000000/0.000000)
is thereRun
ffmpeg -f concat -i 0036_concat.txt -c copy -strict unofficial output.mp4
Run
ffprobe output.mp4
, as you expected, side data is not thereRun
python spatialmedia -i output.mp4 equirectangular.mp4
Run
ffprobe equirectangulat.mp4
, this time you can see successfully the expected side data.