PDA

View Full Version : ffdshow crash in WMEncoder


gordonwatts
11th August 2006, 23:06
Hi all,
I've been trying to use ffdshow to transcode my mpeg4 files (encoded with things like xvid, etc.) to wme. I'm using that format because I just got a new Gigabeat S from Toshiba -- which plays video, but not in the xvid format. Windows Media Player will do the transcode automatically, but... And this is where I need help.

ffdshow installed, player uses it to do the transcode, but fails every time.

Player has no problem playing the video file, however.

I loaded up GraphEdit from the DX9 SDK and the produced graph looks reasonable to my untrained eye (and it plays, of course, but that is rendering, similar to the player running it). I didn't try to build a graph that would would produce a wme. If there is a tutorial on how to do that I'm happy to try it out (I'm just not experienced enough yet with Graphedit).

I downloaded Windows Media Encoder and, lo, it gives a crash too (wants to send info to MS, heh). Looking at the info it wants to send it looks like a permission error of some sort (the typical xxx0005 error code).

Finally, I downloaded Elecard's trial version of their mpeg4 directshow filter and it works just fine. I'd rather use ffdshow because it does more formats (and it is free).

I've tried several versions of ffdshow, including those built by clsid and others (thanks! I've got a dual core system). They all behave the same way.

So, first question. Am I doing something dumb in my configuration? Second, if not, I'm happy to download source code and build and run WME under the debugger (though because of the x0005 error I'm suspicious that it won't help much). Are the wiki instructions up to date? I presume that for this sort of testing source forge is up-to-date enough.

Oh, finally, because I saw lots of warnings about conflicting filters on the forums, I created a virtual machine with a clean install and added WMEncoder 9 and ffdshow and the direct x stuff (yes, it plays just fine). So that should be a pretty unpolluted testbed.

Cheers, and thanks in advance!,
Gordon.

zambelli
12th August 2006, 01:49
I remember having a similar issue at some point with Ffdshow. If I remember correctly, I think changing the option "Allow output format changes" under Output settings of Ffdshow Video Decoder fixed the problem - but I can't remember which state I changed it to.

I think the error had something to do with ffdshow not inserting itself correctly into the DShow graph when a renderer wasn't the final filter in the graph.

gordonwatts
13th August 2006, 13:22
Thanks, Zambelli,
Armed with your comments I played a bit more -- but I still get a crash when using ffdshow in windows media encoder. The output setting has three states. By default the "allow output format changes during playback" is always checked. Disallowing it, or setting it to the intermediate state (allow output format changes, but only connect to compatible filters) has no effect -- the crash in windows media encoder is still present.

