I'm using ffmpeg to convert .avi file into a .png image sequence. This one works just fine:
Code: Select all
@ ECHO OFF
FOR %%A IN (*.avi) DO CALL :avi2png "%%A"
:avi2png
ffmpeg.exe -y -i %* -sameq -f image2 -c:v png "%%03d.png"
ECHO.
GOTO :EOF
But I want the script to extract the name without the extension from .avi file that is currently being processed. This is what the image sequence should look like: currentavi001.png, currentavi002.png etc. The script I came up with isn't working:
Code: Select all
@ ECHO OFF
FOR %%A IN (*.avi) DO CALL :avi2png "%%A"
:avi2png
ffmpeg.exe -y -i %* -sameq -f image2 -c:v png "%%~nA%%03d.png"
ECHO.
GOTO :EOF
I've tried both %~nA and %%~nA, but to no avail. The script returns this:
Code: Select all
Couldn't open file :
av_interleaved_write_frame(): Input/output error.
I'm a complete layman and would welcome every bit of help.