I've searched the internet and haven't found a solution. I hope this question does not come off as a duplicate.
I have the following files in the same folder:
The text within RUN_FILE.bat
:
ffmpeg -i "IN.mp4" -c:v libx264 -crf 24 -c:a libmp3lame -aq 2 OUT.mp4
The text within RUN_AVS.bat
:
ffmpeg -i "SCRIPT.avs" -c:v libx264 -crf 24 -c:a libmp3lame -aq 2 OUT.mp4
The text within SCRIPT.avs
(3 lines):
LoadPlugin("D:\MSharpen.dll")
DirectShowSource("D:\IN.MP4")
MSharpen(15,150)
If I try loading the avisynth script with an external program such as media player classic it works fine (and sharpens the video frames).
Going to the command line and running RUN_FILE.bat
works as expected, however running RUN_AVS.bat
I get the following error (see screenshot):
I find this confusing as ffmpeg is configured with --enable-avisynth
.
I'd appreciate help with this - This is part of a larger and very important project (automatically scanning a folder with hundreds of video files, sharpening and re-encoding them to another folder with the same filenames).
Have you tried googling for the line that is in red in your screenshot?
From what I found here http://ffmpeg.zeranoe.com/forum/viewtopic.php?t=1084 and in other sources, unknown error might be due to difference in 32/64bit builds either in ffmpeg or avisynth. There might also be a problem if you're using Avisynth 2.5.8 instead of 2.6 (open an avisynth script containing "Version()" as the last command in it in any player to find which one you have). Finally you might want to try opening your script in x264.exe instead of ffmpeg and see if it works.
I would have posted this to comments intead of answer, but I'm not yet allowed to comment.
Well... it seems it was a matter of versions after all.
rogerdpack's remark is what made me systematically try old versions of ffmpeg etc. I gave his answer +1 but I think an answer should be such that it is a full solution for the question, so I'm writing my own answer. Hope you understand rogerdpack :-)
Anyway, here's the combination that worked for me (I hope posting URLs is OK):
FFMPEG 32-bit version 2.5.2 (downloaded from http://ffmpeg.zeranoe.com/)
Avisynth 2.5.8 (downloaded from official build)
MSharpen plugin for avisynth (downloaded from MSharpen official link).
Make sure you copied MSharpen.dll to the avisynth plugin folder beforehand and restarted your computer. In my case the plugin folder is C:\Program Files (x86)\AviSynth 2.5\plugins
.
BTW I'm running Windows 7 Ultimate with SP1 (64 bit) with an Intel i5-3570K, 16GB ram etc. Maybe I should have stated that in the OP.
For what it's worth, here's my solution.
The folder and file layout is as following:
I have a main folder; the name does not matter - let's call it 'MAIN'. Within 'MAIN' I have 2 files and 2 folders.
The 2 files are:
The 2 folders are:
The file BatchConvert.bat has the following text:
for %%a in ("Source*.*") do @echo DirectShowSource("%%a") >> "batchScript.avs" && @echo MSharpen(10,120) >> "batchScript.avs" && ffmpeg -i "batchScript.avs" -n -c:v libx264 -crf 24 -c:a libmp3lame -b:a 192k "Target\%%~na.mp4" && del "batchScript.avs" pause
The batch file basically scans all files from 'Source' and encodes them in 'Target' and it skips files that already were encoded. It doesn't alter the files in 'Source' at all, just in case.
All that's left to do is copy all the videos to Source and run BatchConvert.bat !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With