Skip to content
Advertisement

How to convert m4v and wmv videos to mp4 format using ffmpeg?

I am using ffmpeg to convert videos to mp4 in my PHPMotion project. I am not able to convert wmv and m4v video to mp4 format. I’ve pasted the command that I used to convert wmv and m4v:

ffmpeg -i 1.wmv -ab 128 -b 1200 test.mp4
ffmpeg -i 1.m4v -ab 128 -b 1200 test.mp4

When I use this codes, i got an error message:

Output #0, mp4, to 'test.mp4':
    Stream #0.0: Video: mpeg4, yuv420p, 640x360, q=2-31, 1 kb/s, 90k tbn, 24 tbc
    Stream #0.1: Audio: 0x0000, 44100 Hz, stereo, s16, 0 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Unsupported codec for output stream #0.1

How can I solve this issue?

Advertisement

Answer

For those who still find this question today, because they’re trying to play m4v files that their hardware or software generated, but none of the players they try will play them: m4v is not just a playable media container, but is also used as a pure stream format by a number of commonly used tools and video capture devices, so that it can be used to burn the video directly to disc. This is especially likely when you’re using something like Adobe’s Creative Suite set of tools for video production.

To turn an “unplayable” m4v stream (that your capture device/software suggests should totally be playable) into the kind of video file you’re used to, tell ffmpeg to copy the stream into an mp4 container:

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

Or, using the combined a/v codec shorthand flag:

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

No actual encoding happens, so this will only take a few seconds, if not less. Done deal.

Advertisement