Building ffmpeg to support Windows Media files

Update: 8/11/06
Multimedia Mike msged me to say:

“I just wanted to point out that it may be helpful to amend that post to note that the current SVN copy of FFmpeg contains a native VC-1 decoder; no more painful hack to get the slooooow reference decoder working”

So hop on over to his site for more information 🙂

This post is for uber geeks, so move on if that’s not you 🙂

While using Gallery 2.1 for my photo gallery I finally got around to start uploading movie files as well as pictures. Being lazy, and wanting a small, compatible file type that most of my family could play, I opted to use Windows Movie Maker to output .wmv files. They come out pretty small, with great quality, and anyone on Windows (and some Mac/Linux users) can play them.

Well, lo and behold, the Gallery uses the ffmpeg module for generating thumbnails of the video files, and the current ffmpeg builds/CVS can’t handle later versions of Windows Media encoded (wmv3/wmv8/wmv9) video. Luckily, I was able to find a hack for it that got me going, and I’m re-posting it here for posterity (and when I lose my binaries and need to build them again).

(Caveat: my web host allows compilation from source; yours may not, and you may be out of luck if so. Unfortunately the binary I built is for x86_64 and probably not useful to many so I am not going to post it here.)

Hooking Up The SMPTE VC-1 Decoder In FFmpeg

Filed under:
Open Source Multimedia — Multimedia Mike @ 5:22 pm

Some people have asked me for my code to make the SMPTE VC-1 reference decoder work with FFmpeg,
slow though it may be. I suppose I could make a patch. But the official
version of FFmpeg is whatever happens to be in CVS at the current
moment. So any patch I could produce would work for maybe a day. So get
ready to do a little editing on your local FFmpeg CVS tree. The steps:

  1. procure the file from the main site and unzip the tree somewhere
  2. have a copy of FFmpeg’s CVS tree handy; the rest of these instructions will assume that you are sitting in the root of the FFmpeg tree
  3. create a directory called libavcodec/libvc1
  4. copy all of the *.c and *.h files from VC1_reference_decoder_release6/decoder/ into libavcodec/libvc1/
  5. copy all of the *.c and *.h files from VC1_reference_decoder_release6/shared/ into libavcodec/libvc1/
  6. place the libvc1-makefile.txt into libavcodec/libvc1/Makefile
  7. change directory into libavcodec/libvc1 and type ‘make’
  8. change directory back to the FFmpeg root
  9. place the smpte-vc1.c file into libavcodec/
  10. edit
    libavcodec/vc9.c, go the very end of the file, and add #if 0/#endif
    around the wmv3_decoder AVCodec structure; this will keep it from
    conflicting with the new SMPTE WMV3 decoder
  11. edit libavcodec/Makefile and add smpte-vc1.o to the end of the OBJS list
  12. edit the top-level Makefile and add “-L./libavcodec/libvc1 -lvc1″ (without the quotes) to FFLIBS
  13. run ‘./configure’ at the top level if you have not already done so for this tree
  14. run ‘make’ at the top level

Now, there’s also a magic step 12.5 that I had to do, which was edit the libavcodec/allcodecs.c and uncomment the section about wmv3. If you don’t, the wmv3 support won’t get compiled and this will all be for naught!

Big thanks to merbanan on #ffmpeg ( for assistance with getting this going!

I’ve also linked the reference decoder zip file locally if you can’t find it anymore…

Technorati Tags: , ,

Leave a Reply