FFMPEG An Intermediate Guide/WMV

From Wikibooks, open books for an open world
< FFMPEG An Intermediate Guide
Jump to: navigation, search

The Windows Media Video and Windows Media Audio codecs are staples of the Advanced Systems Format, in which Microsoft sought to find leading codecs on the market at the time of introduction. While both codecs have been outclassed over time, WMV is still an accepted format by YouTube to upload files, and projects like FFmpeg are able to encode to earlier versions of it. The format and its background contrasted with Microsoft's previous format AVI, in which Microsoft aimed to push for development of new and original codecs. At the time, this move resulted in conflicts on different systems, so with the development of ASF, Microsoft instead adopted the leading video and audio codecs at the time. The factors for including these codecs were determined by a) how fast it could be encoded to, b) how performant systems were during decoding, and c) resulting quality.

It should be noted that any material encoded into ASF using software not authorized by Microsoft violates their patent rights.[1] Where organizations like Xiph are permissive of their formats being used, Microsoft went the way of Fraunhofer in 2000 when they asked a developer who had reverse engineered the format to stop. The developed software in question was VirtualDub, and the author had complied shortly after.

So, if you must encode to ASF using FFmpeg, do not publish your resulting material. Use other codecs if you possibly can.

Using WMV with FFmpeg[edit]

With WMV input[edit]

You can stream copy codecs that can't be encoded to by FFmpeg by doing this command:

ffmpeg -i input -vcodec copy -acodec copy output

This will copy both the video (vcodec) and audio (acodec).

With other input[edit]

With supported encoders, you can do:

ffmpeg -i input -b 1500k -vcodec wmv2 -acodec wmav2 output

Notice the -b flag. At most 480p video, the output is slightly pixelated but still easily viewable. This creates Windows Media Video 8 video and audio file streams, because the encoder for Windows Media Video 9 is not completely working.[2]

Make sure you include the -acodec flag or the default will not be wmav2 and will not be included in the output video. If the input audio has more than two channels (like surround sound), the encoder cannot handle more and will throw a "Too many channels" error. Manually set the number of channels to 2 with the -ac flag.

References[edit]

  1. FAQ, Which codecs are supported by Windows? FFmpeg. "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." Accessed September 30, 2017.
  2. General documentation, Supported File Formats, Codecs or Features. FFmpeg. See entry "Windows Media Video 9". "not completely working". Accessed September 30, 2017.