VideoHelp Forum




+ Reply to Thread
Results 1 to 11 of 11
  1. 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")
    Quote Quote  
  2. 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?

    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"
    )
    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.
    Last edited by jagabo; 20th Aug 2023 at 17:08.
    Quote Quote  
  3. 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'.
    Quote Quote  
  4. That means you don't have the LSMASH source package installed.

    http://avisynth.nl/index.php/LSMASHSource
    Quote Quote  
  5. LSMASHSource.dll has already been installed. Although I thought LSMASHSource was included in the FFMPEG libraries. I also tried other source plugins: the error is the same. Probably the batch file does not find the path to all plugins.
    Quote Quote  
  6. 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.
    Quote Quote  
  7. Thank you. I found my mistake and it worked for me. For some reason, in addition to the C:\Program Files (x86)\AviSynth+ folder, I had the C:\Program Files\AviSynth+ folder.
    Quote Quote  
  8. 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")
    Quote Quote  
  9. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by jagabo View Post
    That means you don't have the LSMASH source package installed.

    http://avisynth.nl/index.php/LSMASHSource
    LSMASHSource has any advantage over ffms2?
    Quote Quote  
  10. I find that LSMASH has fewer problems. But sometimes I have to fall back on ffms2.
    Quote Quote  
  11. 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:
    start /affinity 3F C:\ffmpeg.exe
    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?

    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"
    )
    pause
    Last edited by gelo333; 13th Dec 2023 at 11:20.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!