Log in

View Full Version : deinterlace VHS captured video by doubling framerate (bob)


slipknot!
21st September 2014, 10:31
Hi guys what's up! I have an old VHS captured and stored on my PC and it's interlaced. I'm using megui and Yadif (bob), but it results in only 25 fps, not 50. Please help me.

Here's my AVS script which I got from megui:
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("D:\fraps\nadya1.d2v", info=3)
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\ColorMatrix.dll")
ColorMatrix(hints=true, interlaced=true, threads=0)
Load_Stdcall_Plugin("C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\yadif.dll")
Yadif(mode=1, order=1)
crop(14, 0, -2, -4)
#resize
#denoise

Mediainfo of the source video:
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : M=3, N=12
Format settings, picture structure : Frame
Duration : 14mn 43s
Bit rate : 8 000 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
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.772
Time code of first frame : 00:14:44:20
Time code source : Group of pictures header
Stream size : 841 MiB (82%)

Here's a sample of the video:
mirror1, mediafire (http://www.mediafire.com/download/9tpyen47dajdp2m/sample.mkv[/url)
mirror2, yandex (https://yadi.sk/i/pSjT6xW8badD7)

PS: any thoughts on x264 settings? I think automated 3 pass placebo with 3k bitrate would be an overkill even for 50 fps, right? I have a fast CPU, so encoding time is not a problem.

TheSkiller
21st September 2014, 11:42
1) You don't need ColorMatrix here at all.
Edit: Assuming you are not resizing to something like 720p or 1080p.

2) Your Mediainfo Log shows the obvious – your source video is 25 fps interlaced. There is nothing wrong with that.

So within those interlaced 25 fps there are 50 fields per second which Yadif bob-deinterlaces to 50 frames per second. So Yadif(mode=1, order=1) is correct.


3) Regarding x264, unless you need to hit a specific file size, opt for CRF encoding instead of multipass.

4) I'm pretty certain 3000 Kbit/s is not enough for this video anyway if you're aiming for transparent results (just use CRF mode). 3000 Kbit/s is not remotely overkill, Placebo preset is.

hello_hello
21st September 2014, 11:59
Hi guys what's up! I have an old VHS captured and stored on my PC and it's interlaced. I'm using megui and Yadif (bob), but it results in only 25 fps, not 50. Please help me.

I downloaded your sample, remuxed it as a TS file with TSMuxer, opened the TS file and indexed it with MeGUI/DGIndex. With the de-interlacing set to Yadif, the total frame count, according to MeGUI's preview, is 2625. Changing it to "Yadif with Bob" and selecting "preview AVS script" takes the frame count to 5251. The output is 50fps.

If you're serious about the deinterlacing..... QTGMC (http://forum.doom9.org/showthread.php?t=156028).

PS: any thoughts on x264 settings? I think automated 3 pass placebo with 3k bitrate would be an overkill even for 50 fps, right? I have a fast CPU, so encoding time is not a problem.

CRF encoding? Pick the quality, not the bitrate.
You'll find with CRF encoding, the bitrate for a given CRF value doesn't increase all that much for 50fps compared to 25fps.
I think it's because the encoder is "frame rate aware".

LoadPlugin("C:\Program Files\MeGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("D:\sample.d2v")
QTGMC()
crop(20, 6, -18, -10)
Spline36Resize(640,480)

The cropping and resizing isn't necessarily supposed to be ideal. It's just to make some small samples.
YADIF v QTGMC 50fps.zip (http://speedy.sh/2569C/YADIF-v-QTGMC-50fps.zip) (use the "slow download" button)

YADIF 50fps = 5692 kbps (CRF18)
QTGMC 50fps = 3797 kbps (CRF18)

Sharc
21st September 2014, 12:08
Hummm.., the sample.mkv is 50 interlaced frames per second and 100 fields per second. Strange ...

Edit:
Sorry, my bad. After demuxing the .mpv video is 25 interlaced frames per second and 50 fields per second.

slipknot!
21st September 2014, 12:13
TheSkiller, thank you for your reply! No I'm not resizing the video, it's very poor quality already. Only cropping black bars from the edges. The footage is from 1994 VHS. I removed color correction tick from megui, that was enabling the color matrix I think.
So I'm going to use CRF 16 and see what overall bitrate it results in. I still have time until 25th of Sep, so I will be trying different methods.

hello_hello
21st September 2014, 12:48
If you're not resizing, have you enabled MeGUI's anamorphic encoding option? The correct display aspect ratio will be added to the top of the script when you do. I assumed you didn't copy and paste that part of the script, but I thought maybe I should ask.

If it's enabled, and the Input DAR in the script creator is set to "ITU 4:3 PAL" (which I think it should be in your case), you should end up with this at the top of the script before you do any cropping:

# Set DAR in encoder to 160 : 117. The following line is for automatic signalling
global MeGUI_darx = 160
global MeGUI_dary = 117

The "encode non-mod16" anamorphic option just encodes the video "as-is" after cropping (while setting the correct aspect ratio). It doesn't adjust the cropping automatically or allow you to resize.

There's a setting in the Avisynth profile configuration called "acceptable aspect error". For reasons I'm not sure I understand, it's set to 1% by default. Changing it to 0% will stop MeGUI from fudging the aspect ratio at all when using anamorphic encoding.

If you're setting the correct aspect ratio yourself in MeGUI's x264 encoder configuration, you can ignore the above, but it's generally easier to let MeGUI do it.

MeGUI's colour correction option does add the colormatrix stuff to the script. It wouldn't be doing any harm in your case, but generally it's a waste of time.
http://forum.doom9.org/showthread.php?p=1650435

slipknot!
21st September 2014, 17:39
I deleted avisynth + megui and made a fresh install of avisynth 1.6 and megui 2507. Then copied QTGMC 3.32 w plugins as explained here (http://forum.doom9.org/showthread.php?t=156028). And when I load this simple script:
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("D:\fraps\test.d2v")
QTGMC()

I get this error:
http://s017.radikal.ru/i403/1409/25/6f3a161076b4.png
it doesn't like line3, where QTGMC is mentioned. If I remove the line, then it loads OK.

Asmodian
21st September 2014, 18:29
That looks like something is wrong with the plugins required by QTGMC, double check versions and dependencies (some require extra dlls). I also assume you meant Avisynth 2.6 instead of 1.6. Try the newest alpha5 if that isn't the one you installed.

hello_hello
21st September 2014, 18:30
I assume you meant you installed Avisynth 2.6? Single or multi-threaded version? Which plugins? Normal or modded?

MeGUI comes with it's own portable version of Avisynth. I think it uses that version by default. Did you change that? If not, let it for the moment. It shouldn't matter. MeGUI uses Avisynth+ portable, which should work fine with QTGMC (it does for me).
If you install Avisynth 2.6 alpha 5, you should be able to use either the installed Avisynth or the portable Avisynth+ with the same plugins.

To be honest, you're just going through the same process we all went through when first installing QTGMC. Trying to work out what we did wrong and why it doesn't work. Once it works, it'll keep working. ;)

You put "mt_masktools-26.dll" in the Avisynth plugins folder? You want to use "mt_masktools-26.dll" or "mt_masktools-25.dll", depending on your Avisynth version. Not both. Whichever you use, copy it to the main plugins folder (don't leave it inside the folder it's originally in).
The two files in the "32-bit system dlls" folder in the zip file, you put them in the correct place?
Those seem like the likely candidates. If not, go through the instructions again....... :)