Log in

View Full Version : DirectShowSource.dll CVS Pre-Release.


IanB
29th July 2005, 14:20
Dear all,

Here is the 2nd round rework of DirectShowSource.dll. Please give it a work over and report the bugs you find in this thread. Don't bother with bugs in the old version, cos the answer is gonna be "try the new version", does it have the problem?

Download it from here. Replace the version in your plugin directory.


Enhancements 2:

Hopefully solved the lockup problem with timeline striping.

More stategies to support seeking and determining video timing parameters.

Seekzero=true option to restrict seeking only back to the begining, this now allows limited seeking with unindexed ASF files. Seeking forwards is of course done the hard way.

Timeout=milliseconds option, to set time to wait when DirectShow refuses to render. Positive values return blank frames and/or silence. Negative values generate a AVS runtime exception (this will probably prang under XPsp2, sorry the lights work in my room).

Pixel_type="YV12, YUY2, ARGB, RGB32, RGB24, YUV, RGB, AUTO", limit the acceptable video stream subformat's for the IPin negotiation. Note the graph builder may add a format converter to satisfy your request, so make sure the codec in use can actually decode to your chosen format. The M$ format converter is just adequate.

Known issue:
ASF files seem to only decode in realtime, this is a real pig! Everything I have tried so far causes it to lock up. Not Happy Jan :angry:

Enhancements:

Now has a version block.
Normalize() works with it.
If seeking is possible it works.
More ways of guessing what the FPS is supposed to be.
Misspositioning in the audio stream due to task synchronization problems fixed.
The frame data is no longer blitted everywhere to sunday. Output frames are blitted once to an AviSynth default aligned VideoFrameBuffer. Frames decoded but not output (i.e. for short seeks) are never blitted.

Known problem:

YV12 pixel format is very difficult to get. DirectX seems hell bent :devil: on returning YUY2 as a priority. Only codecs that can be configured to return YV12 exclusively seem to to have a chance of returning YV12 data, but even then the Graph builder may throw in a YUY2 decoder for good measure. Manually build a graph (.grf file) with GraphEdit if this is a problem. ;)

Seek positioning is not exact. DirectX seems to be pretty slack with its internal rounding calculations. :eek: Playing a stream continuously from beginning to end will display all the frames in their correct position. In many cases when seeking to a frame, i.e. the last frame, the seek will overshoot the end of the stream. This is signified by the return of an all grey frame. Stepping backwards a few frames will eventually find the last frame. The error seems to be about 1 frame per 25000 to 100000 frames and always seems to be late :confused: i.e. a truncation error.

IanB

Zarxrax
30th July 2005, 21:24
After placing it in my plugins folder, I get the following message when I try to start VirtualDubMod:

The application or DLL c:\...\DirectShowSource.dll is not a valid Windows image. Please check this against your installation diskette.

azsd
31st July 2005, 04:52
this may have an network transmition error....

the file size is not divide able by pe align,
and follow message report by my ReJacker utils:

---------------------------
PE ReJacker
---------------------------
Sorry... I can't locate NT Header! Maybe it' an Hardcore Jacker.
---------------------------
OK
---------------------------

Wilbert
31st July 2005, 13:44
I guess there something wrong, AviSynth doesn't want to load the plugin. LoadPlugin is also complaining.

Ok, i compiled it myself and attached it here. This one should work.

IanB
1st August 2005, 05:47
Sincere apologies, text mode upload, DOH! :o

I re-uploaded it, the correct length should be 86016 bytes.

http://avisynth2.sourceforge.net/29Jul2005/DirectShowSource.dll

IanB

azsd
1st August 2005, 18:31
@IanB:

I had tried weeks ago and get a complier error here:
directshow_source.cpp(296): error: identifier "lstrcpyWInternal" is undefined

how to pass the complie?

Is there I missing some header file or I should delete some define in streams.h?

thx

AVIL
1st August 2005, 19:56
@IanB

I’ve gave a try to your new directshowsource.dll. In my video (QuickTime MOV from an photo camera, @ 12.5 fps), the seeking appears be different. More accurate, I think, but with no timed checks. Virtualdub don’t lose the track on seeking. But I’ve found two problems. The first is that sometimes (no clear reason at the moment) the image freezes on seeking. The second is when using Fizick’s filter fft3dfilter. Virtualdub don’t load a script with uses fft3d filtering on chroma (checked with plane 1). Simply freezes (after a while a must force the closing). The script performs well with last directshowsource.dll (AviSynth_100705.exe).

