I have a 360° Video and want to shift it sideways using ffmpeg so that the default viewpoint when opening the video in a player is shifted. I found this question (How to offset a video horizontally in ffmpeg?) that helped me getting the shifting done, but when I use this approach to shift the video the side-data of the video (containing the information that it is in equirectangular format) is gone.
This is the relevant part from using ffprobe on my input file:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:05.01, start: 0.000000, bitrate: 57592 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc), 3840x1920 [SAR 1:1 DAR 2:1], 57515 kb/s, 29.95 fps, 29.95 tbr, 29948 tbn, 59.90 tbc (default)
Metadata:
handler_name : VideoHandler
Side data:
spherical: equirectangular (0.000000/0.000000/0.000000)
Then I use the overlay filter as described in the link above like this:
ffmpeg -i test.mp4 -filter_complex "[0:v][0:v]overlay=960:0[bg]; [bg][0:v]overlay=960-W,format=yuvj420p[out]" -map "[out]" -map 0:a -c:v libx264 -crf 0 -c:a copy test_shifted.mp4
An the resulting file does not have the equirectangular side data in it:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_shifted.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:05.01, start: 0.000000, bitrate: 245636 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuvj420p(pc), 3840x1920 [SAR 1:1 DAR 2:1], 245758 kb/s, 29.95 fps, 29.95 tbr, 14974 tbn, 59.90 tbc (default)
Metadata:
handler_name : VideoHandler
I looked into this question (https://stackoverflow.com/questions/44760588/preserving-side-data-information-for-360-video-transcoding-using-ffmpeg) and tried the approaches mentioned there (keepside flag, -strict unofficial) but the question itself deals with stream copying and none of it seems to work when using the filter on the video stream.
I am using ffmpeg version 3.4.4-0ubuntu0.18.04.1. If anyone can help me keep my metadata that would be much appreciated!