8

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

3
  • This is a broad question. What output formats do you require, or does it not matter? Why is it important to reduce the file size in this case? WARNING: library configuration mismatch generally indicates a broken ffmpeg build. If you mention your OS I can tell you how to get one that is not broken.
    – llogan
    Commented Apr 2, 2018 at 19:59
  • The desired output is obviously mp4. Why reduce the filesize? E.g. loading times via the internet. I use kubuntu 16.04 64 version and the ffmpeg, which comes with the distribution: ffmpeg version 2.8.11-0ubuntu0.16.04.1 Commented Apr 2, 2018 at 20:16
  • 2
    It isn't as obvious as it seems because MP4 is a container format that can accept several formats including MPEG-4 Part 2 video, H.264, and H.265/HEVC. You were attempting a variety of formats so I wanted to know which would suffice. Since it now appears you want to put it online it narrows it down to H.264 or H.265/HEVC.
    – llogan
    Commented Apr 2, 2018 at 21:21

1 Answer 1

27

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.

2
  • This not working on web browsers. only play audio. Commented Aug 2, 2021 at 15:06
  • @MizanurRahmanKhan Need to see your command and the complete log to be able to help.
    – llogan
    Commented Aug 3, 2021 at 22:04

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