I searched the web a bit more for further info and found the following (http://72.14.207.104/search?q=cache:ocqBwPglxeoJ:www.codecs.ipbfree.com/index.php%3Fshowtopic%3D1381+Allow+output+format+changes+ffdshow+crash&hl=en&ct=clnk&cd=5) (ignore the flame war that errupts):

They can and should be ignored, because WMP is not only crappy, but also incapable of playing certain things correctly. WMP9 and 10 does not play back anamorphic content in Matroska and MP4 containers properly - either it doesn't play at all, or it plays with incorrect aspect ratio. This is because of WMP itself inserting a filter that doesn't allow output format changes downstream of the decoder. If the "allow output format changes during playback" box in ffdshow is checked, all the user will get is a black screen and audio. If it's set to the intermediate state or unchecked, the video will play, but unresized (i.e. with incorrect aspect ratio).

From this I get the feeling that setting this check box might affect things if I wasn't seeing any playback (which works just great in ffdshow and WMP10 with any setting of the allow output format changes).

I played around with several other settings in the dialog box, but found no joy. I can do things which will totally mess up playback (for example, select DV as the output format). Interestingly, however, WMEncoder has the exact same crash even with WMP10 decides it can't find a video codec in this case. Also, the crash in windows media encoder happens before the ffdshow icon pops up in the systray. I'm not sure what that means, but it sounds like it is during configuration...

zambelli
14th August 2006, 23:48
I searched the web a bit more for further info and found the following (http://72.14.207.104/search?q=cache:ocqBwPglxeoJ:www.codecs.ipbfree.com/index.php%3Fshowtopic%3D1381+Allow+output+format+changes+ffdshow+crash&hl=en&ct=clnk&cd=5) (ignore the flame war that errupts):
I'm afraid the author of that post is jumping to quite a few conclusions.
They can and should be ignored, because WMP is not only crappy, but also incapable of playing certain things correctly. WMP9 and 10 does not play back anamorphic content in Matroska and MP4 containers properly - either it doesn't play at all, or it plays with incorrect aspect ratio. This is because of WMP itself inserting a filter that doesn't allow output format changes downstream of the decoder.
I'm not sure where they're getting their information from. WMP doesn't insert any filters in a DirectShow graph that wouldn't be there to start with. When it comes to playing DShow types, it's literally just a DShow player. Aspect ratio information is expected via the VideoInfoHeader2 interface. If it's provided - WMP will adjust the video window to the renderer window.
If the "allow output format changes during playback" box in ffdshow is checked, all the user will get is a black screen and audio. If it's set to the intermediate state or unchecked, the video will play, but unresized (i.e. with incorrect aspect ratio).
I know for a fact this is not true because I specifically use this option on my Media Center PC when using ffdshow for Avisynth postprocessing of XviD videos.

From this I get the feeling that setting this check box might affect things if I wasn't seeing any playback (which works just great in ffdshow and WMP10 with any setting of the allow output format changes).
Well, if this setting isn't making a difference, then I'd suspect it's not the problem here.

I played around with several other settings in the dialog box, but found no joy. I can do things which will totally mess up playback (for example, select DV as the output format). Interestingly, however, WMEncoder has the exact same crash even with WMP10 decides it can't find a video codec in this case. Also, the crash in windows media encoder happens before the ffdshow icon pops up in the systray. I'm not sure what that means, but it sounds like it is during configuration...
Have you installed ffdshow clean or did you perform an upgrade at any point? It might be wise to uninstall ffdshow, clear all its registry entries from HKCU\Software and HKLM\Software, and then install it again. Also, you might want to try a different ffdshow build. The ones on x264.nl are generally best.
WME9 installs are generally pretty difficult to corrupt, but I suppose you could try re-installing that again - just in case. Other than that... The problem is most likely in the DShow or VfW pipeline. Check for extraneous codecs or filters that might be getting inserted into your graphs (use Graphedit). Also check how ffdshow handles uncompressed video - it might be attaching itself to itself multiple times. :)

gordonwatts
15th August 2006, 06:44
Hi,
Thanks for the information and all the help. I started with a fresh install of Windows XP SP2 (with all patches) in a virtual machine, so I'm pretty sure it was a clean machine. I then installed ffdshow. I have not tried the build you pointed out -- I've been using the ffdshow from afterdawn (http://www.afterdawn.com/software/video_software/codecs_and_filters/ffdshow.cfm) and some of the builds listed in the long threads that are working on new versions of ffdshow that are in this forum (http://forum.doom9.org/showthread.php?t=98600&page=100).

After an uninstall of the modern ffdshow build, I could find nothing in the registry that referenced "ffdshow" except in recent download lists, etc. But, I notice that things get installed everywhere, so I did what virtual machines are good at -- wiped the configuration away and started back with the fresh install.

With the x264 build you recommended installed, GraphEdit gives me "XviD Asd .avi -> AVI Splitter", "Stream 00 -> ffdshow MPEG-4 Video Decoder -> Video Renderer" and "Stream 01 -> ffdhsow Audio Decoder _> Default DirectSound Device" -- and the graph plays just fine. To my untrained eye, this looks fine.

This build crashes as well. I get the feeling I'm going to have to break out some more tools to try to debug this. What is the best way to go after this? I'm quite comfortable with MSVC and the debugger -- would going that route help? Or does someone have some sample code with an SDK that will do, basically, what WMencoder is trying to do and I can try to build and run that to see if it works? I'm happy to dig in (though it may take me a little time).

The avisynth + WMCenter is a good idea. I'd not thought of that before. Thanks for the pointer!

-Gordon.

zambelli
17th August 2006, 03:44
This build crashes as well. I get the feeling I'm going to have to break out some more tools to try to debug this. What is the best way to go after this? I'm quite comfortable with MSVC and the debugger -- would going that route help? Or does someone have some sample code with an SDK that will do, basically, what WMencoder is trying to do and I can try to build and run that to see if it works? I'm happy to dig in (though it may take me a little time).
Well, before we break out the debugger, let's try one more thing: if you're familiar with Avisynth, can you try loading the source file in Avisynth via DirectShowSource() and AVISource()? If both of those methods work, then we might need to start digging through the callstack to figure out where WME is croaking.

gordonwatts
18th August 2006, 04:37
Hi,
Thanks for your help! I've used it once or twice, but not recently, so I'll figure it out pretty quickly. But you mean using this avisynth script as an input to WME? There seem to be some reports (http://www.avisynth.org/Section+2:+AviSynth+and+frameserving)on the web of this being difficult.

-Gordon.

zambelli
19th August 2006, 04:21
Hi,
Thanks for your help! I've used it once or twice, but not recently, so I'll figure it out pretty quickly. But you mean using this avisynth script as an input to WME? There seem to be some reports (http://www.avisynth.org/Section+2:+AviSynth+and+frameserving)on the web of this being difficult.
No, I mean using Avisynth to see if you can read AVIs when the final output is not a renderer. When using DirectShowSource, the graph would need to be constructed before it's presented through Avisynth.

As for AVS to WME... It does actually work. Do a search here on the forums for it.

gordonwatts
19th August 2006, 05:16
Ok, I'll try that. But doesn't Windows Media Player do the same thing (along with graphedit) -- both of which work just fine? Sorry for being such a newbie when it comes to media.

I'll also see if I can hook up Avisynth to WME and see if the crash is the same. -Gordon.

Velocity 7
20th August 2006, 03:04
I am also having the same sort of problem, except if I uninstall ffdshow and try to encode an avi file encoded in XviD w/ 48 KHz audio, WME gives me a "Parameter is incorrect" error. Disabling ffdshow audio decoder prevents the crash but doesn't prevent this error.

gordonwatts
2nd September 2006, 08:33
Hi zambelli,
I'm sorry this took me so long -- work got in the way, as they say.

I've got an AVI file, and I installed 2.5 of AviSynth on my new machine. When I use GraphEdit to renger the avi file everything works fine, and is as I described in a previous message. Further, WMP plays the avi file directly just fine using the ffdshow codec.

Now, for avisynth I use the simple script:

AVIShow("c:\xxxxx\unit.avi")

and I ge the following error: "AVISource: couldn't locate a decompressor for fourcc xvid (c:\xxxxx\playunit.avs, line1)"

Just incase someone really messed up the avi file I tried replacing AVIShow with DirectShowSource. In that case no video codec can be found (the output pin is marked as YV12, no mention of xvid, which is what was used to encode this file). This error occurs both in GraphEdit and WME.

I'm afraid I'm pretty new to AviSynth so I'm not sure what this error means (i.e. is it expected?), or if I need a new filter, etc.

-Gordon.

P.S. Why does the Version filter fail to play in WMP but works just fine in GraphEdit?

foxyshadis
2nd September 2006, 09:23
Two totally different video layers, you have to have codecs for both. Directshow is what graphedit uses, and all players playing media files. VFW is what avisynth (both avisource and playing the avs file) and virtualdub use. By default, ffdshow's dshow filters are enabled but its vfw ones aren't - you need at least the mpeg4 and the raw video enabled on the vfw side.

Hmm, I'll think about merging dshow, vfw, and audio configs onto one panel, tabbed, which I think would be a little more sane.

clsid
2nd September 2006, 17:47
Or adjust the default settings in ffdshow. In my build I automatically enable VFW support for several formats when the DS ffdshow filter is set to decode those same formats.

gordonwatts
3rd September 2006, 19:05
Thanks! That makes sense -- still learning all these tools. Once I did that I was able to play my avi file in WMP as an AVISource from an avisynth file. Interestingly, when I turned on the VFW codecs I was also able to play my avi file using DirectShowFilter... which I would not have expected. Is that expected, or did I accidentaly jigger some other setting? Or does the avisynth command DirectShowSource not render the full graph up to video renderer?

Ok -- Zambelli, can you give me something more specific to search for; I've not been able to find a pointer to using avisynth as an input to WME yet. I find lots of hits, but I've had trouble narrowing down the search so that it will find the correct doom9 post.

gordonwatts
3rd September 2006, 19:43
Right. So I'm a bit thick. Turns out that the utlity to enable WME to read a avisynth script is already installed on my computer -- as part of ffdshow. Look in that menu for the MakeAVIS program. The dialog box that shows up is pretty self explanitory.

Ok, back to the original problem -- a crash with ffdshow when it was decoding a avi file that was input into WME. We went the avisynth route to see if it indicated there were any problems -- and it seems to play things just fine. As a test, I fed the avis file of the avisynth script into WME and... I get exactly the same crash.

I'm starting to wonder if this is as simple as a missing DLL that causes ffdshow or something like that to fail to load when run under WME?

zambelli
4th September 2006, 01:03
Interestingly, when I turned on the VFW codecs I was also able to play my avi file using DirectShowFilter... which I would not have expected. Is that expected, or did I accidentaly jigger some other setting? Or does the avisynth command DirectShowSource not render the full graph up to video renderer?
DShow is able to use VfW codecs, but VfW isn't able to use DShow codecs. Think of DShow as a superset of VfW.

Make sure both "Video decoder config" and "VfW codec config" panes in Ffdshow have the codec of your source AVI enabled. It's also generally a good idea to have "Raw video" in "VfW codec config" set to at least YV12 or "All YUV". That will allow you to edit all uncompressed YUV AVIs in VirtualDub, for example.

Ok -- Zambelli, can you give me something more specific to search for; I've not been able to find a pointer to using avisynth as an input to WME yet. I find lots of hits, but I've had trouble narrowing down the search so that it will find the correct doom9 post.
Sorry I didn't get a chance to link it last time - I was in a hurry.

In order to use Avisynth source with WME9, you need to set the encoder source to "Both device and file" in the Session Properties. If you prefer using command-line encoding, you're going to have to update your wmcmd.vbs with the one found here: http://forum.doom9.org/showthread.php?t=111633. (You just need the .zip, don't need to redownload the codec.)

Hmm, I'll think about merging dshow, vfw, and audio configs onto one panel, tabbed, which I think would be a little more sane.
I agree with that uniting Ffdshow settings into a single panel would be a good idea. Even just renaming "Video decoder configuration" to "DirectShow video configuration" would be a step in the right direction. ;) With a powerful tool such as Ffdshow comes great control, but perhaps more effort could be put into user friendliness and intuitive UI design. :)

gordonwatts
8th September 2006, 05:39
Hi,
Ok. Great. I think I now have ffdshow working correctly, and AviSynth even works. But I don't think I can transcode files using WMP, which is the original goal here... ;-)

1) Enabling all the codecs in VFW and now the DirectShowSource worked for the avi file. Thanks!

