1

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?

Sandra
  • 2,733

1 Answers1

4

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:

llogan
  • 63,280