I created an FFMpeg script to rotate
-90 some videos that I record on my Sony A7iii, with the camera vertically, this makes these videos display correctly.
the script is this:
ffmpeg -i input.mp4 -c:v copy -metadata:s:v:0 rotate=-90 output.mp4
The issue is that for some reason all the output files are having variations of
2 frames, which causes me problems when I use these files as Proxy videos in Premiere Pro.
For example, if the original file has a
Media Duration (in Premiere Pro) of
00:00:32:12, the output file for some reason will have a
Media Duration of
The files were written in
XAVC 4K with
How can I fix this problem?
I've already tried adding
-r 23.976 to the code to force the frame rate, but that didn't help either.
The crucial point here is to rotate the video without re-encoding the file, for this reason, I took the approach of changing only the metadata, keeping the video stream untouched, re-encoding will cause a significant time penalty in my workflow.
I did a test by completely copying the audio and video streams from my original file, the command line looked like this:
ffmpeg -i C2526.MP4 -c:v copy -c:a copy -metadata:s:v:0 rotate=-90 C2526-test.mov
I know that the
.mov output would not return a valid file, since no conversion is being done, but it is necessary because
ffmpeg does not accept copying the
PCM stream from the camera file to the
.mp4 container, so after generating it I rename it the extension to
.mp4 for the file to be valid.
See that this command doesn't change anything other than the video rotation metadata, everything stays exactly the same, and even so the
Media Duration has a variation of 2 frames...