Converting mov to mp4 with ffmpeg better quality

Calamity Jane picture Calamity Jane · Apr 2, 2018 · Viewed 12k times · Source

I want to convert mov videos to mp4. Currentoy I manage this with ffmpeg via bash with the following call:

ffmpeg -i input.mov -f mp4 -vcodec mpeg2video -acodec mp3 output.mp4

Yes that works, but the quality is abysmal. My 50Mb is shrunken to a handy 2.3 Mb file. The I tried the variation where I just change the container:

ffmpeg -i input.mov -f mp4 -vcodec copy -acodec mp3 output.mp4

Yes that works, too, but the file is still huge since I don't compress the video. So my 50Mb stay 50Mb.

Is there a setting, where I can do a slight or gradual compression, without having a total lack of quality? an output file of maybe 10 - 20 Mb would be my target.

What I tried:

ffmpeg -i input.mov -f mp4 -vcodec -qscale:v 4 -acodec mp3 output.mp4

Gives me the error message:

WARNING: library configuration mismatch [...] Unknown encoder '-qscale:v'

Version used: ffmpeg version 2.8.11-0ubuntu0.16.04.1

Answer

llogan picture llogan · Apr 2, 2018

Remux only

If your input video and audio are compatible with MP4 you can use stream copy mode:

ffmpeg -i input.mov -c copy output.mp4

Re-encode

If you need to encode to other formats compatible with MP4:

ffmpeg -i input.mov -crf 23 -preset medium -movflags +faststart -c:a aac output.mp4
  • Use the highest -crf value that provides an acceptable quality.
  • Use the slowest -preset that you have patience for.
  • If the input is AAC audio you can change -c:a aac to -c:a copy.

See FFmpeg Wiki: H.264 and FFmpeg Wiki: H.265.