Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Question

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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