VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. I've created a bat for x264 and it works fine but, how do I make one to apply Avisynth filters during the encoding process?
    Quote Quote  
  2. as your input file in your BAT file you use Avisynth script
    Quote Quote  
  3. A sample bat file to build and AviSynth script from a file dragged onto the bat file (or via Send To):

    Code:
    echo Mpeg2Source("%~d1%~p1%~n1%~x1", CPU=2, Info=3) > "%~d1%~p1%~n1.avs"
    echo TFM(d2v="%~d1%~p1%~n1%~x1") >> "%~d1%~p1%~n1.avs"
    echo TDecimate() >> "%~d1%~p1%~n1.avs"
    You can see how to add filters. Then follow that with a call to x264:

    Code:
    x264.exe --preset=slow --crf=18 --sar=1:1 --output %1.mkv "%~d1%~p1%~n1.avs"
    I prefer to run x264 at low priority:

    Code:
    start /b /low x264.exe --preset=slow --crf=18 --sar=1:1 --output %1.mkv "%~d1%~p1%~n1.avs"
    You'll have to add the full path to x264.exe or put it in your search path.

    I have several bat files like the above in my Send To folder to build basic AVS scripts for different source types (ffVideoSource, DirectShowSource, AviSource, etc.). I can just right click on a video file and select Send To -> AviSource.bat, or whichever is necessary. The I add any filters I may need and drag/drop onto the x264 bat file.
    Last edited by jagabo; 19th Jul 2013 at 00:02.
    Quote Quote  
  4. I used a simple avs to try that command line but for some reason the encoding doesn't start, this is the content of the script (Input.avs):
    Code:
    LoadPlugin("C:\MeGUI\tools\avs\directshowsource.dll")
    DirectShowSource("C:\Encoding\Input.mkv", fps=23.976, audio=false, convertfps=true).AssumeFPS(24000,1001)
    And this is the bat file:
    Code:
    start "x264_64_tMod-10bit-all.exe" /wait x264_64_tMod-10bit-all.exe --qpmin 11 --qpmax 50 --me umh --crf 22 --tune Animation --preset veryslow --bframes 8 --deblock 1:1 --fade-compensate 0.2 --psy-rd 0.40:0.60 --aq-mode 3 --subme 10 --trellis 2 --merange 24 --chroma-qp-offset -4 --threads 6 --keyint 250 --min-keyint 15 --scenecut 45 --aq-strength 0.75 --output Output.mkv "Input.avs"
    pause
    All files are placed under "C:\Encoding\" that x264 works in MeGUI so I think the problem is not related to the exe file, or am I doing it wrong? if I use:
    Code:
    --output Output.mkv "Input.mkv"
    Instead of:
    Code:
    --output Output.mkv "Input.avs"
    The encoding starts correctly (but obviously the filters aren't applied), could it be that something inside "Input.avs" is missing? I retried again using a different avs, like this:
    Code:
    LoadPlugin("C:\MeGUI\tools\ffms\ffms2.dll")
    FFVideoSource("C:\Encoding\Input.mkv")
    But the problem is the same, the x264 window appears for a second then it closes and nothing else happens.
    Last edited by Kyousuke; 19th Jul 2013 at 02:32.
    Quote Quote  
  5. Do you get an error message with the AviSynth script?

    Some possibilities I can think of:

    You don't have DirectShow set up to open MKV files.

    x264_64_tMod-10bit-all.exe doesn't accept AVS script as input.

    x264_64_tMod-10bit-all.exe not in your search path.

    32 bit AviSynth under 64 bit Windows and x264? You'll need 64 bit AviSynth and DirectShowSource.dll.
    Last edited by jagabo; 19th Jul 2013 at 08:36.
    Quote Quote  
  6. There're no error messages, the window closes so fast and even when it lags it's just full black with no text.

    Also it runs with no troubles in MeGUI (using x264_64_tMod-10bit-all.exe too, I've renamed it 264_64.exe for MeGUI compatibility) and I don't understand why, using the same files and same script. I've DirectShow installed and it decodes correctly in AvsPmod (both FFVideoSource and DirectShowSource so I don't think it's related to that).

    I've everything already installed, I'm sure nothing is missing because normal encoding works perfectly:
    - https://forum.videohelp.com/images/imgfiles/G9ucWgv.png (command line - no AVS)
    - https://forum.videohelp.com/images/imgfiles/sF7N1dg.png (MeGUI + AVS)

    I'll try searching more infos about x264_64_tMod-10bit-all.exe maybe it uses a different syntax for AVS, though I wonder why it works in MeGUI.
    Last edited by Kyousuke; 19th Jul 2013 at 16:43.
    Quote Quote  
  7. I wonder why it works in MeGUI.
    MeGui probably uses avs2x264 (or avs4x264mod) to decode the avs script and pipe it as raw video to x264
    Quote Quote  
  8. Originally Posted by Kyousuke View Post
    There're no error messages, the window closes so fast and even when it lags it's just full black with no text.
    Add "pause" to the bat file, after the line that calls x264. The windows will remain open until you press Enter.
    Last edited by jagabo; 20th Jul 2013 at 07:09.
    Quote Quote  



Similar Threads

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