View Full Version : Directshow problems
lost-coder
2nd December 2003, 08:33
I have two mpeg2 files one with LAPCM audio the other with mp2 audio.
With graphedit I get the following filter graphs:
for LAPCM
mpg -> mpeg2 splitter -> NVidia mpeg2 decoder -> video renderer
-> NVidia audio decoder -> audio out
An avs using DirectshowSource is unable to play back this file.
for mp2
mpg -> mpeg2 splitter -> NVidia mpeg2 decoder -> video renderer
-> mainconcepts audio decoder -> audio out
An avs using DirectshowSource plays the audio and the 1st frame only.
I beleive the NVidia decoders are both hardware related so Avisynth is unable to get the data out of them. If I create the following graph I can get either audio or video playback but not both:
mpg -> mpeg2 splitter -> mainconcepts mpeg2 decoder
-> mainconcepts audio decoder
Does anyone know how to fix either of these? Getting the graph file working for both audio and video would be enough for my current needs.
sh0dan
2nd December 2003, 08:51
MPEG2 is a bit tricky (mainly due to decoder strangeness). I have been testing using the Ligos and Elecard for testing
If you disable either audio using DirectShowSource("file.grf", audio = false) and video DirectShowSource("file.grf", video = false), AviSynth will display the errors that occur. If you are getting "The filter graph won't talk to me", the output pins doesn't fit with any of AviSynth's input pins.
What does the "XForm out"-pin of the filters say?
Try enabling "Raw Mode" as input in ffdshow, so it becomes inserted after the video decoder - it might help converting video, etc.
lost-coder
4th December 2003, 07:56
If I set up a graph file using the mainconcept decoders, the output of the avs will be the decoder that was inserted last. In other words if I put the video decoder in last I get video out, if I put the audio decoder in last I get audio out. I just can't seem to get both out.
As for the nvidia decoders, avisynth doesn't like the audio decoder. The filter graph would not talk to me. It doesn't have a pcm output, I suspects the output formats are handled by the hardware.
The nvidia video decoder has a yuy2 format on its video out pin. It also has subpicture and line21 output pins. When I use this decoder I get the first frame, but if I try to go any further the playback program locks up.
Oh, I've been using mediaplayer, vdub, and tmpeg for playback. I don't really expect the nvidia decoer issues to be fixed since I think they are tied to hardware. It's getting audio and video out at the same time with the mainconcept decoders that I would like fixed.
I just tested this with an asf file. Loaded directly with directshow source I get both audio and video. Loaded through a graph file, using render file, only video since it appears to have been the last filter added. So this appears to be a bug in the use of graph files.
XTCrefugee
27th November 2005, 17:36
Instead of posting a new thread I'll bump this one, even if it is old ;)
I've just been wrestling with the same problem with GraphEdit - with both the standard MPEG-I Stream Splitter and the MainConcept Splitter I can only get video or audio from a .grf loaded with DirectShowSource, not both. It seems to be the same regardless of the A/V decoders used (e.g. I tried Sonic CinePlayer decoders, CyberLink ones, the standard Windows ones and the MainConcept ones). My solution was to just load audio and video separately:
audio = DirectShowSource("Audio.GRF", audio=true, video=false) # Splitter + Audio Decoder Only
video = DirectShowSource("Video.GRF", audio=false, video=true) # Splitter + Video Decoder Only
AudioDub(video,audio)
Has this been fixed in DirectShowSource yet?
(FYI I'm using AviSynth 2.55 and the file being loaded in GraphEdit is MPEG-1, if that makes any difference).
IanB
30th November 2005, 13:52
Your AudioDub() solution is the correct one. The documention on using .GRF files is a bit lacking on this important detail.
Avisynth needs to be able to access the audio and video streams independantly. Normal use of a DirectShow graph only allows 1 clock source so apart from a small amount of buffering the audio and video samples need to be accessed together, trying to read samples from 1 stream without reading the other streams eventually leads to a deadlock. Our simple solution is to always use 2 independant graphs.
XTCrefugee
30th November 2005, 14:05
OK fine, thanks for your reply.
Zep
2nd December 2005, 03:50
MPEG2 is a bit tricky (mainly due to decoder strangeness). I have been testing using the Ligos and Elecard for testing
If you disable either audio using DirectShowSource("file.grf", audio = false) and video DirectShowSource("file.grf", video = false), AviSynth will display the errors that occur. If you are getting "The filter graph won't talk to me", the output pins doesn't fit with any of AviSynth's input pins.
What does the "XForm out"-pin of the filters say?
Try enabling "Raw Mode" as input in ffdshow, so it becomes inserted after the video decoder - it might help converting video, etc.
sh0dan i have been having problems also with DirectShowSource() and mpeg2 using elecard decoders. Can you give more details on what
you have found out and why DirectShowSource() reading in a m2v
can't read the whole file? I can read and seek find up to about
36 minutes of a 43 minute 720p 59.94 FPS m2v. It is the same
on all 720p 59.94 m2v's.
Does DirectShowSource() feed what frame to decode to elecard decoder?
If so then I would think it is a DirectShowSource() problem.
Here is what i see in graphedit when i drop this simple avs on graphedit
directShowSource("c:\Demux\house.m2v",pixel_type="YV12")
house.avs Avisynth video #1---->Xform In Avi Decompessor XForm Out ---->
Input Color Space Converter XFrom Out---->VMR Input0 Video Render
With my own GRF and the renderer deleted so avisynth can get the input
directShowSource("c:\Demux\house.GRF",pixel_type="YV12")
i see
House.m2v OUTPUT--->INPUT Elecard MPEG Demultiplexer VES--->
MPEG In Elecard MPEG-2 Video Decoder Video Out
the elecard decoders work in other apps fine so for now i'm thinking
it has to be Directshowsource/avisyth that is the problem.
I have the latest elecard decoders that come with Elecard player 4.0.1
any ideas? thoughts?
Zep
2nd December 2005, 04:02
audio = DirectShowSource("Audio.GRF", audio=true, video=false) # Splitter + Audio Decoder Only
video = DirectShowSource("Video.GRF", audio=false, video=true) # Splitter + Video Decoder Only
AudioDub(video,audio)
Now that is interesting. You just gave me an idea i will have to try.
If i add the ac3 to the mix even though i do not want to via avisynth
since the ac3 is cut in projectx I wonder if direct show will get the
right length and frame count when it sees the audio length.
I will try something like
video=directShowSource("c:\Demux\house.m2v",audio=false,pixel_type="YV12")
audio=directShowSource("c:\Demux\house.ac3")
AudioDub(video,audio)
if the video is still short then total grrrrrrrrr lol
IanB
2nd December 2005, 14:52
@Zep,
Try forcing the framerate for the video stream. DSS usually returns a stream duration, most times a rude value called "average duration per frame" which is frequently wrong or missing and sometimes if lucky a framecount. From the available data we calculate (guess) the AVS framerate and framecount. By forcing the DSS framerate you may be able to influence the resultant framecount. Use AssumeFPS to get the actual FPS correct after you have opened a correct length clip.
Zep
3rd December 2005, 05:35
@Zep,
Try forcing the framerate for the video stream. DSS usually returns a stream duration, most times a rude value called "average duration per frame" which is frequently wrong or missing and sometimes if lucky a framecount. From the available data we calculate (guess) the AVS framerate and framecount. By forcing the DSS framerate you may be able to influence the resultant framecount. Use AssumeFPS to get the actual FPS correct after you have opened a correct length clip.
Hi IanB,
My other thread (http://forum.doom9.org/showthread.php?t=103479) on this has more details.
info() returns the correct FPS of 59.94 also. now if i change FPS
to something else I can get to 43 minutes and see the last scene if i use
directShowSource("c:\Demux\house.m2v",FPS=50,pixel_type="YV12")
BUT the last good frame of the show where fades to black drops to 128754
from 131123 (note the true frame count is 154295) after the last scene i
then get grey frames to 131123 as it trys to read more frames that are not
there to decode.
No matter what i change the FPS to i can only reach frame 131123
Adding AssumeFPS(59.94) same thing.
here is what the following simple avs returns
directShowSource("c:\Demux\house.m2v",pixel_type="YV12")
info()
Frame: 0
ColorSpace: YV12
Width: 1280 Height: 720
Frame per second: 59.9402
FieldBased: No
Parity: bottom Field First
Video Pitch:1280
Has Audio: NO
Ausdio Channels: 0
Sample Type: NONE
Samples per second: 0
CPU detected x87 MMX ISSE SSE SSE2 SSE3 3DNC
nothing changes except frame count when i scan with the slider.
basically I can't get to all the frames. changing the FPS just
squeezes what will be shown into that 131123 frame count.
If i squeeze to much the video is jumpy cause so many frames are
lost and i get grey frames after the fade to black to frame 131123.
If i do not squeeze enough then i never see the whole video.
note: if i leave the FPS blank or force it to 59.94 i get all the frames
up to the 36 minute mark. none are lost in that 36 minute range. plays
smooth. Basically the last 6 minutes to from 131123 to frame 154295
are not ever reachable no matter what i have tried.
i can send you a the first 50 megs or whatever of the m2v if you want?
I can also stick it on a server and you can FTP it if you have no where
for me to send it? PM if you want to work a file send out.
Thanks
Zep
IanB
5th December 2005, 07:09
As an academic exercise using DSS on your PC does not work. I will be building the "debug build" logging as an option into the next release version. When this is available we might get a better idea of what parameters your mpeg2 codec is actually returning.
In the meantime use the DGDecode package for reading MPEG streams.
Zep
6th December 2005, 08:14
As an academic exercise using DSS on your PC does not work. I will be building the "debug build" logging as an option into the next release version. When this is available we might get a better idea of what parameters your mpeg2 codec is actually returning.
In the meantime use the DGDecode package for reading MPEG streams.
ok sounds good. any time frame? I asked because i do use DGindex
and i even helped DG find a number of bugs over the last year or so
but i like using the elecard decoders because they take advantage
of my dual core 4400+ and SSE3 and can decode 3+ times faster
than DGindex because of this my encode speed shoots WAY UP!
more than doubles using elecard decoders.
Does DSS feed the frames to the decoders? I mean does getting
the frame count come before the elecard decoders ever come into play?
I ask because i want to know if it is a decoder problem or a DSS problem?
thanks for doing such a wonderful job on avisynth!
Zep
IanB
7th December 2005, 13:52
Real life is intruding on my Avisynth time again. ETA probably sometime over the xmas break.
The Avisynth stream parameters (frames, framerate, size, colorspace, etc) are defined at script parse time, i.e. C++ constructor time. For a Graphedit analogy it would be after you render the graph but before you push the play button.
One issue I am aware of, which may be related to your problem, is some codecs only give the approximate length of a stream. For exclusivly directshow application this is not a problem, they just keep reading the stream until they get an end_of_stream condition. Avisynth is between a rock and a hard place, to be VFW AVI format compliant, the exact frame count of the stream must be specified at open time, if DirectShow lies when it is opened, we are screwed. I can see no solution to this impass other than to allow user specification of the framecount, which I think would be really grotty.
Zep
7th December 2005, 17:55
Real life is intruding on my Avisynth time again. ETA probably sometime over the xmas break.
wow much sooner that i expected :) Very cool!
I have to admit IanB that i am VERY CURIOUS to to see all the
details that the decoders (all decoders any type) return for all
the avi setup parms. Would this info be put into the info()
function? or a new option in DSS?
The Avisynth stream parameters (frames, framerate, size, colorspace, etc) are defined at script parse time, i.e. C++ constructor time. For a Graphedit analogy it would be after you render the graph but before you push the play button.
ahhh ok, very interesting.
One issue I am aware of, which may be related to your problem, is some codecs only give the approximate length of a stream. For exclusivly directshow application this is not a problem, they just keep reading the stream until they get an end_of_stream condition. Avisynth is between a rock and a hard place, to be VFW AVI format compliant, the exact frame count of the stream must be specified at open time, if DirectShow lies when it is opened, we are screwed
Well going by other apps that use the elecard decoder like WMP the correct
length is returned. Why not have an option for length?
with length=43.00 and FPS=59.94 you force DSS to get the correct
frame count. in this example 154295 which is correct and what DGindex
shows as the frame count with in a few hundred frames give or take.
DGindex seems to disgard a few frames VS the projectx full count
for whatever reason. bad frames i guess.
I can see no solution to this impass other than to allow user specification of the framecount, which I think would be really grotty.
I feel it is hacky but being a fall back option may be a good idea.
framecount=0 lets DSS figure it out and anything else DSS will use it.
However i think forcing length=43.00 and FPS=59.94 is better since
it takes all of 5 seconds to get the correct length in WMP or elecard player
or better yet projectx since that is where i demux which i then would add to
DSS parms.
Though i wonder why all the other apps i tried get the correct frame count
and DSS in does not. Even WMP gets the correct frame count and length
as an example. They must be doing something DSS is not to get
the elecard decoders to return the correct values and of course the elecard
player that uses the elecard decoders is spot on also.
thanks for your quick reply.
Zep
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.