How to convert video to `m4v` with `ffmpeg`?

Silver Light picture Silver Light · Dec 9, 2011 · Viewed 23.8k times · Source

I'm trying to encode a video to m4v, so I can play it using jplayer on my website, but having troubles while specifieng correct parameter to ffmpeg. Here is the command I use:

ffmpeg -i 1.avi -vcodec mpeg4 -f m4v -qmax 8 1.m4v 2>&1

The video I get with this command won't play in jplayer and even in Totem Movie Player (on ubuntu). But if I try the demo video from jplayer website evrything works fine.

Can anyone give me a hint on what parameters I need to specify to ffmpeg to get a working m4v video, like the one with a bunny?

Answer

Mike 'Pomax' Kamermans picture Mike 'Pomax' Kamermans · May 9, 2016

For those who find this question today still, because they're trying to play m4v, their software player won't let them and they need it converted to a "real" format and Google sent them to this question: m4v is not just "mp4 with DRM", but can also be a pure video stream without any playback metadata. This may be the case when you use certain digital cameras, you render video through Adobe's media encoder with certain h.264 presets, and other similar video-generating processes.

In those cases, it may very well be that all you need to do is get ffmpeg to add playback metadata on tope, which it will do by telling it to convert to mp4, turning your pure stream into a playable media resource.

$> ffmpeg -i input.m4v -vcodec copy -acodec copy output.mp4

Or you can use the short (but I find harder to remember) form:

$> ffmpeg -i input.m4v -c:v copy -c:a copy output.mp4

Done, you should now have a perfectly playable mp4 file.