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
msmpeg4, .asf only
wmv1, .asf only
wmv2 .asf only
mpeg4, Only if you have some MPEG-4 codec like ffdshow or Xvid
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
The following list of audio codecs should work on most Windows
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
-acodec options for video and audio respectively.
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