Posts: 52
Threads: 11
Joined: Nov 2023
Hello,
My encoding is crashing for no reason I can seem to figure out. I have not made any changes to my defaults and such. So, I don't know what the deal is. I am also wondering if it is related to Vapoursynth, as it seems I've been having some stutter-y deinterlacing recently. But I can't confirm that yet. Just a hunch.
Anyway, all I'm trying to do is de-interlace a VHS capture, while using cut support and cropping, and encoding it into an MKV via x264. Here is the debug file.
Posts: 10.553
Threads: 57
Joined: May 2017
During the analysis FFmpeg reports some unknown data in the video header data:
Unknown extra header dump: [2] [10] [0] [0] [42] [25] [26] [47] [68] [c9] [a] [9] [b] [b] [c] [9] [d] [9] [e] [9] [f] [8] [10] [9] [d1] [32] [31] [d2] [53] [34] [53] [74] [35] [37] [36] [37] [38] [59] [7a] [38] [37] [38] [79] [3a] [39] [3a] [59] [58] [39] [38] [37] [58] [39] [78] [59] [5a] [98] [79] [3a] [39] [38] [37] [56] [35] [36] [35] [36] [35] [34] [35] [74] [73] [12] [8] [11] [8] [10] [8] [f] [9] [ee] [d] [9] [c] [a] [b] [b] [ea] [c9] [88] [67] [26] [24] [22] [42] [24] [26] [28] [2a] [2b] [2c] [2d] [2e] [2f] [30] [51] [32] [73] [74] [35] [34] [95] [54] [55] [36] [37] [19] [19] [1a] [8c] [19] [10] [58] [39] [38] [37] [38] [76] [75] [14] [a] [93] [72] [31] [50] [2f] [4e] [2c] [2b] [2a] [27] [25] [23] [22] [21] [23] [25] [27] [28] [29] [4b] [2c] [4d] [2e] [4f] [70] [71] [52] [94] [35] [39] [38] [59] [38] [19] [b8] [38] [19] [c] [38] [39] [58] [36] [37] [35] [54] [33] [52] [31] [30] [4f] [2e] [2d] [4c] [2b] [2a] [29] [28] [27] [24] [22] [0]
x264 reports: "y4m [error]: bad sequence header magic" which usually indicates some problem with the Vapoursynth script.
Does the Vapoursynth Preview work?
The Vapoursynth script itself seems fine:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("C:/Program Files/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import havsfunc
import validate
# Source: 'F:\Captures\Uninvited.avi'
# Current color space: YUV422P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg
# Loading F:\Captures\Uninvited.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/Captures/Uninvited.avi", format="YUV422P8", stream_index=0, cache=0, fpsnum=30000, fpsden=1001, prefer_hw=0)
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
# setting color primaries info (to 470), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
# making sure frame rate is set to 29.97fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=2) # tff
# cutting from frame 509 to 164444 - WARNING: This might cause synch issues
clip = core.std.Trim(clip=clip, first=509, last=164444)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Faster", TFF=True) # new fps: 29.97
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
clip = clip[::2] # selecting previously even frames
clip = core.std.CropRel(clip=clip, left=0, right=18, top=0, bottom=12)# cropping to 702x468
# letterboxing 702x468 to 720x480
clip = core.std.AddBorders(clip=clip, left=9, right=9, top=6, bottom=6)
# set output frame rate to 29.97fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# output
clip.set_output()
One thing you can try, assuming you got a vfw version of the codec installed which the source was captured, is to enable: F"iltering->Vapoursynth->Misc->Source->Prefer AviSource for .avi input". This way Hybrid will use AviSource assuming the right vfw codec is installed.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 52
Threads: 11
Joined: Nov 2023
Sorry for the late reply.
No, sometimes the Vapoursynth preview does not pop up.
After applying the suggested setting, it still crashes on the same step. Debug attached.
Also, after I made that change, it took much longer to extract the wav/pcm audio. Like, considerably longer than usual.
Posts: 10.553
Threads: 57
Joined: May 2017
Vapoursynth settings have nothing to do with audio extraction. Maybe some over active virus scanner or similar at work?
Vapoursynth script, now uses AviSource as expected:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("C:/Program Files/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/AviSource/avisource.dll")
# Import scripts
import havsfunc
import validate
# Source: 'F:\Captures\Uninvited.avi'
# Current color space: YUV422P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg
# Loading F:\Captures\Uninvited.avi using VsAviSource
clip = core.avisource.AVISource(path="F:/Captures/Uninvited.avi")
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
# setting color primaries info (to 470), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
# making sure frame rate is set to 29.97fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=2) # tff
# cutting from frame 509 to 164444 - WARNING: This might cause synch issues
clip = core.std.Trim(clip=clip, first=509, last=164444)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Faster", TFF=True) # new fps: 29.97
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
clip = clip[::2] # selecting previously even frames
clip = core.std.CropRel(clip=clip, left=0, right=18, top=0, bottom=12)# cropping to 702x468
# letterboxing 702x468 to 720x480
clip = core.std.AddBorders(clip=clip, left=9, right=9, top=6, bottom=6)
# set output frame rate to 29.97fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# output
clip.set_output()
=> try whether adjusting the crop values, so that the width is mod4, not just mod2, helps.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 52
Threads: 11
Joined: Nov 2023
My crops are mod 4 (multiples of 4, correct?). Are you also referring to my letterbox borders?
Posts: 10.553
Threads: 57
Joined: May 2017
Sorry, yes.
I suspect the problem is with:
# letterboxing 702x468 to 720x480
clip = core.std.AddBorders(clip=clip, left=9, right=9, top=6, bottom=6)
If this is the case, I can probably write a workaround, by making sure the content is converted to YUV444 beforehand and converted to YUV422 afterwards.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 52
Threads: 11
Joined: Nov 2023
Sorry, I was wrong. I deleted my comment as soon as I wrote it. Eighteen is definitely not a multiple of four. 😅 I am tired. I changed it from 18 to 16 and it has started encoding at least.
Posts: 10.553
Threads: 57
Joined: May 2017
I restored your post.
I did a small test and from the looks of it, the problem is the AddBorders.
I assumed AddBorders with YUV422 would allow uneven left&right, assuming the sum is even again, which it does not.
=> send you a link to a dev version which should fix the problem. (by doing the mentioned YUV422=>YUV444=>letterbox=>YUV422 trip)
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 52
Threads: 11
Joined: Nov 2023
Sounds good. In the meantime, changing the 18 to a 16 did the trick (and then splitting it to 8 and 8 instead of 9 and 9). I will have to give the dev version a try to see if I can use odd numbered crop settings.
Thank you!
Posts: 10.553
Threads: 57
Joined: May 2017
Ok, let me know how it works out.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
|