FFMPEG An Intermediate Guide/WMV
< FFMPEG An Intermediate GuideWindows Media Video and Windows Media Audio are the official modern windows video and audio file types. designed to replace the earlier implementation of AVI. Where AVI encouraged development of new and original codecs but of had conflicts on different systems, WMV standardised video and audio compression using a combination of some of the best codecs on the market. Consideration in creating this format include encode speed, decoding speed and quality of play back.
WMV Background
There are three generation of WMV encoding, WMV1 (Windows Media Play 7), WMV2 (Windows Media Play 8), WMV3 (Windows Media Play 9). WMV2 is quite an improvement over WMV1, though objectivity you only like to find improvements in the range of 10% to 15% in size and slight quality improvement. Unfortunately there is no complete WMV3 encoding (last commit happen 3 May 2007 [1]). Note! this does not affect decoding WMV3 or encoding to WMV2's.
VC1 was implement with out full standards compliance in Windows Media Player 11. FFMPEG can decode it but not encode to it. [2]
The following video codecs should work on most Windows Systems[2]:
- 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.
mpeg1
- .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. [3]
WMA Background
Windows Media Audio, is available in a number of different flavours, Windows Media Audio, Windows Media Audio Professional, Windows Media Audio Lossless, Windows Media and Audio Voice. That said, FFMPEG supports the following formats, wmapro (Windows Media Audio 9 Professional), wmav1 (Windows Media Audio 1) and wmav2 (Windows Media Audio 2). Though it does not at this point encode to pro, only decoding.
The following audio codecs should work on most Windows Systems:
- wmav1
- Windows Media Play 7 and up
- wmav2
- Windows Media Play 8 and up
- adpcm_ima_wav
- adpcm_ms
- pcm
- always
- mp3 (failed on play back test on windows media player)
- If some MP3 codec like LAME is installed.
Using In FFMPEG
A basic call would be:
ffmpeg -i "input_video.mpg" -b 1500k -vcodec wmv2 -acodec wmav2 "output.wmv"
This creates a slightly pixelated image at full SD but easily viewable. This creates a Windows Media Player 8 video and audio file streams, unfortunately FFMPEG does not at this time encode Windows Media Player 9 files.
Note! Test show that a call with out defining Windows Audio, does not play back on all system, especially in Windows Media Player.
If you get an error reading "Error while opening encoder for output stream #0.1" scroll up to find a specific error (sometimes highlighted in yellow).
If the error reads, "Too many channels", your input video has more audio channels than WMV can handle. Adding "-ac 2" will resolve this.
Problems
Although many sites and the default settings in FFMPEG, select MP3 as the default audio to embed in a WMV I find that this is not compatible with a large number of modern systems. For compatibility you should embed a Windows Media Audio file as you audio type. this needs to be specified as this is not a default action.