GeoffreyA
5th July 2024, 10:48
Greetings. I hope you're all well.
This is my first post, though I've been reading Doom9 for years and first came across the site in 2004, when I was a teenager embarking on the wonderful world of video encoding in the DVD and MPEG-4 ASP era. Discovering FFmpeg in 2018 reignited my fondness for this field, and I've had nothing but praise for FFmpeg and its maintainers: it was startling how a single tool could do so much, in contrast to the old days when everything seemed a fragmented mess. Recently, tackling the encoding of anime with AV1, I've had trouble with banding, and FFmpeg's deband filter wasn't helping. Long story short, I ended up with VapourSynth rather than AviSynth because I found the former somewhat more intuitive and, more importantly, got it working.
The neo_f3kdb filter did an excellent job, and I didn't need to denoise, degrain, or mask. Before I encode, I thought I'd post my script here and check with the pros whether everything was all right, according to VS conventions, and that nothing was missing. My process is to use a batch file that iterates over the MKV files, passing the script and videos to VSPipe; the script runs, debanding; and the raw data is piped to FFmpeg, where it is encoded with AV1 in two passes. Here is the script:
from vapoursynth import core
clip = core.lsmas.LWLibavSource(filename)
clip = core.fmtc.bitdepth(clip, bits=16)
clip = core.neo_f3kdb.Deband(clip, keep_tv_range=True, output_depth=16)
clip = core.fmtc.bitdepth(clip, bits=10)
clip.set_output()
And the Windows batch file:
mkdir "out"
setlocal
set vscript=Script.vpy
set vspath=D:\Stuff\Movie Tools\Conversion\VapourSynth
set param1=-c:v libaom-av1 -cpu-used 3 -arnr-strength 0 -crf 16 -b:v 0 -g 240
for %%i in (*.mkv) do (
"%vspath%\vspipe" -c y4m "%~dp0%vscript%" - -a filename="%~dp0%%i" | ffmpeg -i - %param1% -pass 1 -f null -
"%vspath%\vspipe" -c y4m "%~dp0%vscript%" - -a filename="%~dp0%%i" | ffmpeg -i - -i "%%i" -map 0:0 -map 1:a? -map 1:s? %param1% -pass 2 -c:a libopus -b:a 160k -c:s copy "out\%%i"
)
endlocal
In short, as a newcomer to VapourSynth and frame-servers, in the VS script, does everything look all right? Thanks in advance for any thoughts or suggestions.
This is my first post, though I've been reading Doom9 for years and first came across the site in 2004, when I was a teenager embarking on the wonderful world of video encoding in the DVD and MPEG-4 ASP era. Discovering FFmpeg in 2018 reignited my fondness for this field, and I've had nothing but praise for FFmpeg and its maintainers: it was startling how a single tool could do so much, in contrast to the old days when everything seemed a fragmented mess. Recently, tackling the encoding of anime with AV1, I've had trouble with banding, and FFmpeg's deband filter wasn't helping. Long story short, I ended up with VapourSynth rather than AviSynth because I found the former somewhat more intuitive and, more importantly, got it working.
The neo_f3kdb filter did an excellent job, and I didn't need to denoise, degrain, or mask. Before I encode, I thought I'd post my script here and check with the pros whether everything was all right, according to VS conventions, and that nothing was missing. My process is to use a batch file that iterates over the MKV files, passing the script and videos to VSPipe; the script runs, debanding; and the raw data is piped to FFmpeg, where it is encoded with AV1 in two passes. Here is the script:
from vapoursynth import core
clip = core.lsmas.LWLibavSource(filename)
clip = core.fmtc.bitdepth(clip, bits=16)
clip = core.neo_f3kdb.Deband(clip, keep_tv_range=True, output_depth=16)
clip = core.fmtc.bitdepth(clip, bits=10)
clip.set_output()
And the Windows batch file:
mkdir "out"
setlocal
set vscript=Script.vpy
set vspath=D:\Stuff\Movie Tools\Conversion\VapourSynth
set param1=-c:v libaom-av1 -cpu-used 3 -arnr-strength 0 -crf 16 -b:v 0 -g 240
for %%i in (*.mkv) do (
"%vspath%\vspipe" -c y4m "%~dp0%vscript%" - -a filename="%~dp0%%i" | ffmpeg -i - %param1% -pass 1 -f null -
"%vspath%\vspipe" -c y4m "%~dp0%vscript%" - -a filename="%~dp0%%i" | ffmpeg -i - -i "%%i" -map 0:0 -map 1:a? -map 1:s? %param1% -pass 2 -c:a libopus -b:a 160k -c:s copy "out\%%i"
)
endlocal
In short, as a newcomer to VapourSynth and frame-servers, in the VS script, does everything look all right? Thanks in advance for any thoughts or suggestions.