Log in

View Full Version : QTGMC weird frame repetition


TalasNetrag
19th February 2015, 20:23
Hi,

I am trying to encode an interlaced PAL DVD source with StaxRip.
For deinterlacing I use QTGMC. But sometimes some frames get repeated a couple millisecond later. This seems to happen at random, during panning scenes, still scenes or scene changes.

My Avisynth script:

SetMTMode(5, 4)
FFVideoSource("MyFile.mkv")
ConvertToYV12()
AssumeFPS(25.000000)
SetMTMode(2)
QTGMC(Preset="Slower", EdiThreads=2)
SelectEven()
UnDot()


Encoded example with the issue:
http://www.mediafire.com/download/6ylf8go63ar5t7n/title01_new2_new.mkv

I hope you can help me with this issue.

Greetings,
TalasNetrag

johnmeyer
19th February 2015, 20:36
A few thoughts ...

If you look at the original source with bob() or separatefields(), is it clean (i.e., no blended fields)? Do you have the field order of the original clip correct? Is the source really 25 fps (check using Mediainfo).

It would be interesting to see the same section of the original clip. I'm guessing that it has a very irregular pulldown pattern. QTGMC does not remove pulldown fields; it is instead a deinterlacer. Many people get these two things confused, but they are really quite different.

StainlessS
19th February 2015, 21:08
Also might like to try after conversion to AVI (lossless HUFFYUV or UT_VIDEO) and with Avisource, I cant help but suspect FFVideoSource as I have had
out of order frames from it on more than one occasion, at least it would discount that as a problem.

EDIT: Most solid converter I know of (ffmpeg)
bat file

setlocal

REM Where to Find ffmpeg
set FFMPEG="C:\BIN\ffmpeg.exe"

REM Where to get input file, No terminating Backslash, "." = current directory
set INDIR="."

REM Where to place output file, No terminating Backslash.
set OUTDIR="D:\AVS\AVI"

FOR %%A IN (*.wmv *.mpg *.avi *.flv *.mov *.mp4 *.m4v *.RAM *.RM *.mkv *.TS *.y4m *.yuv) DO (
%FFMPEG% -i "%INDIR%\%%A" -vcodec utvideo -acodec pcm_s16le "%OUTDIR%\%%~nxA.AVI"

)

Pause


swap utvideo to huffyuv if required.

Source files in current dir (ie '.', same dir as bat file) and out to "D:\AVS\AVI".

And get rid of MT, narrow down the problem.

Stormborec
19th February 2015, 22:58
What about assumetff (assumebff) ... hm random ... try just directshowsource >>> lagarith >>> avi, or try single thread ...

TalasNetrag
19th February 2015, 23:18
If you look at the original source with bob() or separatefields(), is it clean (i.e., no blended fields)?

I would say its clean, but I am also not sure what classifies as a blended field (new to Avisynth).

Do you have the field order of the original clip correct?

Dont know how to check or set this.

Is the source really 25 fps (check using Mediainfo)

Yes:

Video
ID : 1
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=12
Format settings, picture struc : Frame
Codec ID : V_MPEG2
Codec ID/Info : MPEG 1 or 2 Video
Duration : 3s 360ms
Bit rate mode : Variable
Bit rate : 4 700 Kbps
Maximum bit rate : 7 870 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
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.453
Time code of first frame : 10:33:07:07
Time code source : Group of pictures header
GOP, Open/Closed : Closed
Stream size : 1.88 MiB (98%)
Language : English
Default : No
Forced : No
DURATION : 00:00:03.360000000
NUMBER_OF_FRAMES : 84
NUMBER_OF_BYTES : 2007350
_STATISTICS_WRITING_APP : mkvmerge v7.5.0 ('Glass Culture') 64bit built on Jan 4 2015 16:48:44
_STATISTICS_WRITING_DATE_UTC : 2015-02-19 21:46:05
_STATISTICS_TAGS : BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES


It would be interesting to see the same section of the original clip.

Here:
http://www.mediafire.com/download/ldwju7e87ai7n1o/title01+%281%29.mkv

