How can I convert an m4a to mov?

I have a m4a audio file that I need to convert to a mov file. How can I do this?


This creates an x264-encoded mov file with image.png as the background:

ffmpeg -loop 1 -i image.png -i audio.m4a -c:a copy -c:v libx264 -crf 20 -pix_fmt yuv420p -shortest output.mov

You can use mp4 or mkv as the container by just changing the name of the output file.

-c:a copy disables re-encoding the audio.

-loop 1 loops the image infinitely so that it is not shown for just one frame. It also makes the video stream infinitely long, so -shortest is needed to finish encoding after the audio stream finishes. -shortest has to be after the input files in new versions of ffmpeg.

-crf (constant rate factor) can be from 0 (lossless) to 51 (lowest quality). If you remove -pix_fmt yuv420p, ffmpeg uses yuv444p, which is not supported by many video players.

You can use a black background by replacing -loop 1 -i image.png with -f lavfi -i color=c=black:s=1280x720. You can resize an image by adding an option like -filter:v '[in] scale=-1:720, pad=1280:720:640-iw/2 [out]'.

More information:

  • https://trac.ffmpeg.org/wiki/EncodeforYouTube
  • https://superuser.com/questions/98980
  • http://tdb0.wordpress.com/2012/03/10/how-to-upload-a-song-without-a-music-video-to-youtube/