#1  
04-28-2020, 01:31 PM
Nik92 Nik92 is offline
Free Member
 
Join Date: Apr 2020
Posts: 5
Thanked 0 Times in 0 Posts
Hi All,

My goal is to deinterlace avi file (HuffYUV codec) with Avisynth+ QTGMC and to encode it to H264 using FFmpeg.

Avisynth script:
Code:
SetFilterMTMode("QTGMC",2)
FFmpegSource2("VHS_HUFF_trunc.avi",atrack=1)
AssumeTFF()
QTGMC(Preset="Draft",Edithreads=3,NoiseProcess=0)
Prefetch(threads=10)
FFmpeg:
Code:
ffmpeg -i "VHS_deinterlace.avs" -c:v libx264 -crf 30 -preset ultrafast -c:a aac -b:a 192k "VHS1_H264.mkv"
The issue is that audio is out of sync.
In the beginning it's not very noticeable but closer to the end audio is ahead by a few seconds.
No such issue on the source file or when souce file is encoded without avisynth.

I tried to figure out the reason and I found that Media Player Classic provides this info on the source file (Ctrl + G):
Duration: 03:32:56.200
Total frames: 319405
FPS: 25

And on deinterlaced file encoded to H264:
Duration: 03:32:55.972
Total frames: 638017
FPS: 49.939

I don't know if this method to count frames by MPC is legit but it looks like avisynth dropped some frames.
Since QTGMC is doubling frames by default, I'd expect double amount of original wich would be 638 810.
But output from avisynth is by 793 frames less than expected.
So presumably about 396 frames from original video are dropped.

Could audio be out of sync due to this?

I've also tried the following:
1. Set FPS to 25 as for some reason avisynth identifies source as 24.97 FPS by default:
Code:
SetFilterMTMode("QTGMC",2)
FFmpegSource2("VHS_HUFF_trunc.avi",atrack=1)
AssumeTFF()
AssumeFPS(25,1,true)
QTGMC(Preset="Draft",Edithreads=3,NoiseProcess=0)
Prefetch(threads=10)
With this, FPS on H264 file is 50 but amount of frames is the same.
Video delay from audio is much worse as video just plays faster.

2. Disable doubling frame rate by QTGMC:
Code:
SetFilterMTMode("QTGMC",2)
FFmpegSource2("VHS_HUFF_trunc.avi",atrack=1)
AssumeTFF()
QTGMC(Preset="Draft",Edithreads=3,NoiseProcess=0,FPSDivisor=2)
Prefetch(threads=10)
The same delay as with default settings and less frames (319009) compared to the original file.

Could you please advise on how to sync audio?

P.S.
I use "Draft" just for testing, the issue was the same on "Very Slow".

Thanks
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
04-29-2020, 03:36 AM
themaster1 themaster1 is offline
Free Member
 
Join Date: Feb 2011
Posts: 311
Thanked 76 Times in 62 Posts
you have forgotten selecteven after qtgmc it seems

qtgmc() # deinterlace in 50 fps
selecteven # back to 25 fps
Reply With Quote
  #3  
04-29-2020, 04:53 AM
Nik92 Nik92 is offline
Free Member
 
Join Date: Apr 2020
Posts: 5
Thanked 0 Times in 0 Posts
With selecteven() avisynth drops frames too.
Besides, after deinterlace I want fps 50, not 25.

I was able to find out what cause the issue:
Code:
FFmpegSource2("VHS_HUFF_trunc.avi")
If avi is HuffYUV then avisynth drops frames.

No dropped frames when using AVISource:
Code:
AVISource("VHS_HUFF_trunc.avi")
Also no dropped frames with FFmpegSource2 if video is encoded as FFV1.

I've no idea why FFmpegSource2 works incorrectly with HuffYUV.
Considering that in my workflow I have FFV1 for archive, I'll use this instead of source HuffYUV or just AVISource instead of FFmpegSource2.

Thanks
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Recommended PC Hardware for AviSynth and QTGMC JPMedia Restore, Filter, Improve Quality 1 03-15-2019 01:12 PM
QTGMC repeating frames on MP4 in Avisynth? Master Tape Restore, Filter, Improve Quality 8 06-30-2018 02:40 AM
Broken index with VirtualDub when capturing Avisynth (QTGMC) Kugelfang Restore, Filter, Improve Quality 13 12-06-2015 10:56 AM
Avisynth script for QTGMC, encode x264 - no video after deinterlace? mo418 Capture, Record, Transfer 18 09-16-2015 01:06 PM
QTGMC How-to: Help deinterlacing with Avisynth Joekster Restore, Filter, Improve Quality 1 12-22-2011 04:27 PM

Thread Tools



 
All times are GMT -5. The time now is 05:19 AM