The offending line is in capitals in the script:

s=directshowsource("P4060021.mov").turnleft().converttorgb32(matrix="PC.601")
t0=s.trim(0,3).Levels(0,1.52,84,0,255,coring=false)
t1=s.trim(4,49).Levels(0,1.6,74,0,255,coring=false)
t2=s.trim(50,79).Levels(0,1.65,75,0,255,coring=false)
t3=s.trim(80,119).Levels(0,1.65,70,0,255,coring=false)
t4=s.trim(120,159).Levels(0,1.7,67,0,255,coring=false)
t5=s.trim(160,203).Levels(0,1.75,70,0,255,coring=false)
t6=s.trim(204,0).Levels(0,1.7,73,0,255,coring=false)
#a=s.Levels(0,1.5,200,0,255,coring=false)
#b=s.Levels(0,1.75,100,0,255,coring=false).converttorgb32()
t=t0+t1+t2+t3+t4+t5+t6
u=t.converttoyuy2(matrix="PC.601")
v=u.fft3dfilter(pcutoff=0.1,pshow=false,pfactor=1.0,pframe=82,px=0,py=0,wintype=2,interlaced=false,plane=0)
w=v.FFT3DFILTER(PCUTOFF=0.1,PSHOW=FALSE,PFACTOR=1.0,PFRAME=74,PX=1,PY=1,WINTYPE=2,INTERLACED=FALSE,PLANE=1)

Appending the lines sequentially, the script plays until I append the last line.

Best regards.

IanB
2nd August 2005, 15:47
@axsd,

