02.03.2024, 09:58
Hello Selur,
A lesson learnt from "vs-deoldify" it is that just a simple message raised by the vapoursynth script can break the pipe and stop the encoding.
In these days where are becoming available strong filters using IA, the probability these kind of problems can happen is becoming more frequent.
It can happen, like in " vs-codeformer " that the filter was developed for research and is plenty of "print()".
In this context "vsPipe" is not a suitable tool, because the "pipe" can be broken and nothing can done to recover from this error (not always it is possible to ask to the filter developer to fix the issue, like in "vs-codeformer").
Since you are not willing to apply the changes that I proposed for "vsViewer" and you don't want to use the vapoursynth enabled version of ffmpeg.
I'm asking you if you can add the support to "NVEncC -vpy".
I performed a simple test and it worked.
To perform the test I followed the folllowing steps:
1) installed the last version of NVEncC64.exe in "Hybrid\64bit\Vapoursynth" (because it need "VSScript.dll")
2) I wrote a simple Vapoursynth script: VideoBW_720p_10bit.vpy
3) Execute the following command
The final file was playable, so I think that the use of NVEncC with the option "-vpy" is worth your attention.
Please consider the possibility to enable it.
Thanks,
Dan
A lesson learnt from "vs-deoldify" it is that just a simple message raised by the vapoursynth script can break the pipe and stop the encoding.
In these days where are becoming available strong filters using IA, the probability these kind of problems can happen is becoming more frequent.
It can happen, like in " vs-codeformer " that the filter was developed for research and is plenty of "print()".
In this context "vsPipe" is not a suitable tool, because the "pipe" can be broken and nothing can done to recover from this error (not always it is possible to ask to the filter developer to fix the issue, like in "vs-codeformer").
Since you are not willing to apply the changes that I proposed for "vsViewer" and you don't want to use the vapoursynth enabled version of ffmpeg.
I'm asking you if you can add the support to "NVEncC -vpy".
I performed a simple test and it worked.
To perform the test I followed the folllowing steps:
1) installed the last version of NVEncC64.exe in "Hybrid\64bit\Vapoursynth" (because it need "VSScript.dll")
2) I wrote a simple Vapoursynth script: VideoBW_720p_10bit.vpy
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import site
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'D:/Programs/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="D:/Programs/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# current color space: YUV420P8, bit depth: 8, resolution: 1280x692, fps: 23.976, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709
clip = core.lsmas.LWLibavSource(source="VideoTest1_720p.mp4", format="YUV420P8", stream_index=0, cache=0, fpsnum=24000, fpsden=1001, prefer_hw=0)
frame = clip.get_frame(0)
# Setting detected color matrix (709).
clip = core.std.SetFrameProps(clip, _Matrix=1)
# Setting color transfer (709), if it is not set.
if '_Transfer' not in frame.props or not frame.props['_Transfer']:
clip = core.std.SetFrameProps(clip, _Transfer=1)
# Setting color primaries info (to 709), if it is not set.
if '_Primaries' not in frame.props or not frame.props['_Primaries']:
clip = core.std.SetFrameProps(clip, _Primaries=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# adjusting output color to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
clip.set_output()
3) Execute the following command
D:\PProjects\vs-deoldify_dev>"D:\Programs\Hybrid\64bit\Vapoursynth\NVEncC64.exe" --vpy -i VideoBW_720p_10bit.vpy --fps 23.976 --sar 1:1 --codec h265 --profile main10 --output-depth 10 --output-res 1280x692 --vbr 0 --vbr-quality 26.0 --aq --aq-strength 1 --output VideoBW_720p_10bit-1.hevc
--------------------------------------------------------------------------------
VideoBW_720p_10bit-1.hevc
--------------------------------------------------------------------------------
NVEncC (x64) 7.42 (r2750) by rigaya, Feb 27 2024 12:48:31 (VC 1929/Win)
OS Version Windows 10 x64 (19045) [UTF-8]
CPU Intel Core i9-10900 @ 2.80GHz [TB: 4.92GHz] (10C/20T)
GPU #0: NVIDIA GeForce RTX 3060 (3584 cores, 1837 MHz)[PCIe3x16][551.23]
NVENC / CUDA NVENC API 12.1, CUDA 12.4, schedule mode: auto
Input Buffers CUDA, 20 frames
Input Info VapourSynth r65(yv12(10bit))->p010 [AVX2], 1280x692, 24000/1001 fps
Vpp Filters copyHtoD
Output Info H.265/HEVC main10 @ Level auto
1280x692p 1:1 23.976fps (24000/1001fps)
Encoder Preset default
Rate Control VBR
Multipass none
Bitrate 0 kbps (Max: 11520 kbps)
Target Quality 26.00
Initial QP I:20 P:23 B:25
QP range I:0-63 P:0-63 B:0-63
QP Offset cb:0 cr:0
VBV buf size auto
Split Enc Mode auto
Lookahead off
GOP length 240 frames
B frames 3 frames [ref mode: disabled]
Ref frames 3 frames, MultiRef L0:auto L1:auto
AQ on (spatial, strength 1)
CU max / min auto / auto
Others mv:auto
encoded 2594 frames, 820.63 fps, 1358.66 kbps, 17.52 MB
encode time 0:00:03, CPU: 20.3%, GPU: 22.0%, VE: 74.8%, GPUClock: 1888MHz, VEClock: 1655MHz
frame type IDR 11
frame type I 11, total size 0.35 MB
frame type P 649, total size 8.53 MB
frame type B 1934, total size 8.64 MB
The final file was playable, so I think that the use of NVEncC with the option "-vpy" is worth your attention.
Please consider the possibility to enable it.
Thanks,
Dan