FFmpeg command to rotate an MP4 file by 90º

6

4

Can I rotate (save, reencode) a .mp4 file with ffmpeg?

The only thing I found was on the mailinglist saying -vfilters "rotate=90" but ffmpeg says that "there are no vfilters". I tried -vf, it says there is "no rotate".

If I try to do it in VLC, it simply does not rotate and kills the audio. I'm on a Mac.

FFmpeg version git-svn-r23607, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jun 14 2010 23:52:55 with gcc 4.2.1 (Apple Inc. build 5659)
  configuration: 
  libavutil     50.19. 0 / 50.19. 0
  libavcodec    52.76. 0 / 52.76. 0
  libavformat   52.68. 0 / 52.68. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.20. 0 /  1.20. 0
  libswscale     0.11. 0 /  0.11. 0
Hyper fast Audio and Video encoder

shox

Posted 2010-07-11T08:45:54.197

Reputation: 225

In case you really only want to change the metadata without re-encoding, see this answer or this : -metadata:s:v rotate="90" -codec copy or maybe ... rotate=0 ... to reset the rotation metadata.

– mivk – 2016-11-15T19:36:25.397

Answers

5

Maybe it should be configured with --enable-vfilters before compilation? BTW, mencoder does the job well, but you'll have to reencode the video:

mencoder -oac copy -ovc lavc -vf rotate=1 original.mp4 -o 90_CW_rotated.mp4 mencoder -oac copy -ovc lavc -vf rotate=2 original.mp4 -o 90_CCW_rotated.mp4

igorp1024

Posted 2010-07-11T08:45:54.197

Reputation: 431

I had vfilters enabled. they just purged the algorithm from the packege, who knows why -_-

I fixed it already, thanks. – shox – 2010-08-07T18:15:46.127

5

With the current version pulled from SVN, you can rotate video using -vf "transpose=1".
Here's an example:

ffmpeg -vf "transpose=1" -i input.mp4 output.mp4

docs + options for transpose command are here

(here's how I built ffmpeg in case this helps)

svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-shared  --disable-mmx --arch=x86_64
make
sudo make install

Ben Clayton

Posted 2010-07-11T08:45:54.197

Reputation: 159

4I had to put the filter after the input for it to work: ffmpeg -i input.mp4 -vf "transpose=1" output.mp4 – Harvey – 2015-03-26T13:51:05.913

5Is there a reason you're disabling MMX? I don't see a point in that. – jeffcook2150 – 2011-01-27T07:26:27.900