Tell me a simple way to automatically use Avisynth filters for different files. I use encoding like this:
bat-file
FOR %%F IN (*.mp4) DO (
ffmpeg -i "C:\Videos\work.avs" -i "%%F" -map 0:v:0 -map 1:a -vcodec libx264 -crf 20 -c:a copy "%%~nF_new.mp4"
)
work.avs
LSMASHVideoSource("C:\Videos\work.mp4")
Spline36ResizeMT(720, 1280, prefetch=4)
KNLMeansCL(D=1, A=1, h=2, device_type="auto")
+ Reply to Thread
Results 1 to 11 of 11
-
-
I'm not sure I understand what you want. You want to use the same AVS filter sequence but for each video returned by the FOR loop?
Like this?
That will build an AVS script for each mp4 file in the folder, encode it (and copy audio from the original mp4), then delete the AVS script.Code:FOR %%F IN (*.mp4) DO ( echo LSMASHVideoSource("%%~dpnxF"^) > "%%~dpnxF.avs" echo Spline36ResizeMT(720, 1280, prefetch=4^) >> "%%~dpnxF.avs" echo KNLMeansCL(D=1, A=1, h=2, device_type="auto"^) >> "%%~dpnxF.avs" ffmpeg -i "%%~dpnxF.avs" -i "%%~dpnxF" -map 0:v:0 -map 1:a -vcodec libx264 -crf 20 -c:a copy "%%~dpnF_new.mp4" del "%%~dpnxF.avs" )Last edited by jagabo; 20th Aug 2023 at 17:08.
-
Thanks for the answer. Yes, I want to just move the video to the selected folder. Start work through a batch file. Then another video.
I tried your advice. Shows an error:
[avisynth @ 000001b38cc335c0] Script error: There is no function named 'LSMASHVideoSource'. -
That means you don't have the LSMASH source package installed.
http://avisynth.nl/index.php/LSMASHSource -
Are you sure you put the correct lsmashsource.dll in the right plugins folders? Ie, 32 bit dll in plugins+, 64 bit dll in plugins64+.
LSMASH is not included in the AviSynth ffmpegsource plugin.
And when using AviSynth, AviSynth is opening and decompressing the source, not the ffmpeg that you are using to encode. -
You can always explicitly load a dll from within your script by using the full path name:
Code:LoadPlugin("C:\full\path\to\plugin.dll") -
-
I find that LSMASH has fewer problems. But sometimes I have to fall back on ffms2.
-
For the script that is used from this thread, I want to limit the number of cores. In total I have 4 cores and 8 threads. I only need 6 threads for video encoding in the background (this is 80% of the computer’s power), and at this time I use the remaining threads for other work. I can change the number of processors in the Task Manager, but I have to do this every time. I wanted to do this automatically.
Now I'm trying this:
A separate cmd window opens, which does not have the usual FFMPEG encoding log. And perhaps not all script options are used. How to do it correctly?start /affinity 3F C:\ffmpeg.exe
In general, the FFMPEG script looks like this:
FOR %%F IN (*.mp4) DO (
echo LSMASHVideoSource("%%~dpnxF"^) > "%%~dpnxF.avs"
echo SetFilterMTMode("DEFAULT_MT_MODE", 2^) >> "%%~dpnxF.avs"
echo LoadPlugin("D:\ResampleMT.dll"^) Spline36ResizeMT(720, 1280, prefetch=4^) >> "%%~dpnxF.avs"
echo KNLMeansCL(D=1, A=1, h=1.5, device_type="auto"^) >> "%%~dpnxF.avs"
echo DetailSharpen(str=0.3, pow=8, z=6, ldmp=0, mode=1, med=false^) >> "%%~dpnxF.avs"
echo Prefetch(6^) >> "%%~dpnxF.avs"
C:\ffmpeg.exe -benchmark -i "%%~dpnxF.avs" -i "%%~dpnxF" -map 0:v:0 -map 1:a:0 -c:v libx264 -qp 26 -preset medium -g 30 -keyint_min 5 -c:a copy "%%~dpnF_new.mp4"
del "%%~dpnxF.avs"
)
pauseLast edited by gelo333; 13th Dec 2023 at 11:20.
Similar Threads
-
help avisynth script for cartoon
By david.dgc in forum Video ConversionReplies: 27Last Post: 22nd Jul 2023, 05:06 -
Avisynth script to MPEG2 - What to do?
By ENunn in forum Video ConversionReplies: 15Last Post: 14th Jul 2023, 10:48 -
Avisynth script for Muxing
By Donnje in forum EditingReplies: 14Last Post: 15th Jun 2021, 17:07 -
Avisynth script joining help
By sulkiyan in forum EditingReplies: 16Last Post: 14th Oct 2018, 15:44


Quote
