Resize in FFmpeg

1

I have a video which has a resolution of 1920x1080p. I want to re-encode this video (with libx264 for video and aac for audio); Downscale it first to 1280x720p (with the same aspect ratio) while using a different video bitrate (1900 kbps) and audio bitrate (96 kbps). Also I want to change from mkv to mp4. I don't want to change anything of the previous encoding settings (Just the bitrate, and the video size). I want to use variable bitrate (in video and audio), but I don't know how to put it in FFmpeg (I have the latest version 3.0- Windows 7). To get better quality, is it of any use to put a CRF value along with the variable bitrate (and if yes, how can I do that)? Also if I want to downscale it to 480p how can I do that and keep the aspect ratio intact?

One more thing; What is "maxrate", "minrate" and "bufsize" and where can I use these? I think I have seen that CRF uses VBR, but in one article the above were used (for VBR), so I can't tell exactly what to use to get a smaller file size by just decreasing the bitrate (and the video size, if possible).

Also I don't know if VBR mode is proper for the goal I want to achieve, but I have read it's the best mode.

Thank you for your time!

KLNy

Posted 2016-03-07T00:04:37.610

Reputation: 33

Why are you wanting to re-encode in the first place? – llogan – 2016-03-07T03:40:47.823

I want to get a smaller file size – KLNy – 2016-03-07T22:28:05.010

Answers

1

You have asked many questions here, but I think you're overthinking it.

Just use -crf and -preset. Use the highest -crf value that still provides an acceptable output and the slowest -preset you have patience for. See FFmpeg Wiki: H.264 Video Encoding Guide for more info.

As for scaling, just use the scale filter like this: -vf scale=1280:-2 or -vf scale=480:-2. The -2 will tell the filter to preserve aspect and slightly adjust the output if necessary to make it divisible by 2 which is required by x264 for output with YUV 4:2:0 chroma subsampling.

llogan

Posted 2016-03-07T00:04:37.610

Reputation: 31 929

Thank you very much. Are these the same; -preset:v slow and -preset slow? And for the audio? Which of these should I use; -vbr or -b:a? – KLNy – 2016-03-08T22:10:29.187

@KLNy -preset and -preset:v are basically the same. One just has a stream specifier to ensure that ffmpeg knows to apply the option to video and not audio, etc (although I don't think there are any audio encoders that use -preset); if in doubt use -preset:v. If you're using libfdk_aac audio encoder, use -vbr, otherwise use -b:a. See FFmpeg Wiki: AAC.

– llogan – 2016-03-09T01:35:00.047

I read also about -q:a for variable in aac; Can I use this (the values?)? – KLNy – 2016-03-09T13:40:16.207

@KLNy Yes. See FFmpeg Wiki: AAC for more info.

– llogan – 2016-03-09T18:39:11.843