7

I am trying to convert a .mov video to .mp4 with ffmpeg:

ffmpeg -i ~/Desktop/Sample.mov ~/Desktop/Sample.mp4

This doesn't work though, and when I try to open the produced video in quicktime it tells me that the file is either corrupted or in a format quicktime doesn't understand.

How do I get this to work?

  • Use handbrake for MAC – answerSeeker Dec 10 '16 at 19:10
20

To convert videos, I like to use handbrake. You can find it here: https://handbrake.fr/ I use it on Linux but it should work well on MAC too.

For HandBrake:

handbrakecli -i {in-video}.mov -e x264 -E facc -o {out-video}.mp4

For ffmpeg:

ffmpeg -i {in-video}.mov -vcodec h264 -acodec aac {out-video}.mp4
| improve this answer | |
  • Handbrake worked. The ffmpeg command doesn't. – theonlygusti Dec 12 '16 at 22:34
  • 3
    ffmpeg worked great as above for me – Andy Mar 24 '17 at 22:16
  • 1
    Works great! Thanks! What does the -strict 2 stand for? I couldn't find it in the commands list nor in the full documentation. When trying to run with and without it - couldn't find any difference. – arieljannai Nov 29 '17 at 19:22
  • @arieljannai, I just saw your comment. If you look at the documentations on the ffmpg website, linux.die.net/man/1/ffmpeg you will see that it says: -strict strictness How strictly to follow the standards. – answerSeeker May 4 '18 at 18:41
  • Maybe I found another documentation 😳 thanks! – arieljannai May 5 '18 at 11:05
0

Copy

You can stream copy if the MOV file contains video and audio that is compatible with MP4:

ffmpeg -i input.mov -c copy output.mp4
  • Stream copy (-c copy) is like a "copy and paste" so the quality is preserved and the process is fast.

  • Video formats compatible with MP4 include: H.264, H.265/HEVC, AV1 (new format, so not universally supported), MPEG-4 (old format, not supported in HTML5).

  • Audio formats compatible with MP4 include: AAC, MP3 (playback support depends on player), Opus (new format, so not universally supported).

Encode

This will convert the MOV to H.264 video and AAC audio:

ffmpeg -i input.mov -c:v libx264 -c:a aac -vf format=yuv420p -movflags +faststart output.mp4
  • -c:v libx264 choose encoder libx264 to output H.264 video.
  • -c:a aac choose encoder aac to output AAC audio.
  • -vf format=yuv420p chooses YUV 4:2:0 pixel format. libx264 supports many pixel formats and by default will choose a pixel format that most resembles the input. But not all pixel formats are supported by all players. yuv420p is the most compatible and universally supported.
  • -movflags +faststart same as the Web Optimized option in Handbrake. After encoding completes it moves a chunk of info from the end of file to the beginning so it can start playing faster when viewing via download.

See FFmpeg Wiki: H.264 and FFmpeg Wiki: AAC for more info.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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