Thread: MPC, MeGUI and deinterlacing problem

1. Hello there, I wanted to re-encode a few drama episodes (1080i recorded in Japan) to reduce their file sizes. I've noticed they're interlaced only after playing them in VLC player, since interlacing artifacts were for some reason reduced in Media Player Classic HC. I'm encoding with MeGUI, usually with Sharktooth's profiles (x264 Unrestricted 2-pass HQ in this case), so I just adjusted it for interlaced file (by setting Interlaced Mode to TFF, according to MI log) and created AviSynth script that would deinterlace it using TDeint filter.

Here comes the strange part: after re-encoding picture plays perfectly fine in VLC Player, but in MPC some frames still appear to be interlaced.

Here's MediaInfo log:
Code:
Format                                   : MPEG-TS
File size                                : 3.60 GiB
Duration                                 : 27mn 13s
Overall bit rate mode                    : Variable
Overall bit rate                         : 18.9 Mbps

Video
ID                                       : 320 (0x140)
Menu ID                                  : 191 (0xBF)
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@High
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : Variable
Codec ID                                 : 2
Duration                                 : 27mn 12s
Bit rate mode                            : Variable
Bit rate                                 : 17.8 Mbps
Maximum bit rate                         : 24.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.287
Time code of first frame                 : 17:02:59:15
Time code source                         : Group of pictures header
Stream size                              : 3.39 GiB (94%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 321 (0x141)
Menu ID                                  : 191 (0xBF)
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format version                           : Version 2
Format profile                           : LC
Muxing mode                              : ADTS
Codec ID                                 : 15
Duration                                 : 27mn 13s
Bit rate mode                            : Variable
Bit rate                                 : 192 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Delay relative to video                  : -375ms
Stream size                              : 37.4 MiB (1%)
DVD2AVI file states that the file is a mix of Progressive and Interlaced frames (there doesn't seem to be any pattern, so I doubt it's telecined), File Type is NTSC and 75% of it is Film.
I've created a sample file and ran it through every deinterlacing filter provided with in MeGUI to see if any one would work, but results were never satysfying when played in MPC. I tried decombing it even though it doesn't seem to be telecined, and though it did take care of interlaced frames showing in MPC, it also made video a bit choppy.

Am I doing something wrong here? Should I use different filters or settings? Maybe use entirely different software? I'm sorry if I'm missing something very obvious here, I'm not very advanced encoder and this is my first attempt at interlaced video. My goal is to deinterlace these videos so they display correctly in both VLC and MPC.
2. You may have to wait a little while for a reply as some of our more expert members may be away for the weekend.

And welcome to our forums.
3. Originally Posted by hydrangea
DVD2AVI file states that the file is a mix of Progressive and Interlaced frames (there doesn't seem to be any pattern, so I doubt it's telecined)
I expect it probably is telecined, a mix of both hard and soft telecine. A short 10 second sample, one with steady movement, will tell the tale. And if it is, TDeint is the wrong filter to use on it. If it's a mix of film and true video then you're in a spot as there's no ideal way to treat it unless you're prepared to use Variable FrameRate..
Am I doing something wrong here? Should I use different filters or settings?
Without a sample one can only guess. Maybe include in your sample a section that seems to become jerky-playing after being 'decombed'. But not from the output, from the source.
4. Originally Posted by manono
Maybe include in your sample a section that seems to become jerky-playing after being 'decombed'. But not from the output, from the source.
Here's a 12 seconds long sample of two smooth movements that look choppy after decombing. I hope it will help making my case a bit clearer (original file can be downloaded using button in the upper part of the page).
5. Originally Posted by hydrangea
Originally Posted by manono
Maybe include in your sample a section that seems to become jerky-playing after being 'decombed'. But not from the output, from the source.
Here's a 12 seconds long sample of two smooth movements that look choppy after decombing. I hope it will help making my case a bit clearer (original file can be downloaded using button in the upper part of the page).
Thanks for the sample, but it doesn't make it clearer. Take another look at manono's request: "not from the output, from the source". We need to see source video, not processed video.
6. Originally Posted by sanlyn
Originally Posted by hydrangea
Originally Posted by manono
Maybe include in your sample a section that seems to become jerky-playing after being 'decombed'. But not from the output, from the source.
Here's a 12 seconds long sample of two smooth movements that look choppy after decombing. I hope it will help making my case a bit clearer (original file can be downloaded using button in the upper part of the page).
Thanks for the sample, but it doesn't make it clearer. Take another look at manono's request: "not from the output, from the source". We need to see source video, not processed video.
This IS a source video, I demuxed original .ts file to mpeg-2 video and AAC audio track. Then I put video stream into mkv container and split it with mkvmerge to acquire this sample. What's inside mkv container is still unprocessed mpeg-2 video stream (unless mkvmerge processes video in some way that I am unaware of). If mkvmerge processes video somehow, then please tell me what software I should use to get a sample straight out of ts file.
7. I must misread your post and thought you said the sample has been decombed. At any rate, something's not right. I see no interlace,. no telecine.I did see a missing frame betwen 5 and 6, a duplicate of 13 and 14, and a missing frame between 17-18.
8. Originally Posted by sanlyn
I must misread your post and thought you said the sample has been decombed. At any rate, something's not right. I see no interlace,. no telecine.
That's because he sent a stupid MKV (time for your should-be sticky, about how to cut MPEG-2 video from the source for upload?). I demuxed it from the MKV to get the MPG.

Make the D2V using 'Honor Pulldown Flags' and IVTC the thing. This works reasonably well:

TFM(D2V="E:\Test\Test.d2v")
TDecimate()

Adjust for your own names and paths. It's just a mix of hard and soft telecine, what I can see of it.
9. Well, yes, come to think of it, the vid started out in life as a .ts....
So instructions on how to use DGINdex are here: http://forum.videohelp.com/threads/359295-Record-without-interlacing?p=2272359&viewful...=1#post2272359
10. Originally Posted by sanlyn
Well, yes, come to think of it, the vid started out in life as a .ts....
So instructions on how to use DGINdex are here: http://forum.videohelp.com/threads/359295-Record-without-interlacing?p=2272359&viewful...=1#post2272359
Thank you, I didn't know I could use DGIndex to split .ts files, I only ever used it as a file indexer in MeGUI. I've attached a sample to this post.
11. Looks to me like progressive, with dupe frames inserted to make 23.976 film play at 29.972.
Code:
MPEG2Source("Drive:\path\to\video\sample.d2v")
TFM().TDecimate()
I get 23.976 progressive. There are compression artifacts and rainbows. The film grain should be retained (or restored if any denoising is done) or you'll get annoying banding effects, some of which are already beginning to appear in the background.
12. Thank you sanlyn, this worked for most of the video:

Code:
dss2("sample.m2v", fps=29.972).AssumeFPS(29972,1000)
tfm(order=1).tdecimate(hybrid=1)
When I checked how it would deal with credits (interlacing combs are terrible in this part) it turned out that they look a bit smudged and the movement is jumpy when they're rolling down. I'm more or less satisfied with overall quality, but isn't there a way to make credits move move more smoothly? I'm attaching a raw sample with credits.
13. The main issue with the credits is they are truly interlaced (they run at 59.94 fields per second) , but the rest of the content runs at 23.976p

There are going to be some compromises here - either you let the content play jerky at 29.97 (every 5th frame repeated) with smoother deinterlaced credits , or you let the credits play jerky at 23.976 (every 5th frame decimated) with smooth content

There might be some fancy way to re-do/retime the credits to 24p with an overlay and mvtools2 using masktools, or retime the content to 29.97 with 29.97 credits, and use a VFR encode for the rest of the 23.976p content for the main video. Just throwing out ideas
14. Originally Posted by hydrangea
Code:
dss2("sample.m2v", fps=29.972).AssumeFPS(29972,1000)
tfm(order=1).tdecimate(hybrid=1)
Actually, it's 29.970030fps, written more commonly as 29.97fps.
15. Here is one approach, where the left side of the clip is IVTC'ed to 23.976, but the right side (where the titles scroll) is bob deinterlaced to 59.94p, then interpolated using a function based on mvtools2 (basically it's generating "inbetween" frames to 120fps (119.88) , then taking every 5th one to get 23.976 fps . It's basically making it so the title frames are "evenly spaced" in time ). It's still "stuttery" in the sense that 23.976p will always be "jerky" compared to faster framerates

It's done "crudely" with crop and stackhorizontal() . A more elegant way might be to use masks / masktools

You can play with changing the deinterlacer or settings to attempt to get cleaner characters for the titles, but I think tdeint+nnedi3 does a decent job here in terms of speed/quality

It's not too bad on this sample, but in general Motion interpolation methods can have serious problems (look for edge morphing artifacts) ; so on other types of content it might not work as well

Code:
MPEG2Source("credits.sample.d2v", cpu=0)
Trim(3,0) #trim garbage at beginning because of the way the sample was cut
Main=last

Main
AssumeTFF()
TFM.TDecimate()
IVTC=last

Main
AssumeTFF
Crop(1200,0,0,0,true)
tdeint(mode=1, order=1, edeint=nnedi3(field=3))
SmoothFPS2(24000,1001)
#levels(0,1.5,255,0,255,true) #check right side
deint_rightcredit=last

IVTC
Crop(0,0,-720,0,true)
leftIVTC=last

stackhorizontal(leftIVTC, deint_rightcredit)

function SmoothFPS2(clip source, int num, int den) {
super = MSuper(source, pel=2, hpad=0, vpad=0, rfilter=4)
backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
MBlockFps(source, super, backward_3, forward_3, num, den, mode=0)
}
16. And personally I wouldn't use DSS2 for this or MPEG2 sources in general. There is a well known last frame bug (you always get 1 fewer frame) , and frame accuracy is dependent on container timestamps . I would use DGIndex or DGNVTools

Statistics