2) When I use "as device and file" for the WME settings it works. Time seems to be distorted, which is probably partly a function of my virtual machine running flat out and over taxing the CPU of my computer. I assume that when WME is set to device realtime matters. The output is useless, the time code totally messed up, among other things, and the audio had some problems.

My ultimate goal is getting WMP to transcode my files correctly (way back at the start of this thread, and many weeks ago!).

The WME device settings aren't going to help me there as I can't configure WMP to use those sorts of settings. The above tests make me think I finally have ffdshow configured correctly.

I'm making the basic assumption here that WMP does transcoding the way WME does file translation.

3) WME still crashes if I use a straight file conversion (on both the original avi file and also an avi file generated from an avs script using the makeAVIs program that comes with ffdshow).

4) On a whim I looked to see if I could change the "Allow output format changes" in the VFW configuration dialog. While the option is there, it is greyed out, so I can't alter its setting (perhaps it doesn't apply for VFW).

In summary, I think ffdshow is now fully configured, but it hasn't helped solve the basic crash I'm dealing with. Further suggestions welcome, but I think as soon as I can get a hold of an VC++ installation DVD I'll put it on this virtual machine and see if I can tell anything more about why the crash happens.

tchaikovsky
29th September 2006, 10:17
Hi,
...
3) WME still crashes if I use a straight file conversion (on both the original avi file and also an avi file generated from an avs script using the makeAVIs program that comes with ffdshow).
...

