View Full Version : Newbie to Avisynth and realtime ffdshow mpeg2 1080i decoding... a few basic questions
mkanet
15th December 2011, 17:33
I've been using dscaler IVTC mpeg2 directshow filter mod to remove 3:2 pulldown from 1080i HDTV content. However, this decoder only has extremely basic bob and weave deinterlacing.
I'm looking for an ffdshow mpeg2 decoder solution that includes the highest quality general deinterlacer that can be done in realtime on a quadcore CPU AND also remove 3:2 pulldown (IVTC) for film content.
I've done many searches on google, but can't find a simple guide on how to do this. Hopefully, someone will be kind enough to tell me step by step what to do.
From what I can understand so far, the decomb plugin may be able to do this. I'm just not sure if it's what I'm looking for; or, if any other plugins might be necessary. I see many examples of how to use avisynth, however almost all of them look like they were meant for single media files. I need a script that will handle any mpeg2 file that ffdshow accepts via mpeg2/YV12
Thanks a million!
MKANET
Guest
15th December 2011, 18:40
Rule 12: Don't ask for "best". :readrule:
mkanet
15th December 2011, 20:37
Thanks. I modified the post. Hopefully someone will help get me started.
Rule 12: Don't ask for "best". :readrule:
mastrboy
15th December 2011, 21:06
In ffdshow you can choose to apply 3:2 pulldown in a checkbox, but i have no idea about the quality: http://img42.imageshack.us/img42/50/ffdshow.png
For higher quality 3:2 pulldown i'd probably use a aviscript in ffdshow with something like:
TFM(slow=2,clip2=nnedi3()).Tdecimate() or TFM(slow=2,clip2=QTGMC(preset="fast").SelectEven()).Tdecimate()
But i don't think ffdshow has any way of knowing if pulldown is actually needed? And if it don't it will apply that script to progressive material too.
Little explanation: TFM is a field matcher, with clip2 parameter beeing the deinterlacer if there is still combing after a field match or no good match is found, you can tweak the combing threshold with "cthresh" parameter. Tdecimate, will decimate duplicate frames with hints from TFM...
(Some of the more experienced people on this forums could probably explain it better)
sneaker_ger
15th December 2011, 21:22
In ffdshow you can choose to apply 3:2 pulldown in a checkbox, but i have no idea about the quality: http://img42.imageshack.us/img42/50/ffdshow.png
Applying 3:2 pulldown means telecining, i.e. converting from 23.976p to 30i, not IVTC.
mkanet
15th December 2011, 23:47
Thanks so much guys!
Yeah, my intention is to have a fully functioning general mpeg2 decoder dedicated to American HDTV standards:
- 1080i hard and soft telecined (removing 3:2 pulldown when it can)
- 720p 59.97fps (not sure if there's a way to detect original 23.976 film content or native 720p 59.97fps HDcamera)
Having said that,
Do I have to select deinterlacing within the avisynth script as well or can I simply use one of the deinterlacer presets within ffdshow to compliment TIVTC?
Also, I need to know the ideal way to handle 720p 59.97fps HD TV automatically. I'm not sure if in American 720p HDTV there any way to detect that movies/TV shows that were originally film 23.976fps. If not, then to at least leave 720p alone instead of trying to use deinterlace/IVTC on it.
I was reading the below link. It suggested some ffdshow settings and sample script:
http://ffdshow-tryout.sourceforge.net/wiki/video:avisynth#compatibility
TIVTC: (sample script)
TFM(order=1,chroma=false)
TDecimate(mode=1,hybrid=1,conCycle=1,chroma=false)
Edit: Are the below ones any better for quality? If so, which one? Is syntax correct? I want the most efficient one my quad core 2.4GHz CPU can handle without completely wasting too much CPU power:
TFM(slow=2,clip2=nnedi3())
Tdecimate()
TFM(slow=2,clip2=QTGMC(preset="fast")
SelectEven())
Tdecimate()
Thanks so much for all your help video gurus!
Guest
16th December 2011, 01:54
I need to know the best way...
I want the best one... One reminder per thread is not enough? :readrule:
mkanet
16th December 2011, 01:57
I hate to say it but
TFM(slow=2,clip2=nnedi3()).Tdecimate()
and
TFM(slow=2,clip2=QTGMC(preset="fast").SelectEven()).Tdecimate()
Were both bogus scripts. I got syntax errors with those. Does anyone actually have a real script for hybrid videos?
I did try the script I posed from the link below, however my video reported to reclock 19.181fps instead of 23.976
Do I need to post somewhere else?
It looks like Mastrboy might be correct though, in order to add or remove 3:2 pulldown, the "Apply Pulldown" needs to be checked; at least per this link:
For higher quality 3:2 pulldown i'd probably use a aviscript in ffdshow with something like:
TFM(slow=2,clip2=nnedi3()).Tdecimate() or TFM(slow=2,clip2=QTGMC(preset="fast").SelectEven()).Tdecimate()
mkanet
16th December 2011, 02:43
When I use the below script I get 19.181fps. It should be 23.976fps after 3:2 pulldown is removed. Also there are lots of skipped frames. Could someone please try the soft-telecined clips below and offer a very good script for it?
TFM(order=1,chroma=false)
TDecimate(mode=1,hybrid=1,conCycle=1,chroma=false)
Here they are:
http://www.megaupload.com/?d=8D8Q1Q5G
http://www.megaupload.com/?d=D8X708QK
http://www.megaupload.com/?d=P827WH5F
Guest
16th December 2011, 15:36
When I use the below script I get 19.181fps. It should be 23.976fps after 3:2 pulldown is removed That usually happens because you do IVTC twice. Maybe you erroneously applied force film in DGIndex for the first one.
mkanet
16th December 2011, 18:51
Thank you for helping me. I dont have any other settings in ffdshow enabled as far as I know of that could cause a force film. My script is incredibly simple. I noticed the same thing happens for decomb or TIVTC.
Decomb script: (causes 19.181fps)
AssumeTFF()
Telecide(guide=1)
Decimate(mode=3,threshold=2.0)
or...
TIVTC: Script: (causes 19.181fps as well)
TFM(order=1,chroma=false)
TDecimate(mode=1,hybrid=1,conCycle=1,chroma=false)
Interestingly... if I use the below script (I fond from another Doom9 post) the framerate is ultimately correct, but the video has heavy stutter with missing frames.. and the video can't keep up with audio:
deint = tdeint(mode=2,mtnmode=3)
tfm(clip2=deint,cthresh=4,mi=64)
tdecimate()
Is there a setting in ffdshow that's interfering with the avisyth from running correctly? If I use a completely different mpeg2 decoder... Dscaler mpeg2 IVTC to playback the same media, it removes 3:2 pulldown and plays back smoothly at 23.976
I included the test clips above to download (URLs) for someone to try to playback
Thanks again for all your help!
That usually happens because
ou do IVTC twice. Maybe you erroneously applied force film in DGIndex for the first one.
Guest
16th December 2011, 21:09
Decomb script: (causes 19.181fps)
AssumeTFF()
Telecide(guide=1)
Decimate(mode=3,threshold=2.0) Show the entire script including the source filter!
mkanet
16th December 2011, 22:53
Maybe I wasn't being clear enough. All I put in ffdshow's Avisynth script box is what I posted above. I posted here entirely two separate scripts (one for decomb and one for TIVTC); which both behaved the same way. If there is more I need to include in each script than what I posted, I would be grateful for help to fill in what's missing. It sounds like a "source filter" is required for the script to work? Thanks.
Edit: I made some progress. After I disabled "Detect soft telecine and average frame durations", the frame rate is now correct using the scripts I posted.
Now the only remaining problem is heavy video stutter. Several frames are skipping on parts of the video may have interlaced frames.
Show the entire script including the source filter!
Guest
16th December 2011, 23:43
So you *were* doing IVTC twice.
You don't know what source filter is being used? Don't you have to configure it somewhere if it isn't explicit in your script? I don't use ffdshow.
I'm downloading your first sample to see if there is anything strange about it.
Guest
16th December 2011, 23:55
Your first sample (Mission Impossible) has a mix of hard and soft 3:2 pulldown. This means you have to use a source filter that honors the pulldown and then do IVTC in your script (e.g., TFM/TDecimate or Telecide/Decimate). I did that using DGMPGDec (DGIndex+DGDecode) with Telecide/Decimate and it played fine without stutter.
So you have to tell what your source filter is so we can determine what it does when it faces mixed hard/soft telecine.
mkanet
16th December 2011, 23:55
FFdshow has an option called "add ffdshow video source". I think that might be what you're referring to. That way i dont have to put it in my script.
I am able to getting VERY smooth AND clear video when using the below script. However, as soon as it hit a scene with large panning objects, video is skpping many frames. I would try the dexter video clip first.
AssumeTFF()
Telecide(guide=1)
Decimate(mode=3,threshold=2.0)
FieldDeinterlace(full=false,chroma=false)
So you *were* doing IVTC twice.
You don't know what source filter is being used? Don't you have to configure it somewhere if it isn't explicit in your script? I don't use ffdshow.
I'm downloading your first sample to see if there is anything strange about it.
Guest
16th December 2011, 23:59
I can't help much more without knowing what the source filter is. Maybe post in an ffdshow thread? Can't you examine the script that is generated and see what the source filter is? When you enable "add ffdshow video source" ffdshow adds a source filter line to your script. There must be some way to view that.
I would just can ffdshow and use DGMPGDec for these MPEG2 sources. Is there some reason you can't do that? Are you just playing via ffdshow, or encoding and playing the result? Maybe your CPU doesn't have the oomph to do IVTC etc. in real time for HD sources.
In your latest script, the last line is not needed, as Telecide does it by default (postprocessing).
mkanet
17th December 2011, 00:12
I'm no ffdshow expert, but from what I can tell it's designed to do is use it's own libmpeg2 decoder and automatically do the equivalent to:
LoadPlugin("...\DGDecode.dll")
MPEG2Source("myvob.d2v")
I am interested in knowning how to do IVTC (and possible deinterlace) after the decoder loads the source.
If you can play the clips I posted perfectly, please tell me what your script is from beginning to end. I will try to integrate that into ffdshow.
Thanks!
I can't help further without knowing what the source filter is. Maybe post in an ffdshow thread?
I would just can ffdshow and use DGMPGDec for these MPEG2 sources. Is there some reason you can't do that?
In your latest script, the last line is not needed, as Telecide does it by default (postprocessing).
Are you just playing via ffdshow, or encoding and playing the result? Maybe your CPU doesn't have the oomph to do IVTC etc. in real time.
Guest
17th December 2011, 00:19
Your Dexter clip also is mixed hard/soft telecine, though with less hard than the Mission Impossible, so everything I wrote applies to it as well.
Guest
17th December 2011, 00:22
I'm no ffdshow expert, but from what I can tell it's designed to do is use it's own libmpeg2 decoder and automatically do the equivalent to:
LoadPlugin("...\DGDecode.dll")
MPEG2Source("myvob.d2v") If it is "equivalent" then there should be a way to tell it to honor soft pulldown. My guess is that it doesn't.
I am interested in knowing how to do IVTC (and possible deinterlace) after the decoder loads the source. That is not clear. Please clarify it.
mkanet
17th December 2011, 00:31
Can you please post the full aviscript you used to play them back without stutter during soft/hard telecine mode changes? I would really appreciate it. I'll try to figure out how to integrate it into ffdshow.
I can't define a static media file when loading a source filter in avisynth. The filename is dynamic; hence why there's the option below in ffdshow to use it's libmpeg2 video decoder and feed it into the avisynth script:
"Add ffdshow video source" feature in ffdshow:
http://ffdshow-tryout.sourceforge.net/wiki/video:avisynth#add_ffdshow_video_source
Your Dexter clip also is mixed hard/soft telecine, though with less hard than the Mission Impossible, so everything I wrote applies to it as well.
Guest
17th December 2011, 05:15
Can you please post the full aviscript you used to play them back without stutter during soft/hard telecine mode changes? I would really appreciate it. I'll try to figure out how to integrate it into ffdshow. I made a project in DGIndex with Honor Pulldown Flags. Then I use this script:
loadplugin("DGDecode.dll")
mpeg2source("Dext.d2v")
telecide()
decimate()
Then I open the script in VirtualDub and hit play.
Bear in mind that field matching and conditional decimation are CPU intense. I have a really high end CPU, so this plays nice and smooth for me.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.