lstrcpyWInternal is defined in include\wxutil.h of the DX SDK. Line 296 of the current version should not cause this error (it's in the middle of a comment block), it should be at line 339. Please get the current version from CVS. The official build platform is DirectX 8.1 although 9 will work. When installing DX make sure all the compiles complete cleanly, there is a log left somewhere indiscrete, use find "files moded today" to track it down. Read the compiling Avisynth sticky thread.

@Avil,

Any chance of a less complicated example.

IanB

AVIL
3rd August 2005, 17:45
@IanB

On preparing other script more simple, i can't reproduce the problem. Virtualdub ever load without problems. Even with my offending script. So i think the problem was my system. Sorry for the alarm.

Bye

Moitah
9th August 2005, 20:31
Rapid seeking (dragging the position slider) causes VirtualDub to lock up. It seems to work fine if I seek using "Go To Frame" instead. The old DirectShowSource didn't have this problem.

Also, I have a MOV file where when played normally the audio starts a few seconds before the video. When loaded via DirectShowSource (old and new versions), the audio/video start at the same time causing desynch. It would be nice if DirectShowSource could handle this automatically, but if not, is there a way to determine the offset (other than manually) so it can be corrected with DelayAudio?

Windows 2000, AviSynth 2.5.6 beta 4 (do you need any other information?)

EDIT: There is no CPU usage after it locks up. It happened with a MOV file and a WMV file, I didn't try any more.

IanB
18th August 2005, 15:25
18 August 2005 DirectShowSource.dll see 1st post for details.

IanB

Moitah
18th August 2005, 17:23
Hopefully solved the lockup problem with timeline striping.
Yep, I believe that worked :cool:. Thanks.

AVIL
19th August 2005, 06:13
Hi,

It work OK for me too, seeking is perfect, no low speed, no losted frames, no false frames.

thanks

magnatique
20th August 2005, 17:57
IanB,

I'm having some bad delays with these scripts I'm trying to encode in Xvid... I trakced the problem to be from avisynth/directshowsource as when I do a media player preview of the avs, the time delay is already present.

I have about 15 x 750 megs mov files that I need to combine together to create one large clip. I know the sound is synched properly as an encoder I use allows me to input the mov's directly and combine them together by creating a .lst file where I simply list the order of the clips in which I need them to be joined... time is perfect there.

But for my xvid encode, I need to go through virtualdub and use avisynth to combine them together.

I tried with a a .wav for wavsource, a .mp3 for mpasource... same delay.

I know the wav and mp3's were synched, as when I do a avisynth with only one of the clips, it is synched... but when I combine the 15 files together, that's when the delay happens...

here is an example of the script...



-------------------------
# SOURCE
va=DirectShowSource("S:\PNE Full MOV's\PNE2_01.mov")
aa=MPASource("S:\PNE Full MOV's\PNE2_01.mp3")
#a=AudioDub(va,aa)
vb=DirectShowSource("S:\PNE Full MOV's\PNE2_02.mov")
ab=MPASource("S:\PNE Full MOV's\PNE2_02.mp3")
#b=AudioDub(vb,ab)
vc=DirectShowSource("S:\PNE Full MOV's\PNE2_03.mov")
ac=MPASource("S:\PNE Full MOV's\PNE2_03.mp3")
#c=AudioDub(vc,ac)
vd=DirectShowSource("S:\PNE Full MOV's\PNE2_04.mov")
ad=MPASource("S:\PNE Full MOV's\PNE2_04.mp3")
#d=AudioDub(vd,ad)
ve=DirectShowSource("S:\PNE Full MOV's\PNE2_05.mov")
ae=MPASource("S:\PNE Full MOV's\PNE2_05.mp3")
#e=AudioDub(ve,ae)
vf=DirectShowSource("S:\PNE Full MOV's\PNE2_06.mov")
af=MPASource("S:\PNE Full MOV's\PNE2_06.mp3")
#f=AudioDub(vf,af)
vg=DirectShowSource("S:\PNE Full MOV's\PNE2_07.mov")
ag=MPASource("S:\PNE Full MOV's\PNE2_07.mp3")
#g=AudioDub(vg,ag)
vh=DirectShowSource("S:\PNE Full MOV's\PNE2_08.mov")
ah=MPASource("S:\PNE Full MOV's\PNE2_08.mp3")
#h=AudioDub(vh,ah)
vi=DirectShowSource("S:\PNE Full MOV's\PNE2_09.mov")
ai=MPASource("S:\PNE Full MOV's\PNE2_09.mp3")
#i=AudioDub(vi,ai)
vj=DirectShowSource("S:\PNE Full MOV's\PNE2_10.mov")
aj=MPASource("S:\PNE Full MOV's\PNE2_10.mp3")
#j=AudioDub(vj,aj)
vk=DirectShowSource("S:\PNE Full MOV's\PNE2_11.mov")
ak=MPASource("S:\PNE Full MOV's\PNE2_11.mp3")
#k=AudioDub(vk,ak)
vl=DirectShowSource("S:\PNE Full MOV's\PNE2_12.mov")
al=MPASource("S:\PNE Full MOV's\PNE2_12.mp3")
#l=AudioDub(vl,al)
vm=DirectShowSource("S:\PNE Full MOV's\PNE2_13.mov")
am=MPASource("S:\PNE Full MOV's\PNE2_13.mp3")
#m=AudioDub(vm,am)
vn=DirectShowSource("S:\PNE Full MOV's\PNE2_14.mov")
an=MPASource("S:\PNE Full MOV's\PNE2_14.mp3")
#n=AudioDub(vn,an)
vo=DirectShowSource("S:\PNE Full MOV's\PNE2_15.mov")
ao=MPASource("S:\PNE Full MOV's\PNE2_15.mp3")
#o=AudioDub(vo,ao)

az=(aa+ab+ac+ad+ae+af+ag+ah+ai+aj+ak+al+am+an+ao)
vz=(va+vb+vc+vd+ve+vf+vg+vh+vi+vj+vk+vl+vm+vn+vo)
AudioDub(vz,az)


-------------------
I also tried to use the same script, but do
z=(a+b+c+d+e+f+g+h+i+j+k+l+m+n+o) (that is to say do the audiodub after each instead than at the end) and still the same problem...

ANY help is greatly appreciated!!!!

Leak
20th August 2005, 18:42
I also tried to use the same script, but do
z=(a+b+c+d+e+f+g+h+i+j+k+l+m+n+o) (that is to say do the audiodub after each instead than at the end) and still the same problem...

ANY help is greatly appreciated!!!!
I'd try that again, but using "++" instead of "+", i.e. use AlignedSplice instead of UnalignedSplice.

If all your soundtracks are a wee bit longer or shorter than the video tracks (which is likely to happen if you're using MP3s and not WAVs with sample-exact length), you won't notice that when watching them on their own, but when splicing them they'll go out of sync due to it.

By the way - if you happen to have the audio tracks in a less lossy or lossless format, I'd use this source since you'll have to re-encode the audio at the end, and reencoding lossy compressed audio doesn't make it better... :)

np: Richard Devine - Anthracite. T. Vari (Lily of the Valley)

magnatique
20th August 2005, 19:03
I'd try that again, but using "++" instead of "+", i.e. use AlignedSplice instead of UnalignedSplice.

If all your soundtracks are a wee bit longer or shorter than the video tracks (which is likely to happen if you're using MP3s and not WAVs with sample-exact length), you won't notice that when watching them on their own, but when splicing them they'll go out of sync due to it.

By the way - if you happen to have the audio tracks in a less lossy or lossless format, I'd use this source since you'll have to re-encode the audio at the end, and reencoding lossy compressed audio doesn't make it better... :)

np: Richard Devine - Anthracite. T. Vari (Lily of the Valley)


I'll definately try your ++ tip, I will let you know what comes of it.

The original source are mov's. I used a tool called IMTOO video to Audio converter as my besweet wouldn't let me convert mov's to audio files. I tried both WAV and MP3 to do the synch, they both were off... the sample of the script I showed was with mpasource, but it would be the same with Wav.

if you know how to properly do a mov to wav convert with besweet or you have other tools to suggest, I am definately up to try em all and get this resolved ;)

IanB
21st August 2005, 06:49
@magnatique,

You should be able to directly decode the qsound audio using DirectShowSource() as long as you have the right Direct Show codecs loaded i.e. the .mov's play audio and video correctly in the classic windows media player, (Mplayer2.exe). Avoid multiple audio translations, do not use MP3 as an intermediate format, convert from Qsound -> wav, wav ->NewFormat.

And Leak is spot on you must use ++, AlignedSplice(), between clips. Quicktime is pretty slack regarding match audio and video lengths. You may need to pad the video out if the audio track is still playing sound when the video ends. Some code like thisPc=5 # Pad 5 extra frames
DirectShowSource("blah.mov")
Fc=FrameCount()
Last+Blankclip(Last, Pc) # unaligned splice!
A=Freezeframe(Fc, Fc+Pc-1, Fc-1) # use last frame as fill
...
Z=A++B++...IanB

magnatique
21st August 2005, 17:36
@magnatique,

You should be able to directly decode the qsound audio using DirectShowSource() as long as you have the right Direct Show codecs loaded i.e. the .mov's play audio and video correctly in the classic windows media player, (Mplayer2.exe). Avoid multiple audio translations, do not use MP3 as an intermediate format, convert from Qsound -> wav, wav ->NewFormat.

And Leak is spot on you must use ++, AlignedSplice(), between clips. Quicktime is pretty slack regarding match audio and video lengths. You may need to pad the video out if the audio track is still playing sound when the video ends. Some code like thisPc=5 # Pad 5 extra frames
DirectShowSource("blah.mov")
Fc=FrameCount()
Last+Blankclip(Last, Pc) # unaligned splice!
A=Freezeframe(Fc, Fc+Pc-1, Fc-1) # use last frame as fill
...
Z=A++B++...IanB

Thanks for the replies ;)

I tried Leak's ++ trick, and it worked under one condition ;)

if I do an audiodub() after each single clips, and then I do an align splice with ++, (like z=(a++b++c++d) ) then it works... but if I use the other method where I join the audio and video seperately, then do an audio dub, then that didn't work...

not sure why I didn't think about just using directshowsource for the audio directly... I'll try that right away and see how it compares ;)

