2

I have a video, shot on my android phone, which I want to rotate 90 degrees clockwise for computer viewing. Here's what I expect should work:

ffmpeg -i infile.mp4 -vf "transpose=1" -an -vcodec mpeg4 outfile.mp4

except that it gives me:

Error while opening encoder for output stream #0.0 - maybe incorrect 
parameters such as bit_rate, rate, width or height

The command ffmpeg -codec does produce a long list which includes DEVSDT mpeg4 MPEG-4 part 2

Then I experimented with

ffmpeg -vf "transpose=1″ -qscale=2 -i infile.mp4 outfile.mp4

but this seems to be an unfinished command, as all I get is a ">" symbol in my terminal.

I've also tried:

mencoder -fps 30000/1001 -ofps 30000/1001 -ovc lavc -vf rotate=1 -oac pcm
infile.mp4 -o outfile.mp4

which does work, but gives a very poor output - far worse than the input.

I can certainly view the video in the correct orientation:

mplayer -vo xv -vf rotate=1 infile.mp4

but I have as yet not found a way to write the rotated video to a file. I have no experience at all with video coding, so any advice would be most welcome!

  • FWIW your first ffmpeg command is correct and should work (your second ffmpeg command is incorrect; -vf is an output option, so it shouldn't come before the input), so the problem might be with your video file. Does it play properly? – evilsoup Jun 26 '13 at 8:19
  • I have the same problem trying to convert or even just process an Android video made by CyanogenMod 10.1 on a SGS2 with Ubuntu-issue ffmpeg or avconv. I think that's where the problem lies. – Oli Jun 26 '13 at 8:29
  • I tried the first ffmpeg command on a few mp4 and mpg files I have here. It worked fine on both Ubuntu 12.04 and 12.10. So as @evilsoup says it might be an issue with the specific video file you have. – Richm Jun 26 '13 at 8:57
  • 1
    Well, the video file plays fine, as I mentioned in the original post. It plays even better with mplayer -cache 8192 -ao sdl -vo gl -vf rotate=1 infile.mp4. I noticed when I played it earlier that it's quite big (512Mb, although only 4'30" long), and unless I'm careful with the sound and video codecs I get a Your system is too SLOW to play this! message, and the sound and video don't sync. So maybe there is a problem with the file? However, I can play it... – Alasdair Jun 26 '13 at 11:00
  • The complete ffmpeg console output for the first command will be useful if you're still interested in figuring out the issue...otherwise I can only guess. But my guess is you probably just need to remove the = signs. – llogan Jul 10 '13 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.