8

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.

  • Can you provide a link to one of the individual files listed in `0036_concat.txt`? – llogan May 10 '20 at 16:43
  • @llogan -- File contents are just `file 'name.mp4'\nfile 'name2.mp4'`, etc –  May 11 '20 at 14:16
  • @llogan -- my bad, misread that. Here's a 1 sec clip: https://www.dropbox.com/s/qntwf6m85sxvar9/GS020101.mp4?dl=0 –  May 15 '20 at 18:11
  • See if this helps? https://stackoverflow.com/questions/11706049/converting-video-formats-and-copying-tags-with-ffmpeg/50580239#50580239 – Tarun Lalwani May 25 '20 at 09:10
  • @TarunLalwani -- Unfortunately not. I've seen that answer before and don't understand why it doesn't work, I'm guessing this isn't actually "metadata" according to ffmpeg. There's almost zero documentation on side data –  May 26 '20 at 05:24

2 Answers2

5

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

enter image description here

Run ffprobe GS020101.mp4, we can see that Side data: spherical: equirectangular (0.000000/0.000000/0.000000) is there

enter image description here

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

enter image description here

Run python spatialmedia -i output.mp4 equirectangular.mp4

enter image description here

Run ffprobe equirectangulat.mp4, this time you can see successfully the expected side data.

enter image description here

Carlos Robles
  • 10,828
  • 3
  • 41
  • 60
  • 1
    Unfortunately this doesn't actually answer the question. I'm aware of the spatial media injector, but I not everything I have is equirecangular so it doesn't work –  Jun 02 '20 at 18:17
  • This is the only answer I have found so far that allowed me to get a badly stitched 360 video uploaded to YouTube. Thanks! Just need to work on my stitching problem! – Trook2007 Mar 27 '21 at 04:23
4

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
Mikael Finstad
  • 684
  • 6
  • 12