Leak
21st August 2005, 17:48
but if I use the other method where I join the audio and video seperately, then do an audio dub, then that didn't work...
"++" (AlignedSplice) makes sure the audio and video tracks' lengths match exactly (or rather, the audio's length is made sure to be the same as the video's; take a look into AviSynth's docs for more info).

If you use it to join all audio and video parts on their own, it has nothing to work on and will work just the same as "+" - it's, eh, "magic" comes from being able to take the length of the audio *and* video into account when splicing... :)

np: Richard Devine - Anthracite. T. Vari (Lily of the Valley)

magnatique
21st August 2005, 19:09
"++" (AlignedSplice) makes sure the audio and video tracks' lengths match exactly (or rather, the audio's length is made sure to be the same as the video's; take a look into AviSynth's docs for more info).

If you use it to join all audio and video parts on their own, it has nothing to work on and will work just the same as "+" - it's, eh, "magic" comes from being able to take the length of the audio *and* video into account when splicing... :)

np: Richard Devine - Anthracite. T. Vari (Lily of the Valley)


thanks for the info ;)

Avisynth is just too powerful, I am learning new things everyday and we've been generating scripts for our encoding purposes for over a year now... it's amazingly powerful ;)

some videos I see on the web done through it amaze me, I wish I'd understand all of what can be done, I'm sure I could gain a lot of clarity and all