Also might like to try after conversion to AVI (lossless HUFFYUV or UT_VIDEO) and with Avisource, I cant help but suspect FFVideoSource as I have had
out of order frames from it on more than one occasion, at least it would discount that as a problem.

Do you mean save as uncompressed AVI file and open with AVIFileSource()? Would DirectShowSource() be enouth to discount FFVideoSource?

StainlessS
19th February 2015, 23:40
Just say no to DirectShowSource, there is nothing worse.

Use the bat file given, (assuming you have ffmpeg), it will save it as UTVideo (if you have that codec) or change the 'utvideo' text in bat to 'huffyuv',
(if you have that codec), make sure the BIN and output dir are set correct, copy bat into same dir as clip and run it.
You want to save it to a lossless codec, not uncompressed.

And then AviSource("Myfile.avi")

EDIT: You dont need the utvideo codec to use ffmpeg, but you would to load with avisource.

stax76
20th February 2015, 09:08
What's the point of using a lossless codec here? If ffms2 has a bug then converting with ffmpeg might have it too, after all ffms2 is based on ffmpeg. There is a mkvextract GUI called gMKVExtractGUI (http://forum.doom9.org/showthread.php?t=170249&highlight=mkvextract), this should allow to completely demux the mkv file, it should save the video as MPEG-2 program stream with mpv or m2v extension and this can be processed with DGMPGDec, StaxRip will still handle m2v by default with good old DGMPGDec. I believe DGMPGDec is generally more mature to process DVDs compared to ffms2 so StaxRip might extract m2v from mkv by default in the future.

kuchikirukia
20th February 2015, 09:40
Try
TDeint(mode=1)
srestore()

Groucho2004
20th February 2015, 09:47
What's the point of using a lossless codec here?
Yeah, I was wondering about that myself.

@TalasNetrag
You need to get a proper workflow in place:
1. Follow the advice here (http://neuron2.net/faq.html#analysis) in order to load your source video and determine its properties ("How do I figure out the nature of my source video?", "How do I figure out the field order of my video?").
2. Put the QTGMC() statement in your script but don't use SetMTMode yet in order to exclude potential problems with multi-threading.

If that produces satisfactory results, try SetMTMode to speed up the process.

wonkey_monkey
20th February 2015, 15:45
What's the point of using a lossless codec here? If ffms2 has a bug then converting with ffmpeg might have it too, after all ffms2 is based on ffmpeg.

ffms2 has accuracy problems with random (that is to say, non-linear) access of MPEG2 video frames, such as can be caused by fancy-pants AviSynth scripts, but not with linear access, as would be the case when doing a straight re-encode.

TalasNetrag
20th February 2015, 18:01
I followed the instructions in the FAQ and determined that the source is indeed:
1. 25 fps
2. Top field first
3. Has blended fields (I suppose this is how blended fields look like)

https://www.mediafire.com/convkey/e9c0/86vbpdzlptb72dj6g.jpg

https://www.mediafire.com/convkey/62b4/ydy9q850s93mhrr6g.jpg

So I tried to adjust the the script according to the suggestions:
1. Don't use FFVideoSource
2. AssumeTFF()
3. No MT
And ecoded one episode with this script:

MPEG2Source("MySource.d2v")
ConvertToYV12()
AssumeTFF()
QTGMC(Preset="Slower")
SelectEven()
UnDot()

The resulting Video has no issues!
Next I try to encode with MT.

Btw, gMKVExtractGUI doesn't save MPEG-2 program stream with mpv or m2v extension but with mpg instead. But that didn't bother GDIndex.

Edit: The video encoded with MT also has no issues, so I assume the problem is FFVideoSource (or missing AssumeTFF?).

Groucho2004
20th February 2015, 18:23
If you have blended fields you should try srestore (http://avisynth.nl/index.php/Srestore) as mentioned above.

creaothceann
21st February 2015, 11:12
Remastered NGE will be released at some point, btw. (http://io9.com/the-original-evangelion-tv-series-is-finally-coming-to-1665689931)