4

I created a video in my cellphone holding the phone in portrait mode. The video is 720p and it looks perfectly fine in cell phone. I copied it on computer and when viewing it, the video looks 90 degrees anti-clockwise rotated. It is confusing for me that why it happened. How can I rotate the copied video back to 90-degrees without re-enconding the video.

9
  • It has been answered to death already. Not possible, unless container supports it or you are using MJPEG codec, which you are not.
    – v010dya
    Commented May 4, 2015 at 16:48
  • 1
    @Volodya ok, deleted my answer, but might be better suggest a duplicate instead of downvoting it.
    – p2or
    Commented May 4, 2015 at 16:53
  • @poor I've clicked downvote on your answer by some weird accident. Tried to undo, but it didn't let me.
    – v010dya
    Commented May 4, 2015 at 16:56
  • 1
    Apparently my answer doesn't solve your issue. Please let us know, what else you need or edit your question.
    – p2or
    Commented May 20, 2015 at 9:19
  • 1
    @poor Yet another drive-by-question.
    – llogan
    Commented Sep 6, 2015 at 17:34

1 Answer 1

6

Rotate without re-encoding

You can add rotation metadata:

ffmpeg -i input.3gp -c copy -metadata:s:v rotate=90 output.3gp
  • -c copy will enable stream copy mode, so it will just re-mux instead of re-encode.

  • Player and device support for the rotate metadata may vary, so your player or device may not actually rotate the video. If that is the case you may have to manually rotate within the player, or re-encode.

Rotate with re-encoding

When re-encoding ffmpeg will automatically rotate the video. The rotate metadata/sidedata will not be copied from the input (which is a good thing).

ffmpeg -i input output

If it doesn't work for you then your build is too old. Refer to the FFmpeg Download page.

1
  • Any idea why rotating 90 deg does 180, and rotating 360 does 90? haha
    – JorgeeFG
    Commented Mar 13 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.