I'm looking for a way to rotate videos shot with my Nexus 4 on my Debian Wheezy sytem. The videos are shot in portrait mode and I would like to rotate them to landscape mode. Preferably the rotation is command-line driven.
I have found several previous questions which are hinting at a good solution but I can't seem to manage to get it working.
To begin with there was this question: Rotating videos with FFmpeg
But it indicates that ffmpeg is outdated and that I should use avconv. I found this question detailing the way to go forward. https://askubuntu.com/questions/269429/how-can-i-rotate-video-by-180-degrees-with-avconv
This made me using following command:
avconv -i original.mp4 -vf "transpose=1" -codec:v libx264 -preset slow -crf 25 -codec:a copy flipped.mp4
However, this is painstakingly slow (last test took me more than 6 hours for less than 3 minutes of footage) and does not result in a playable movie. I also get an error in logging output which states Mb Rate > level limit.
Is there an issue here with the re-encoding? Should I first re-encode the videos from my phone to another, more "workable" encoding before applying the rotations? Or am I missing another important point?
Press Ctrl + R keys to rotate the MP4 video 90 degrees clockwise or just click the rotate button from the lower-right side to rotate the video in Photos.
Pressing Ctrl + R will rotate the video 90 degrees clockwise. Alternatively, you can find and click the "Rotate" button in the application window.
If you just want to change the metadata such that mediaplayers that consider the flag play the file rotated, try something like:
ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4
as found elsewhere on stackoverflow.
Rotation=0 fixed my issue. I started recording video in portrait mode, realized my mistake and immediately turn my phone to landscape to continue recording. My iphone had marked the video as portrait for the entire video.
ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=0 output.mp4
Fixed it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With