1
votes

I'm trying to re size a video that's not in the same directory of PHP exec code, this is my ffmpeg code:

ffmpeg.exe -i ../Gotten Movies/test.mp4 -s hd480 -c:v libx264 -crf 23 -c:a aac -strict -2 ../Gotten Movies/test2o.mp4
The error which I'm getting is: ../Gotten: Invalid data found when processing input I think the problem is because of choosing previous directory with ../ I've tried to
cd Gotten Movies; ffmpeg.exe -i ../Gotten Movies/test.mp4 -s hd480 -c:v libx264 -crf 23 -c:a aac -strict -2 ../Gotten Movies/test2o.mp4
But it didn't work too what can shall I do to fix the issue thanks.
2
Use \ instead of /Gyan
same problem its showing ..\Gotten: Invalid data found when processing input now :(7al7ol
thanks you its working now make it as answer :)7al7ol

2 Answers

1
votes

Always safer to enclose paths with special characters in quotes:

ffmpeg.exe -i "../Gotten Movies/test.mp4" -s hd480 -c:v libx264 -crf 23 -c:a aac -strict -2 "../Gotten Movies/test2o.mp4"
0
votes

Just an FYI: Windows is really picky on single vs double quotes. I input my file like this in the PHP (this escapes word spaces in filenames and directories):

$filepath=$file->getPath();
$filepath=str_replace('\\',"/",$filepath);
$filename='abc.mpg';

pass them in separately to my function - then do this:

$cmd = 'ffmpeg -i "'.$filePath.'"/"'.$fileName.'" 2>&1 | findstr Duration';
$data = exec($cmd, $output);

if there is an error $output will contain full response with errors - otherwise $data gives the item I want (Duration)