8

The command below executed without error.

ffmpeg -i thevideo.mkv outvideo.avi

Subsequent attempts to play outvideo.avi in Windows Media player threw this error

You may need an additional video decoder to play this file.

This file contains a track in an unknown format (code "ARGB") format. You may need to     
install a DirectShow decoder for this video format in order to play this file.

Error detail provided by Windows Media player indicates the mpg2 codec is required to play the video. How do I tell ffmpeg to transcode to a video codec supported by Windows Media player?

3

2 Answers 2

6

You can't, since ffmpeg on its own does not know which codecs are installed on your system and accessible for Windows Media Player. This is because ffmpeg uses its own libavcodec and libavformat libraries to encode and decode. So a video generated by ffmpeg must not necessarily play in Windows Media Player..


Solution 1: Install additional codecs

You may need to install a DirectShow decoder for this video format in order to play this file.

This is what you eventually have to do since Windows does not ship with every possible codec. In fact, Windows versions up until 7 ship with almost no additional codecs at all, requiring the user to install a codec pack like K-Lite or CCCP. However, you can't assume that every PC has those installed, and you might want to ship your videos with a media player like VLC, which provides its own codecs and does not depend on Windows

Installing additional multimedia codecs is something you should probably do on every fresh Windows machine though.


Solution 2: Convert to a codec WMP plays

According to the Information about the Multimedia file types that Windows Media Player supports, there are some formats natively supported, but they aren't too specific about that. If you want to be on the safe side, you should probably convert into Windows Media Video (wmv). For everything else, well, here's what Microsoft says:

Audio content or video content that is compressed with a wide variety of codecs can be stored in an .avi file and played in Windows Media Player, if the appropriate codecs are installed on the computer. Video codecs that are frequently used in .avi files include the following codecs [...]

ffmpeg's FAQ is a bit more specific. They say:

Which codecs are supported by Windows?

The following list of video codecs should work on most Windows systems:

  • msmpeg4v2, .avi/.asf
  • msmpeg4, .asf only
  • wmv1, .asf only
  • wmv2 .asf only
  • mpeg4, Only if you have some MPEG-4 codec like ffdshow or Xvid installed.
  • mpeg1video, .mpg only

Note, ASF files often have .wmv or .wma extensions in Windows. It should also be mentioned that Microsoft claims a patent on the ASF format, and may sue or threaten users who create ASF files with non-Microsoft software. It is strongly advised to avoid ASF where possible.

The following list of audio codecs should work on most Windows systems:

  • adpcm_ima_wav
  • adpcm_ms
  • pcm_s16le, always
  • libmp3lame, If some MP3 codec like LAME is installed.

So when you convert, you can specify the codec you want to use by using the -vcodec and -acodec options for video and audio respectively.

For example:

ffmpeg -i input.mp4 -vcodec msmpeg4v2 -acodec pcm_s16le output.avi

Note that this is using uncompressed audio, since you can't be sure about which audio codec will be supported by Windows. If you're lucky, you can try MP3 (and it should work with most new machines), and use the libmp3lame option.

5
  • Thank you (+: I'll download the k-lites and check. Incidentally, I installed DivX player and it failed with the same error
    – Everyone
    Jul 25, 2011 at 12:34
  • DivX will also not play the file if it's not in one of its supported formats. If it doesn't work, you might want to consider using the -vcodec msmpeg4v2 option when converting to AVI.
    – slhck
    Jul 25, 2011 at 12:36
  • congrats on 10k @slhck
    – Sathyajith Bhat
    Jul 25, 2011 at 17:23
  • 1
    "You can't, since ffmpeg on its own does not know which codecs are installed on your system and accessible for Windows Media Player..." Well you can convert it to a file that plays in WMP! You just convert to the case of WMP having the min codecs. You've just chosen to not want to do that.
    – barlop
    Jul 26, 2011 at 6:17
  • @barlop Well that's why I had: > Solution 2: Convert to a codec WMP plays, right? :)
    – slhck
    Jul 26, 2011 at 8:30
2

Try this

C:\>ffmpeg -i yourvideofile.xyz -acodec mp2 -vcodec mpeg1video h.mpg

then play the output file, h.mpg in WMP, hopefully will work!

That's converting it to an MPEG container format, with audio codec of MP2, and video codec of MPEG1.

That combination should be supported by WMP.

No reason to mix up those 3 things. And you can download mediainfo to find out that kind of info from any video file. The CLI version of mediainfo is very clear
http://mediainfo.sourceforge.net/en/Download/Windows

4
  • Remember that MPEG1 is a very bad choice to convert a video to (unless absolutely necessary). MPEG-1 has been developed in 1988 and was released in 1993.
    – slhck
    Jul 25, 2011 at 19:41
  • @slhck Well it should work in WMP naturally so gets great marks for compatibility. If the file was too big then maybe mp4 or something else anyway if you install the codec. But for compatibility just to get it playing, that should be good. From there one might want to try other options for conversion to reduce file size or one may even skip that stage and try other options. But that at least gets it playing hopefully.
    – barlop
    Jul 26, 2011 at 6:15
  • Yes, from a compatibility standpoint that works of course!
    – slhck
    Jul 26, 2011 at 8:31
  • Out of curiosity I executed the command with the options you provided on both my p4 1.7 box, and the newer i5-760 box. Understandably the latter executed quicker (fps 7 on p4 as against fps 29 on i5). Despite the 4 cores, just 1 core showed oodles of activity in task-manager performance. The rest were near idle after the initial flurry. This surprised me, so I thought I'd post the finding on here too (+:
    – Everyone
    Jul 26, 2011 at 17:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .