PDA

View Full Version : Mpeg2 720x576 PAL reencode deinterlacing ?


ACrowley
27th November 2008, 18:48
Hi

Sadly i can only captrue DVB-C in SDTV at the Moment.
Everything is PAL Mpeg2 25Fps 16:9 or 4:3
A lot of Boradcasts are partially interlaced.

I deinterlace it fro palyback in DVBViewer with Cyberlink Video/Sp Decoder (PDVD8). I have Ati/AMD HD4870 Card. I set Cyberlink Decoder to Deinterlacing=Auto, so it should be Hardware deinterlacing.

So far so good...

But now i want to do some reencodes from these interlaced Mpeg Caps and i have to make a decision how i should deinterlace them properly ?

Is it Ok when i use the CyberlinkDecoder with Hardware Deinterlacing via Directshowsource Import into my AVSScript ?

Or should i use a Aviysth Plugin like Tdeint/Yadif ?
i never had to worry about Deinterlacing

O, my Target should be 25fps progressive

Is there any "allday allround" Deinterlacer / Values for Tdeint() ? ? Which is able to detect the Kind of Interlacing and eliminate it ?

halsboss
28th November 2008, 15:02
I haven't checked SD OTA broadcasts ... do they suffer from the same issues (where they are not really 576i content) as outlined here http://forum.doom9.org/showthread.php?t=143087 ? Country of capture ?

What is your real target (purpose), apart from "Target should be 25fps progressive" ? If it's DVD, don't deinterlace at all, leave it as-is (maybe shorten the gops if you need to) and author the streams directly as 576i are usually directly "DVD compatible". Depends what your (non-technical) end-point (purpose) is for the result.

ACrowley
28th November 2008, 17:48
I haven't checked SD OTA broadcasts ... do they suffer from the same issues (where they are not really 576i content) as outlined here http://forum.doom9.org/showthread.php?t=143087 ? Country of capture ?

What is your real target (purpose), apart from "Target should be 25fps progressive" ? If it's DVD, don't deinterlace at all, leave it as-is (maybe shorten the gops if you need to) and author the streams directly as 576i are usually directly "DVD compatible". Depends what your (non-technical) end-point (purpose) is for the result.

I encode it to SD x264 or WVC1

I capture German DVB-C Channels

Sure, not everything is interlaced here in Germay Ive a lot of captures where dgindex say interlaced ,mediainfo etc too. But you cant see any interlacing.
Some other Stream are surely interlaced

It should be true 576i / PAL 720x576 16:9 or 4:3. Some Channles are 480x576 4:3

halsboss
29th November 2008, 01:02
Got plenty of time ?
http://forum.doom9.org/showthread.php?p=1055263#post1055263

Then again
http://forum.doom9.org/showthread.php?p=1115201#post1115201

Not the same, but these examples are indicative... they deinterlace to double-framerate, resize, and re-interlace. You could look up how to deinterlace to normal framerate and ignore the reinterlacing.

SetMTmode(mode=2,threads=MT_Nthreads) # mode=2 for temporal multi-threading (interleaved frames)
Spline36resize(newWidth,LAST.height())
tdeint(mode=1,order=1) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF
Spline36resize(last.width(),newHeight)
separatefields()
selectevery(4,0,3)
weave()

SetMTmode(mode=2,threads=MT_Nthreads) # mode=2 for temporal multi-threading (interleaved frames)
Spline36resize(newWidth,LAST.height())
tdeint(mode=1,order=1,edeint=nnedi(field=-2,threads=4)) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF
Spline36resize(last.width(),newHeight)
separatefields()
selectevery(4,0,3)
weave()

SetMTmode(mode=2,threads=MT_Nthreads) # mode=2 for temporal multi-threading (interleaved frames)
Spline36resize(newWwidth,LAST.height())
# see http://forum.doom9.org/showthread.php?p=1114448#post1114448
# tcritical plugins http://bengal.missouri.edu/~kes25c/
# for yadifmod tff Order=1 ; for nnedi field=-2 means assumeTFF is important
yadifmod(mode=1, order=1, edeint=nnedi(field=-2,threads=4)) #bob deinterlace it without stairstepping to 50
Spline36resize(last.width(),newHheight)
separatefields()
selectevery(4,0,3)
weave()

tre31
29th November 2008, 03:09
I deinterlace it directly in DVBViewer with Cyberlink Video/Sp Decoder (PDVD8). I have Ati/AMD HD4870 Card. I set Cyberlink Decoder to Deinterlacing=Auto, so it should be Hardware deinterlacing.

Is it Ok when i use the CyberlinkDecoder with Hardware Deinterlacing via Directshowsource ?


Try this http://forum.doom9.org/showthread.php?t=141441

Then build a graph like so using graphedit or graphstudio (graphstudio is more informative) -
File async source filter nameoffile.m2v --->
mpeg2splitter (the microsoft default one - has correct resolution output in filter graph) --->
cyberlink powerdvd decoder (sp/pdvd7) --->
vmr7 renderer

Now save as name.grf, and you can just encode in crf mode with the directshow modded x264 (accepts filter .grf input) for one pass encode. Deinterlacing looks perfect - as it would when you view it in normal dvb viewing app (no real need for anything else).

edit: btw deinterlacing in dvbviewer does not deinterlace the captured output, it deinterlaces the source on the fly using hardware, but the source capture is left intact as unaltered transport stream .ts

ACrowley
29th November 2008, 08:47
@tre31
Ofcourse i now that the Deinterlacing&Decoing in DVbviewer have no Effect on the Capturing/Output Stream. Its afftecs only the Playback :) I use Cyberlink Decoder fro PAlyback with DXVA and Deinterlacing
Im talking about "reencoding" and Deinterlacing of the captured DVB Mpeg2 Stream

this should do the same :

grf :
Filesource(async)-Mpeg2Splitter-Cyberlink Video/Sp Decoder (PDVD8)

-Cyberlink Decoder Deinterlacing @ Auto =HW Deinterlaving via HD4870 GPU

Then import the grf into my AVS and encode it to whatever...looks fine to me ?


@Halsboss
ok, THX
As i say ,i want encode it to 25Fps. So ,when i use use bobbing , how can bring it back to 25fps after Deinterlacing ?

halsboss
29th November 2008, 12:52
@Halsboss
ok, THX
As i say ,i want encode it to 25Fps. So ,when i use use bobbing , how can bring it back to 25fps after Deinterlacing ?

Choose one of the right modes (ie normal framerate vs double framerate vs double framerate) for TDEINT / YADIF / NNEDI by looking at their documentation. The comments in the examples provide some hints.

tre31
29th November 2008, 13:48
Bobbing is really best used when doubling the framerate - so, why bob then cut the output in half (by reducing the framerate back too 25fps). Personally I think you should try what I suggested, it outputs progressive 25fps, doesn't take a long time like NNEDI (sure the end result is best with NNEDI - but 1 day per encode is not fast no matter which way you put it).

To put it in perspective - on a quad core q6600 I get about 5-6fps for HD 1080i, compare that too NNEDI - about 0.6-0.8fps. So a crf encode (1 pass) at ~5fps for a 2 hour movie takes about 10 hours - do it before bed, output is as good as what you see when you watch mpeg2 dvb in playerofyourchoice, and you retain the full hd quality (well pretty damn close, I've been using crf 20 and its pretty damn good, the extra quality bits are mostly excess "noise" anyway that has been added too make the appearance of detail).

What I did too get the x264 settings was - duplicate the MeGUI DXVA HD High quality profile, add --crf 20 at the front, and off I went, may take a bit of testing too find what you like/think is best.

For example I do it via batch file atm (and just drag the .grf onto it) - here is a sample;
------------------
x264--crf20--hdtv-lvl41.bat

@echo off
echo Media Input Information:
echo ==========================
H:\Downloads\dvd_vcd\utils\MediaInfo_0.7.7.7_CLI_Win32\mediainfo %~dp1%~n1.m2v
cd H:\Downloads\dvd_vcd\encoding\dshow_x264_20081106
h:
echo Encoding started at: %time%
echo on
x264 --crf 20 --level 4.1 --ref 4 --mixed-refs --bframes 3 --b-adapt 2 --weightb --direct auto \
--filter -1:-1 --subme 7 --trellis 2 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct \
--vbv-bufsize 50000 --vbv-maxrate 50000 --me umh --threads 4 --thread-input --progress \
--no-psnr --no-ssim -o L:\tv_captures_storage\%~n1.mkv %1%
@echo off
echo Encoding finished at: %time%
pause


First it displays input media info of the m2v (handy for knowing length of encode so you can tell how far it is in progress).
The %~ variables are just batch variables for getting filenames without extensions and directory/path names, handy too know, plenty of info on the net about that.

Anyway hope that helps you/anyone else out there, you can do multiple encodes, just use n2,n3, etc, and select multiple files in explorer and make different batch files for however many input files you want.

So, in the end its simple, just drag and drop and let it go, and it does ATI's vector adaptive hardware deinterlacing, and looks good, without going over the top with NNEDI and the like (yes I'm sure the NNEDI/avs/mcbob/etc fanatics will say - nnedi is better, and yes it is, but at what cost? who wants too encode -all- the time).

ACrowley
30th November 2008, 10:23
@tre31

What i want to know about your Postings was, if encoding via Directshosource and Avisynth will do the same (and i thin it woll do the same)

create a grf :
Filesource(async)-Mpeg2Splitter-Cyberlink Video/Sp Decoder (PDVD8) # Deinterlacing is set to auto in the Decoder and i Catalyst CCC.
Then import the grf into my AVS via Directshowsource ,and encode it to whatever...ist the same as your suggestion,isnt it? .
Also youve to enable Motion Vector adaptive Deinterlacing in CCC, and also you should note that all Tweaks like Color Vibrance/Edge Enhancement,Denoise etc are having a Effects to your encode cause "you get what you see" ,when you encode via Directshow.

However, Most of my Mpeg2 are only partially interlaced/Top Field.
Most Movies have a interlaced/Top field flag, but theyre really not interlaced without interlaced Frames..its progressive.

Shouldnt it be enough to deinterlace partially interlaced Captures without Bobbing to 50fps? Tdeint(mode=0) ?

PS. Sorry..my English is not good

tre31
3rd December 2008, 00:07
The deinterlacing in avisynth and the deinterlacing used by ATI/Nvidia is not the same, avisynth = software based, directshow (if using powerdvd7/8 decoder = hardware).

You can turn off all the ATI 'extras' - have a look here ( http://exdeus.home.comcast.net/ati-hd2x00/ ), I believe that it may be much the same for the 48xx series as my 2600XT card.
Just turn off the denoising, skin color vibrance, etc - makes a big difference.

As for top field first and flag being set and things not being interlaced a certain way, well - that's purely up too what is being broadcast - movies may not be exactly what all the usual content is, but I severely doubt it would be broadcast as progressive as that takes approximately twice the bitrate, and the reason interlacing is used is too save bits.

Best way too find out whether something is deinterlaced is make a avisynth script and don't use deinterlacing on it and load it up in avsp/virtualdub, should be very clear.

ACrowley
3rd December 2008, 11:54
The deinterlacing in avisynth and the deinterlacing used by ATI/Nvidia is not the same, avisynth = software based, directshow (if using powerdvd7/8 decoder = hardware).

You can turn off all the ATI 'extras' - have a look here ( http://exdeus.home.comcast.net/ati-hd2x00/ ), I believe that it may be much the same for the 48xx series as my 2600XT card.
Just turn off the denoising, skin color vibrance, etc - makes a big difference.

As for top field first and flag being set and things not being interlaced a certain way, well - that's purely up too what is being broadcast - movies may not be exactly what all the usual content is, but I severely doubt it would be broadcast as progressive as that takes approximately twice the bitrate, and the reason interlacing is used is too save bits.

Best way too find out whether something is deinterlaced is make a avisynth script and don't use deinterlacing on it and load it up in avsp/virtualdub, should be very clear.

Hä ? what you are talking about ? Ofcourse Avisynth and Hardware Deinterlacing is not the same.
Also i dont need Hints/Basics about finding out if its interlaced or not etc. THX for your Replys ,but that wasnt my Question:) A good start to detect Interlacing is the megui Interlacing Scanner from the AVSScriptCreator...it works fine.

I know the ATi AVIVO Settings very good and i already tweaked them to get perfect and sharp Playback with Motion Vector Deinterlacing. turning off all AVIVO Features as you say is a very bad Idea!
Mpeg2 SD looks not good without Edge Enhancement and Denoise. It looks by far better with correct tweaked Values. The Picture looks a lot sharper with EdgeEnhancement around 10-50.

And yes, most Movie Broadcasts from German Channels like ARD/ZDF, Pro7 etc are having not "one single interalced Frame" into the Stream.
Otherwise a lot of Docus/Series are interlaced, but not fully.

I made a few Tests with Deinterlacing via Directshowsource and Motion Vector DXVA Deinterlacing against proper Avisyth Deinterlacing with Tdeint or Yadif.
The Quality is "better" via Avisynth, imho. Ofcourse DXVA Deinterlacing is perfect for Realtime Playback.

And i ended up with TDeint or Yadif without Framerate doubling/bobbing. Most DVB-C Broadscast are only partially interlaced.So its Ok for me to use Tdeint(mode=0) And as i say most Movies are not interlaced, so theres no Question about Deinterlacing.

Jay Bee
9th December 2008, 12:40
Err, directshowsource can't do HW deinterlacing. All you're getting is crappy, blurry 25 fps deinterlacing. To get HW deinterlacing just encode it as a interlaced x264 and use Cyberlink or Arcsoft decoder to play the finished file.

ACrowley
9th December 2008, 12:59
Err, directshowsource can't do HW deinterlacing. All you're gezzing is crappy, blurry 25 fps deinterlacing. To get HW deinterlacing just encode it as a interlaced x264 and use Cyberlink or Arcsoft decoder to play the finished file.

Ok Thanx. yes, that was also my Impression...

However, as i said, most Movies from ARD,ZDF ,Pro7 etc are without interlaced Framnes here in Germany, so i dont have to worry about deinterlacing.
And most interlaced broadcast are only partially interlaced, so it looks fine (in my Eyes) with Tdeint/yadif without 50fps Bobbing = Tdeint(mode=0). So i get 25fps output and i dont have any Problems anymore :)

Jay Bee
9th December 2008, 13:10
Yeah, if you're encoding movies there's no need to encode interlaced. I thought you were talking about real interlaced content.

ACrowley
10th December 2008, 12:29
Yeah, if you're encoding movies there's no need to encode interlaced. I thought you were talking about real interlaced content.

heah...99% of the Movies via DVB are progressiv. Even its signed as interlaced Top Field

But some Dokus, Series etc sometimes interlaced.
Meguis Scanner tells me partially interlaced.

You told me Directshowsource Import in a AVS cant do HW Deinterlacing with a grf like Filesource(async)-Cyberlink VideoDecoder. Ok, its obvisous, the Output is very bad.

But when i encode directly trough graphedit ? Somethink like Filesource(async)-CyberlinkSP VideoDecoder- MainconceptAVC Encoder
It should work ?
Cyberlink Decoder with DXVA and Auto Deinterlacing, and Motion Vector Deinterlacing enabled in CCC