chapter selection ignored when using vapoursynth
#1
I noticed an issue here when using vapoursynth. When a dependent filter is enabled with chapter/cut selection, it looks like the frame selection range isn't being passed. Maybe a solution is a little quick math based on length of chapters and framerate (or timecodes?) to get start offset and framecount? vspipe has -start and -end parameters that might work. I use the chapter selection feature a lot to test settings before committing to a long encoding session.

without vapoursynth

Quote:ffmpeg -y -loglevel fatal -noautorotate -threads 8 -i "D:\rips\STARGATE_THE_ARK_OF_TRUTH_t00.mkv" -map 0:0 -an -sn -t 00:03:50.563 -vf zscale=rangein=tv:range=tv -pix_fmt yuv420p -vsync 0  -f rawvideo - | x264 --preset veryfast --pass 1 --bitrate 1500 --profile high --level 4.1 --direct auto --b-adapt 0 --sync-lookahead 33 --qcomp 0.5 --rc-lookahead 40 --qpmax 81 --aq-mode 0 --sar 1:1 --qpfile "D:\temp\STARGATE_THE_ARK_OF_TRUTH_t00_18_47_55_8510_06.qp" --non-deterministic --range tv --stats "D:\temp\STARGATE_THE_ARK_OF_TRUTH_t00_18_47_55_8510_07.stats" --demuxer raw --input-res 1920x1080 --input-csp i420 --input-range tv --input-depth 8 --fps 24000/1001 --output-depth 8 --output NUL -


with vapoursynth

Quote:vspipe "D:\temp\encodingTempSynthSkript_18_49_54_0310.vpy" - --y4m | x264 --preset veryfast --pass 1 --bitrate 1500 --profile high --level 4.1 --direct auto --b-adapt 0 --sync-lookahead 33 --qcomp 0.5 --rc-lookahead 40 --qpmax 81 --aq-mode 0 --sar 1:1 --qpfile "D:\temp\STARGATE_THE_ARK_OF_TRUTH_t00_18_49_54_0310_07.qp" --non-deterministic --range tv --stats "D:\temp\STARGATE_THE_ARK_OF_TRUTH_t00_18_49_54_0310_08.stats" --demuxer y4m  --input-range tv --fps 24000/1001 --output-depth 8 --output NUL -


Log also attached. I didn't have time to run a complete job with vapoursynth, so I let it run for a bit then canceled.


Attached Files
.7z   log.7z (Size: 47,04 KB / Downloads: 2)
Reply
#2
Okay, I see the problem.
Using start&end in Vapoursynth isn't a solutions since "timecode -> frame number"-conversion is only useful when using cfr (cutting&co will also fail if vfr) and might be inaccurate (adding delays; audio would still be cut by time).

When adding the 'trim()' to Vapoursynth this would still be true, so only real solution would be cut before the conversion, problem there is that cutting the source might:
a. be inaccurate if the source doesn't have a key-frame at the start
b. might potentially create humongous intermediate files

I'll probably disable the "split/encode by chapter" option when Vapoursynth (same for Avisynth) is used, since I don't see a reliable way to do this atm. .

Cu Selur
Reply
#3
That would be unfortunate. Maybe just disable it if vfr is forced?
Reply
#4
I send you a link (via PM) to a dev version for testing which should add Trim(..) when using chapters.

Cu Selur
Reply
#5
Hey, thanks for the test build..

VIVTC vapoursynth works, but QTGMC does not.  I get:

2019.09.14 - 18:31:52_Windows 10-64bit_2019.09.14.1 - level 9: x264 output: y4m [error]: bad sequence header magic
log attached as well.


Attached Files
.7z   HybridDebugOutput.7z (Size: 9,25 KB / Downloads: 2)
Reply
#6
Looking at the Vapoursynth script:
# Imports
import os
import sys
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'C:/utils/video/Hybrid/Hybrid/64bit/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/Support/EEDI3.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/Support/temporalsoften.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/utils/video/Hybrid/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/d2vsource.dll")
# Import scripts
import havsfunc
# Loading D:\rips\standa\VIDEO_TS using D2VSource
clip = core.d2v.Source(input="D:/temp/18_31_50_3010.d2v")
# making sure input color matrix is set as 709
clip = core.resize.Point(clip, matrix_in_s="709",range_s="limited")
# making sure frame rate is set to 29.97
clip = core.std.AssumeFPS(clip, fpsnum=30000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# cutting from 0 with 12748 frames - WARNING: This might cause synch issues
clip = core.std.Trim(clip=clip, first=0, length=12748)
# 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)
clip = clip[::2]
# Output
clip.set_output()
I see no direct problem.
-> Does the Vapoursynth Preview work properly?
(side note: most NTSC DVDs should not be handled with QTGMC since it's meant for interlaced not telecine content)

The encoding call:
"C:\utils\video\Hybrid\Hybrid\64bit\VAPOUR~1\vspipe.exe" "D:\temp\encodingTempSynthSkript_18_31_50_3010.vpy" - --y4m | "C:\utils\video\Hybrid\Hybrid\64bit\x264.exe" --preset veryfast --pass 1 --bitrate 1500 --profile high --level 4.1 --direct auto --b-adapt 0 --sync-lookahead 33 --qcomp 0.5 --rc-lookahead 40 --qpmax 81 --aq-mode 0 --sar 8:9 --non-deterministic --range tv --stats "D:\temp\DVD_new_new_new_18_31_50_3010_03.stats" --demuxer y4m  --input-range tv --fps 30000/1001 --output-depth 8 --output NUL -
looks fine too, but judging from the error message there is some problem witht he Vapoursynth script.

I tried to reproduce the issue here, but couldn't.

Cu Selur
Reply
#7
I think this is just a badly mastered dvd.  Different scenes hold at different rates, some at 23.97, others at 29.97.. MPC-HC shows the mpeg2 is flagged at 29970/1000 instead of 30000/1001. Not sure what that's about..

I wanted to use QTGMC to try to retain the original frame pacing.  Detelecine to 23.976 makes the 29.97 parts judder pretty badly.

In addition to the dvd structure, I also tried feeding hybrid a makemkv rip of the same content.  The container format ended up being flagged at ~24.6fps (I assume the avg of the vfr?).  If I did not have the 'prefer original framerate' flag set, the detelecine decimate at ~19fps.

I ran a pass with the official hybrid release 2019.08.26 and QTGMC. It didn't do what I want (now the 23.976 scenes are juddery), but it does not crash. Log attached.

I tried reinstalling the dev build to a clean directory. No change.


Attached Files
.7z   HybridDebugOutput.7z (Size: 30,97 KB / Downloads: 2)
Reply
#8
Mixed content progressive/telecine/interlaced should not cause a crash.
(how to handle the content properly is another thing)
Looking at the debug output, there is no crash.
Only thing I see is a warning from MP4Box that an invalid language flag was used.
MP4Box output: The given code is not a valid one: unden, using 'und' as 3-letter code
Saving D:\out\15_37_41_7410__10.mp4: 0.500 secs Interleaving
No crash/error reports, according to the log D:\out\DVD_new.mp4 was created and should 2133.66 MB in size.

Cu Selur
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)