AVISynth's DirectShowSource() in Windows 7

Post date: Feb 16, 2012 3:43:51 AM

(Scroll down to the images for one workaround)

As you might see if you browse around, I'm a huge fan of the video scripting language AVISynth.

The problem is that it's no good having such a wonderful tool, if it doesn't work, and I've been having trouble getting it working in Win7. The reason, I believe, is that AVISynth taps into DirectShow, Windows' media framework, and starting with Vista, Microsoft have been replacing DirectShow with something called Microsoft Media Foundation (MF) (http://en.wikipedia.org/wiki/Media_Foundation). I'm sure that there are good reasons for it besides adding DRM features (which seems to be the main motivator), but it wreaks havoc on an already shaky world of video.

I never had issues with Vista, which I used for a couple of years actually, but since getting my new machine with Windows 7 I've found that most of my scripts which use DirectShowSource() barf on the input. I believe that it's because AVISynth asks DirectShow for video, but MF steps in to handle the videos in place of DirectShow and everything fails from there.

This mostly seems to affect h264 videos off modern cameras, especially with .MOV extensions, and funny container formats like .MTS. It doesn't just affect AVISynth, such files won't render in GraphEdit and can cause issues with the original MediaPlayerClassic.

I have tried (alone and in various combinations):

But nothing worked for me :-( Because so much of this was unstructured, it is possible that I missed a combination, so if you know a workaround, please write to me! I'd really like to know how to fix this!

I eventually stumbled upon one workaround, which I'm ashamed of because being such a dodgy hack. It works for many videos though, so I'll post it here for the sake of others. Again - if you find a better solution, please write to me!

The workaround is:

Repackage the video as an AVI file using the convert function in VLC Media Player.

This has worked for me every time for short videos (below 3-4 minutes) for several formats - like the .MOV files from an EOS 5D MKII, but depending on the video format sometimes the audio is still an issue (that's okay, it can be demuxed with the original MPC's "DSM Converter" - Google it). This doesn't work for me for files over a certain size and I'm not sure what the limit is. A couple of MTS files from a Canon HFS21 (around 25 minutes long) just wouldn't open after seeming to save okay. I've had some but less success trying the same trick with AVIDemux instead of VLC.

Here are the exact instructions with screenshots:

Fire up VLC and select the conversion tool:

Pick your file and choose Convert:

The first time you do this, you'll need to make yourself a conversion profile to do the repackaging for you. Pick an output filename first, but then select the "Create a new profile" button:

Give the profile an appropriate name, and choose AVI:

For the "Video codec" tab tell it that you do want video and to keep the original video track (once this is selected, all the other settings are ignored):

For the "Audio codec" tab, do the same (other settings are ignored once you choose to keep the original):

...and press Save!

Now choose your new profile (did you remember to set the destination file?), and press Start.

Ta-daa! The resulting AVI file does not meet the AVI standard and will cause trouble with media players, BUT, it can be loaded directly into AVISynth with AVISource(), avoiding DirectShowSource entirely and still working for some reason (probably splitter-related).

-- Peter.