Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to crop and rotate a video, and then encode it to mp4 or mkv.

mencoder video.mp4 -vf rotate=1,crop=720:1280:0:0 -oac pcm -ovc x264 -x264encopts preset=veryslow:tune=film:crf=15:frameref=15:fast_pskip=0:threads=auto -lavfopts format=matroska -o test.mkv

But when I do the above encoding, the frame rate is way too fast. The encoding options were something I found, so I don't know if that is the problem.


All I want is to crop and rotate the video, and keep the audio/video quality as good as possible.

Have anyone tried this?

share|improve this question
up vote 3 down vote accepted

input example rotated and cropped version
Original and transposed & cropped version

Using ffmpeg

You can do this in ffmpeg. By default the input frame rate is used for the output frame rate.

Example to rotate 90° clockwise with transpose filter and crop (centered) to size 720x1280:

ffmpeg -i input -vf "transpose=1,crop=720:1280" -c:v libx264 -c:a copy out.mkv

Usage of video filters requires that you re-encode the video, but audio will simply be stream copied instead of re-encoded.

Rotate upon playback

Another option is to rotate and crop during playback. This way you do not need to re-encode and potentially reduce quality. Any player worth using should let you do this. Example using ffplay:

ffplay -vf "transpose=1,crop=720:1280" -i input

Also see:

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .