1

Topic: Deinterlace Stutter

Hello all. I'm hopeful you can help me get to the bottom of a deinterlacing oddity I'm experiencing.

What's happening is that I have some interlaced content I've captured (VHS source), and I'm trying to do a QTGMC/Bob deinterlacing using Hybrid. Things have mainly gone well, except I'm experiencing an odd jitter on content that has been deinterlaced. On closer examination, it appears that what's occurring is that the fields are occasionally being deinterlaced in the wrong order.

For example, if the proper frame order is...
1-2-3-4-5-6-7-8-9

It seems to be playing back something like...
1-2-3-4-3-4-7-8-9

I say something like that because I'm still not 100% sure what it's doing. At first I thought it might be something with my source content. However, when I use software like VLC to handle the Bob Deinterlacing on the fly, during a simple playback, it does so without issue. This weird stutter only seems to be happening with Hybrid handling the deinterlacing.

I'm running Hybrid version 2017.3.26.1.  I have some example content here I can show you.

Here is the source media...
https://od.lk/d/M18xNTc0MzAxMzVf/source.avi

Here is the MediaInfo on the source file...

General
Complete name               : D:\VHS Testing\2017.04.01\source.avi
Format                      : AVI
Format/Info                 : Audio Video Interleave
File size                   : 17.2 MiB
Duration                    : 2 s 540 ms
Overall bit rate            : 56.9 Mb/s

Video
ID                          : 0
Format                      : HuffYUV
Format version              : Version 2
Codec ID                    : HFYU
Duration                    : 2 s 503 ms
Bit rate                    : 56.2 Mb/s
Width                       : 720 pixels
Height                      : 480 pixels
Display aspect ratio        : 3:2
Frame rate                  : 29.970 (30000/1001) FPS
Standard                    : NTSC
Color space                 : YUV
Chroma subsampling          : 4:2:2
Bit depth                   : 8 bits
Scan type                   : Interlaced
Bits/(Pixel*Frame)          : 5.422
Stream size                 : 16.8 MiB (97%)

Audio
ID                          : 1
Format                      : PCM
Format settings, Endianness : Little
Format settings, Sign       : Signed
Codec ID                    : 1
Duration                    : 2 s 540 ms
Bit rate mode               : Constant
Bit rate                    : 1 536 kb/s
Channel(s)                  : 2 channels
Sampling rate               : 48.0 kHz
Bit depth                   : 16 bits
Stream size                 : 476 KiB (3%)
Alignment                   : Aligned on interleaves
Interleave, duration        : 10  ms (0.30 video frame)
Interleave, preload duratio : 79  ms

Because this forum apparently doesn't let you post more than one link in a single post (odd), I guess I'll include a link to the resulting media in a separate post.

Thanks for your help.
-= Brandon.

2

Re: Deinterlace Stutter

Here is the link to the resulting media (which is what is displaying the stuttering issue)...
https://od.lk/d/M18xNTc0MzA3NDdf/result.mp4

Here is the MediaInfo on the resulting file...

General
Complete name               : D:\VHS Testing\2017.04.01\result.mp4
Format                      : MPEG-4
Format profile              : JVT
Codec ID                    : avc1 (isom/avc1)
File size                   : 9.57 MiB
Duration                    : 2 s 502 ms
Overall bit rate            : 32.1 Mb/s
Encoded date                : UTC 2017-04-02 02:43:05
Tagged date                 : UTC 2017-04-02 02:43:05
Writing application         : Hybrid 2017.03.26.1

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High 4:2:2@L3.2
Format settings, CABAC      : Yes
Format settings, ReFrames   : 4 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 2 s 502 ms
Bit rate                    : 32.1 Mb/s
Nominal bit rate            : 30.0 Mb/s
Maximum bit rate            : 33.2 Mb/s
Width                       : 720 pixels
Height                      : 480 pixels
Display aspect ratio        : 3:2
Frame rate mode             : Constant
Frame rate                  : 59.940 (60000/1001) FPS
Original frame rate         : 59.940 (59940/1000) FPS
Color space                 : YUV
Chroma subsampling          : 4:2:2
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 1.548
Stream size                 : 9.57 MiB (100%)
Writing library             : x264 core 148 r2762 90a61ec
Encoding settings           : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x111 / me=hex / subme=5 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=0 / threads=12 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc=abr / mbtree=0 / bitrate=30000 / ratetol=2.0 / qcomp=0.50 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30 / aq=0
Encoded date                : UTC 2017-04-02 02:43:05
Tagged date                 : UTC 2017-04-02 02:43:06
Color range                 : Limited
Matrix coefficients         : BT.601

Watch the motion of the boy's legs in the back (that's actually me when I was 6!). You'll see as the legs are traveling up/down, it stutters. If you step through frame by frame, you'll see the out of order issue I'm referencing.

Thanks again,
-= Brandon.

3

Re: Deinterlace Stutter

Finally, for your reference, here are the deinterlace settings I'm using...

https://od.lk/s/M18xNTc0MzE5Mzhf/settings.png

I can confirm that the source media is bottom field first. I tried many variations of the settings above, and couldn't find a resolution to the issue.

Sorry for the multiple posts. Again, the forum wouldn't let me include this in the initial posting, as it regarded the image as an external link, which you can only include one per post.

-= Brandon.

4

Re: Deinterlace Stutter

My apologies for this being spread across several posts, but I thought I would include a log file as well.

Interesting thing happened when creating this. When I first replicated the issue, the resulting video file came out as only 4 frames long. Hmm. Then, without changing any settings aside from the output filename ("example2.mp4" instead of "example.mp4"), I ran the job again. This time it outputted like normal. The resulting file looked the same as "result.mp4" which I included earlier.

I've included in the attached zip, along with the debug log, the resulting 4 frame first file (in case that's helpful at all).

-= Brandon.

5

Re: Deinterlace Stutter

I see the stuttering, will look into it.
- problem isn't QTGMC since this happens with other deinterlacers too. (Tested TDeint, Yadif,
-> looking it smile

However, when I use software like VLC to handle the Bob Deinterlacing on the fly, during a simple playback, it does so without issue

When I play the file with vlc in Frame-by-Frame mode, vlc crashes. sad When I play the file with the normal mode and try to jump frame by frame through the clip the stutter seems to be compensated by duplicating the previous frames, so instead of a stutter one gets frozen frames.

-> from the looks of it this is a glitch in the source which different deinterlacers handle a bit different.

---

A decent 29.97fps output can be archived by using QTGMC with Bob enabled and Restore enabled and set to Frate 29.97.

6

Re: Deinterlace Stutter

Selur wrote:

When I play the file with vlc in Frame-by-Frame mode, vlc crashes. When I play the file with the normal mode and try to jump frame by frame through the clip the stutter seems to be compensated by duplicating the previous frames, so instead of a stutter one gets frozen frames.
-> from the looks of it this is a glitch in the source which different deinterlacers handle a bit different.

Really? That's quite interesting. I just checked again, advancing frame by frame in VLC, and was able to see a unique frame at every step. Just to clarify, I'm doing this with the source video, not the result video. In VLC I right-clicked on the video and chose Video->Deinterlace Mode->Bob. Next, I right-clicked and chose Video->Deinterlace->On. Then, I advanced frame by frame through the video (with the "E" key). At least on my system, every frame was unique. The problem didn't seem to show up until after re-encoding, and deinterlacing, through Hybrid.

Thanks so much for your help.
-= Brandon.

7

Re: Deinterlace Stutter

I too looked at the source sample. Using VLC 3.0.0 here.
-> no clue why avisynth has such problems with the source, BUT ...

Using Vapoursynth with QTGMC the output looks fine. -> switching to Vapoursynth should solve the problem. (will still look into the issue)

Cu Selur

8

Re: Deinterlace Stutter

Selur wrote:

Using Vapoursynth with QTGMC the output looks fine. -> switching to Vapoursynth should solve the problem.

Great. However, I don't actually know anything about Vapoursynth. Sorry. Does it integrate with Hybrid? How do I switch over to it?

-= Brandon.

9

Re: Deinterlace Stutter

Vapoursynth came with the last few Hybrid versions, to enable it you need to create a misc.ini file inside you Hybrid folder with the following content:

[General]
vapoursynth="true"

see: *hidden* Hybrid options,... and restart Hybrid.

Cu Selur

10

Re: Deinterlace Stutter

Found the problem with Avisynth is due to Hybrid telling the decoder to output 29.97 fps. Will look into that.

11

Re: Deinterlace Stutter

Great. Thanks.

Also, is it possible that when using Vapoursynth that the colorspace is not being preserved properly? My source media is YUY2, and though the output file is showing as YUY2, I'm noticing a small color shift (things go mildly green) in the output file. When I've seen this in the past, it's been the result of a colorspace change.

When I disabled deinterlacing, the color shift went away. Also, when using the Avisynth deinterlacing, I didn't notice a color shift there either, with identical settings (it had the frame stutter issue though of course). However, when using Vapoursynth deinterlacing, using the same settings as I posted earlier, the color shift occurs. Again, the resulting file does show as YUY2, it just appears that maybe it's being converted back and forth.

Attached are example images, pulled from the videos. You will see the color shift on the one resulting from the Vapoursynth deinterlacing.

Thank you again for your help,
-= Brandon.

Post's attachments

Attachment icon examples.zip 786.25 kb, 35 downloads since 2017-04-03 

12

Re: Deinterlace Stutter

I know how to fix the stuttering, but didn't have time to fix it so far. smile

13

Re: Deinterlace Stutter

That's great news. A fix to that would be great!

So, regarding the colorspace issue, are you basically just saying to wait for the stutter fix and use Avisynth instead?

-= Brandon.

14

Re: Deinterlace Stutter

No I say, I don't have the time atm. to look into it atm. and I won't look into it unless I fix the other bug first. Trying to look into different things at the same time always is a bad idea.

Cu Selur

15

Re: Deinterlace Stutter

Understood. Thanks for the clarification. Your help, and your terrific software, is very much appreciated.

-= Brandon.

16

Re: Deinterlace Stutter

btw. the suttering should be fixed in the current release, by not enforcing a specific frame rate from the source filter,....
Vapoursynth script should look similar to:

# Imports
import os
import sys
import ctypes
Dllref = ctypes.windll.LoadLibrary("G:/Hybrid/vsfilters/Support/libfftw3f-3.dll")
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("G:/Hybrid/vsfilters/Support/OpenCL.dll")
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/DenoiseFilter/FFT3DFilter/vsfft3dfilter.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/ResizeFilter/NNEDI3/libnnedi3.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/temporalsoften.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="G:/Hybrid/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import havsfunc as havsfunc
# Loading C:\Users\Selur\Desktop\source.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/source.avi", format="YUV422P8", cache=0)
clip = core.resize.Point(clip, matrix_in_s="470bg")
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# setting field order to what QTGMC should assume
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False)
# Output
clip.set_output()

Cu Selur