Take the 2-minute tour ×

I tried using the -sameq, and it works and got a good quality for the video, but I noticed the file size had increased greater than the original video.

So how can I adjust for the medium quality? I mean much better than the normal ffmpeg -i input output for the mid quality.

share|improve this question

migrated from stackoverflow.com Dec 22 '11 at 9:57

This question came from our site for professional and enthusiast programmers.

1 Answer 1

More information is needed to answer your question adequately. I don't have enough "reputation" to leave a simple comment for clarification.

  1. -sameq is the most misused FFmpeg option. The old documentation used to imply that -sameq meant, "make the output the same quality as the input". This is not the case.

  2. You did not specify which output format you want. Options to control quality can vary depending on your encoder.

When encoding to MPEG-1/2/4 use -qscale instead of -sameq. This option controls your quality level. The scale is linear, with double the qscale being about half the bitrate. 3-5 are good values to try. Use the highest value that looks good to you. A value of 2 can generally be considered visually lossless.

For H.264 use CRF. Example:

ffmpeg -i input -c:v libx264 -preset fast -crf 24 output.mp4

Adjust the CRF value to change output quality. 18-28 is a sane range (for 8-bit encoding). Use the highest value that still gives you an acceptable quality. Use the slowest preset you have patience for. Presets are listed in x264 --help. A preset is a group of x264 settings that give a speed vs compression tradeoff.

share|improve this answer

Your Answer

