Page 1 of 1

[RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Mon Mar 10, 2014 4:59 pm
by subpardaemon
Hi,

I'm slightly lost in the woods regarding deinterlacing. Since I'm not going to be meddling with 23.976, 29.976, 59.whatever FPSs, and will never have to perform IVTC and suchlike, I'm looking for a simple solution.

Since DGDecNV offers NVIDIA's hardware-based deinterlacing, and it seems to work really well (also, more importantly, it is hardware-accelerated!), I'm guessing it would be prudent to create the AVS templates like this:

1. a no-deinterlace template:
loadplugin("...\DGDecodeNV.dll")
loadplugin("...\Decomb.dll")
dgsource("__vid__",deinterlace=0)

2. a deinterlace template:
loadplugin("...\DGDecodeNV.dll")
loadplugin("...\Decomb.dll")
dgsource("__vid__",deinterlace=1,use_pf=true)

No. 1 would be used exclusively when during playback I see PROGRESSIVE as field order. No. 2 would be used for INTERLACED and MBAFF (in the latter's case, use_pf=true should take care of not needing to deinterlace non-interlaced frames, right?). Am I close to the right solution?

(As an aside: I'm planning to utilize meGUI for transcoding TV rips, is there any point in creating AVS scripts with audio specification in them? I need to transcode the MP2/AC3 tracks to AAC.)

Re: Best practice for deinterlacing 25FPS TS?

Posted: Mon Mar 10, 2014 5:54 pm
by admin
In general that is reasonable. Be aware that use_pf assumes the stream has correct signaling, which is not universally true.

The most reliable way to determine whether a video has interlaced "content" is to inspect it visually. There are several cases where the stream indications are not reliable.

MEGUI questions need to go to Zathor. I do believe you can input audio from an AVS script, possibly even the same script as the one delivering the video.

Re: Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 11, 2014 5:25 am
by Nick007
Be careful with deinterlacing as complete majority of TV (HD) and movie European 25 fps content is progressive (99.9%), docus often times as well or mix of both and only sport, music and live feeds are usually interlaced.
As admin said, quick visual inspection tells you all.

Re: Best practice for deinterlacing 25FPS TS?

Posted: Thu Mar 13, 2014 3:42 am
by subpardaemon
In my experience, the content we get in Hungary is mostly interlaced. So indeed, I'm left to my devices to decide whether deinterlacing is necessary.

deinterlace=2 (the frame doubling, bobbing method) is overkill for 25fps streams as it indeed raises the FPS to 50, so I'm sticking to deinterlace=1 and use_pf=false, after all. Since I can visually decide whether the source is interlaced or not, and I don't record programmes that are mixed, I think I'm in the clear on this. :)

Thanks for all your help.

Re: Best practice for deinterlacing 25FPS TS?

Posted: Mon Mar 17, 2014 8:55 am
by AJR
Nick007 wrote:Be careful with deinterlacing as complete majority of TV (HD) and movie European 25 fps content is progressive (99.9%), docus often times as well or mix of both and only sport, music and live feeds are usually interlaced.
As admin said, quick visual inspection tells you all.
I dont agree. Here in Czech rep. I didnt see any REAL progressive stream. I see only interlaced or MBAFF (which is combination of interlaced and progressive and is better to deinterlace even this stream to be sure some scenes not remain interlaced). Or am I wrong admin? :)

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Mon Mar 17, 2014 10:52 am
by Nick007
You are misled then. I also live in Czech Republic and 99.9% of HD movies and TV series are progressive. I know it because I dealt with captures from ČT1 HD of most movies available in HD ;-)
Of course it's coded as 1080i50 using PsF or MBAFF and the stream is marked as interlaced or MBAFF, but when decoded it contains progressive stream with no interlacing. Sometimes only credits are interlaced, but never the main feature (HD, doesn't apply to SD).
Frame step the source (without deinterlacing applied in player or directly in avspmod using DGDecNV) and you'll see it, don't be fooled by mediainfo like other people on various forums all over the internet...

It is the same like with 1080p25 Blu-rays which are coded as 1080i50 (because Blu-ray specification lacks 1080p25 format), movies and TV are almost always fully progressive as well.

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Mon Mar 17, 2014 11:43 am
by admin
@AJR

It's a common mistake to use encoding settings to determine if the material is interlaced. It is not reliable. You have to visually inspect the material.

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 6:10 am
by AJR
You cannot inspect every single frame ;)

Something about MBAFF:

MBAFF, or Macroblock-Adaptive Frame/Field Coding, is a video encoding feature of MPEG-4 AVC that allows a single frame to be encoded partly progressive and partly interlaced. Maintaining the quality of interlaced video can be a challenge in video encoding because of the larger spaces between horizontal lines in the same field. MBAFF allows an AVC encoder to examine each block in a frame to look for similarities between interlaced fields. When there is no motion the fields will tend to be very similar, resulting in better quality if you encode the block as progressive video. For blocks where there is motion from one field to another the quality is more likely to suffer if encoded progressive, so these blocks can remain interlaced.

Code: Select all

http://www.afterdawn.com/glossary/term.cfm/macroblock-adaptive_frame-field_coding
If I understand correctly part of the video (even just a single frame) can be partially interlaced. It is better to deinterlace MBAFF in all cases to be sure there will not remain any interlaced parts. Dont you think?

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 7:33 am
by Nick007
It can, but it usually is not interlaced for movies. And it usually isn't MBAFF either, but Scan type: Interlaced.
Read more here: http://en.wikipedia.org/wiki/Progressiv ... nted_frame
I wrote more in pm. Just trust your eyes ;-)

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 7:49 am
by AJR
My main interest are documentary, so it is more complicated here to say if it is interlaced or not.

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 9:11 am
by admin
If you have doubts about your source stream, you can use a deinterlacer that can avoid touching progressive frames, such as FieldDeinterlace, TDeint, etc.

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 10:20 am
by AJR
neuron2 wrote:If you have doubts about your source stream, you can use a deinterlacer that can avoid touching progressive frames, such as FieldDeinterlace, TDeint, etc.
CUVID hw deint isnt one of them? :( You wrote "etc." may I know what are the next? Yadif or LeakKernelDeint can avoid touching progressive frames or not?

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 10:45 am
by admin
I only know of those two. You'll have to research the other possibilities.

Maybe CUVID with use_pf can do it. Or maybe the deinterlacing doesn't do significant damage to progressive frames in any case. Give it a try and report back.

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 11:45 am
by Nick007
Deinterlacing can smear fine details and do other damage to progressive frames, sometimes it's very noticable.
I had good results with little false positives or overlooked frames using TFM(pp=2, clip2=QTGMC(preset="slow").SelectEven(), cthresh=6, MI=60). Threshold can be tweaked as needed, ShowCombedTIVTC(cthresh=6, MI=60, metric=0) is good for that.
TFM is part of TIVTC.dll.

Code: Select all

http://web.missouri.edu/~kes25c/TIVTCv105.zip

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 4:01 pm
by AJR
neuron2 wrote:I only know of those two. You'll have to research the other possibilities.

Maybe CUVID with use_pf can do it. Or maybe the deinterlacing doesn't do significant damage to progressive frames in any case. Give it a try and report back.
It is good idea use parametr use_pf, thanks for the tip ;)

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Tue Mar 18, 2014 7:54 pm
by admin
You're welcome. I aim to please. :ugeek:

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Wed Mar 19, 2014 10:35 am
by AJR
May I see some stats about frames? Which were pointed by use_pf function as interlaced and which one progressive?

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Wed Mar 19, 2014 10:45 am
by admin
Sorry, I can't understand what you are asking for. Are you asking about some specific stream or what?

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Thu Mar 20, 2014 4:36 am
by AJR
No, Id like to know if this internal function properly determide if the frame is interlaced or progressive. Nothing more, just verify ;)

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Thu Mar 20, 2014 8:48 am
by admin
Well, usually it is valid and reliable but it is possible to create streams with incorrect flagging, or no flagging. Can't you try it out?

Re: [RESOLVED] Best practice for deinterlacing 25FPS TS?

Posted: Wed Apr 09, 2014 9:44 am
by BarryW
In the UK I just use this template.avs with no use_pf flag

loadplugin("C:\Program Files\megui\tools\dgindexnv\DGDecodeNV.dll")
DGSource("__vid__", deinterlace=1)
#crop(4,2,-4,-2)
Spline64Resize(1280,720)
#Trim(0,x)

Occasionally if I re-encode a progressive MKV or MP4 to some other size I'll change deinterlace=0
but 'use_pf' isn't used. As far as I know all HD broadcasts in the UK are 1080i (actually 1920x1088i) 25fps (or 50fields per second) using either MBAFF or TFF. I've not seen PAFF used.

If the use_pf is set then no deinterlacing occurs (from UK broadcasts).