ffmpeg local expansion and running a command within

0

Big time n00b question.. I just can't quite figure out what I'm doing wrong. Here is my .bat file:

@ECHO OFF

SETLOCAL

set /p Input= Drop file here, and click enter.

set file=%Input%
FOR %%i IN (%file%) DO (
ECHO filedrive=%%~di
ECHO filepath=%%~pi
ECHO filename=%%~ni
ECHO fileextension=%%~xi
ECHO %filename%

)

ffmpeg -i %Input% -an -c:v libx264 -preset medium -crf 22 "%%~di%%~pi%%~ni.mp4"

pause

When I run this, it does not recognize ffmpeg as a command. This must be simple... What the heck am I doing wrong?

M Leonard

Posted 2016-05-06T01:56:26.847

Reputation: 111

Check if ffmpeg is in your path or in the PWD of the batch file. – Gyan – 2016-05-06T04:56:44.303

AH ok. That was essentially the problem. Why doesn't it see that FFMPEG is in my user directory? Anyways, once I specified where FFMPEG was via a variable or moved it next to the batch file, it worked. – M Leonard – 2016-05-06T13:02:09.540

Since you found a solution you can provide an answer to your own question. – llogan – 2016-05-06T17:12:57.093

Answers

0

It was as simple as this:

@ECHO OFF

SETLOCAL

set /p Input= Drop file here, and click enter.
set ffmpeg=C:\Windows\User\ffmpeg.exe

set file=%Input%
FOR %%i IN (%file%) DO (
ECHO filedrive=%%~di
ECHO filepath=%%~pi
ECHO filename=%%~ni
ECHO fileextension=%%~xi
ECHO %filename%

)

%ffmpeg% -i %Input% -an -c:v libx264 -preset medium -crf 22 "%%~di%%~pi%%~ni.mp4"

pause

M Leonard

Posted 2016-05-06T01:56:26.847

Reputation: 111