sorry for my chinese english :)
I think I have same problems. Always crashes when you use straight file conversion if the source files are avi (Xvid +mp3).

But I find if you disbale FFdshow mp3 decoder, wme9 can work properly.

gordonwatts
11th October 2006, 19:42
Tchaikovsky -- that was it! My WME9 now works. Thanks! I'll try out transcoding in WMP this evening to see if that gets ffdshow working there too.

So. How the heck did you find this out?

Second, I wonder what is it about the mp3 decoder that doesn't fit well with the directshow architecture?

- Gordon.

tchaikovsky
12th October 2006, 18:16
:)
I made some update on my old tool recently. Then I found my tool doesn't work with the newest FFdshow when I convert avi files (Xvid+mp3). So, I checked decoder and I get it. I'm not FFdshow Pro and have the same question about that.

foxyshadis
12th October 2006, 20:06
The ffdshow crash with WME has been fixed now. See the most recent build (http://sourceforge.net/project/showfiles.php?group_id=173941), currently ffdshow_rev382_20061012_clsid.exe.

gordonwatts
14th October 2006, 10:17
Ha! I was just about to say that if you turned off the MP3 then ffdshow worked just great transcoding in WME. I'll test out this new build! Thanks a lot for all your help!

tchaikovsky
14th October 2006, 21:18
The ffdshow crash with WME has been fixed now. See the most recent build (http://sourceforge.net/project/showfiles.php?group_id=173941), currently ffdshow_rev382_20061012_clsid.exe.

Thx, I like FFdshow. :)

gordonwatts
20th October 2006, 09:00
Yep! It all works now! That build flawlessly converted most of my files and there is no longer a crash: I had WMP convert about 30 gigs of video files and stuff them onto my Gigabeat. Sweet! Thanks for the help!

Out of curiosity, what was wrong? I went looking for a check in on cvs and didn't find anything obvious.

clsid
20th October 2006, 13:30
http://svn.sourceforge.net/viewvc/ffdshow-tryout/?view=log

I think it was fixed in rev 371.

foxyshadis
20th October 2006, 19:56
Looking at the code, it looks as if all it does is shut itself off in WME because the crash is something too bizarre to be debugged easily. Hah, didn't expect that.