magnatique
21st August 2005, 19:42
IanB,

just using directshow was conclusive, and took between 30-50 mins less to complete ;)

I dunno why i wasn't doing that in the first place... I guess I probably read somewhere there could be sound delays with directshowsource and quicktime and kept thinking from then on that it wasn't possible to do it this way lol... thanks though, this will speed things up and work perfect ;)

Backwoods
14th September 2005, 00:37
AVISynth build 2.56 Sep 4 2005

DirectShowSource from this thread

Evaluate: System exception - Access Violation

DirectShowSource("DREWS_SHOW_HD_01.avi")

Cineform's DirectShow codec

IanB
14th September 2005, 10:24
The light works fine in my office :confused: :confused: :confused:


Does the old 2.55 version exhibit the problem?

Does it work in graphedit?

Does it work in mplayer 6.4?

Does it only fail with cineform avi's?

Does an appropriate .grf file work?

A little research up front helps a helluva lot.

IanB

movax
14th September 2005, 16:13
AVISynth build 2.56 Sep 4 2005

DirectShowSource from this thread

Evaluate: System exception - Access Violation

DirectShowSource("DREWS_SHOW_HD_01.avi")

Cineform's DirectShow codec

Simple solution, don't use Cineform's codec, as it also borks on my systems (and a few other people's as well).

Backwoods
15th September 2005, 00:09
The light works fine in my office :confused: :confused: :confused:

Does the old 2.55 version exhibit the problem?

No. The GRF does not load but the AVI does through DirectShowSource.

Does it work in graphedit?

Yes.

Does it work in mplayer 6.4?

Yes.

Does it only fail with cineform avi's?

Yes.

Does an appropriate .grf file work?

Avisnyth open failure:
DirectShowSource: Could not open as video or audio.

Video returned: "DirectShowSource: the filter graph manager won't talk to me"

Audio returned: "DirectShowSource: the filter graph manager won't talk to me"

A little research up front helps a helluva lot.

I was not sure what you needed, you asked and I provided.

IanB
15th September 2005, 09:01
@Backwoods,

If you buy me a copy of the cineform codec, I will have a look at it. (I don't accept warez).

Given the price of the product, I suggest you log a support call with Cineform, Avisynth is an open source project so they have access to all the resources need to solve your problem. If Cineform tech support need a leg up they can contact me thru this forum.

Sorry,
IanB

Backwoods
16th September 2005, 00:15
The codec is free with Adobe Premiere 1.5.1. If you wanted to find out for yourself about the codec, you could download the demo of Adobe Premiere. If not, I doubt Cineform would care to fix this problem. They want people to buy their $250/500 VFW codec. EDIT: The DirectShow codec comes with the free Premiere upgrade. Just to clarify.

Mug Funky
28th November 2005, 15:45
download link appears dead. (aug 18th version)

or maybe i can't shot web?

i'm wanting to make sure i have the latest version before i give up on it working... mpeg-1 is playing in MPC via dshow, but not in avs.

communist
28th November 2005, 16:00
Why dont you frameserve with DGIndex?

Wilbert
28th November 2005, 16:25
@Mug,

v2.56 contains the latest version.

Mug Funky
29th November 2005, 03:05
@ wilbert: thanks... looks like i'm out of luck with DSS + mpeg1 + my system (directshow is such a pain for getting stuff working... it just accumulates filters that aren't compatible with each other).

@ communist: d'oh! i forgot it supports mpeg-1 now. i'll try that when i get home.

basically i'm lazy so i'm making a li'l batch that will make a PAL 48k avs file for every media file in a given directory (starting with avi and mpg). avi works fine but DSS says no video :(

i'll figure it out later though... and give some feedback here that's a tad more useful than "zOMG IT DEOSNT WORK LOL" hehe.