18

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?

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
Balaji Kandasamy
  • 4,446
  • 10
  • 40
  • 58

3 Answers3

50

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.

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
  • 1
    Your solution will work but the answer is wrong. `.m4v` is simply an Apple [variant](https://en.wikipedia.org/wiki/M4V) of MP4 extended to support DRM and other Apple-specific data streams like `mebx`. Often, just changing the extension to MP4 will do it. – Gyan May 09 '16 at 17:03
  • 2
    often, but just as often not. Like when you're using Adobe Creative Suite programs, which generates m4v if you need 60fps video footage encoded to h.264 (updated to make that explicit) – Mike 'Pomax' Kamermans May 09 '16 at 17:24
  • That's an Adobe quirk and has nothing to do with the provenance or structure of M4V. – Gyan May 09 '16 at 17:32
  • yes, that's what I've edited to say now. But remember that a quirk in a programs used by hundreds of thousands of people work effectively makes this a standard. Not *spec compliant*, but still a standard. – Mike 'Pomax' Kamermans May 09 '16 at 17:43
  • Predecessors have an interesting discussion: I tested the example and it worked. If the answer had a little more discussion or referenced a discussion regarding containers / codecs / metadata, that would help the novice community. – gatorback Aug 14 '16 at 14:35
  • not sure why - this is a not a video encoding community board. If you want in-depth information on video encoding with ffmpeg, just search the web for detailed discussions, it's easily found. What is *not* easily found is this specific answer when having this specific problem, so that's the only thing in this answer. Now searchers of the web can easily find it. – Mike 'Pomax' Kamermans Aug 14 '16 at 16:58
  • 3
    You can shorten the command a little by using `-c copy` (or `-codec copy`) instead of `-vcodec copy -acodec copy`. – llogan Aug 26 '17 at 19:21
3

Unsupported codec

The audio stream of your file seems to be encoded in a format that ffmpeg doesn't understand.

Adding new codecs to ffmpeg is possible, but doesn't seem to be easy: See Adding new CODEC to ffmpeg

Community
  • 1
  • 1
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
-1

The following worked for me when all the other answers weren't converting the audio in my video:

ffmpeg -y -i in.wmv out.mp4

SOURCE: FFmpeg command list for video conversion

Jack Hamilton
  • 59
  • 1
  • 2
  • There is no reason for `-y` here, all that does is overwrite without asking if the output already exists, so all your command does is "run ffmpeg with default mp4 settings". Great that it worked for you, but that's not an answer when the original post shows us that this commend on its own does not work, citing codec errors. – Mike 'Pomax' Kamermans Mar 28 '20 at 16:14