PHP / ffmpeg (Windows 7): - Permission denied. Tried everything, but still does not work

advertisements

I have a command-line PHP script that, when given the folder name as an argument when executing the script, will find all images in said folder and resize them using FFmpeg. Problem is, I always get a Permission Denied error in FFmpeg when it attempts to get at the files within the folder. This is while being on Windows 7.

The big problem is that I've tried every solution that keeps popping up on the interwebs when I search for how to fix it. I've changed the settings in Avast!, did the attrib command (both as normal and "Run as Administrator") to unmark as read-only, took ownership of the folder both via command line and using that GUI takeown context menu thing everyone keeps throwing around (obviously before my efforts to mark everything as not-read-only), messed with permissions, everything. I keep searching and searching for a solution, but all of the sites keep throwing out the same things over and over again - things that I've already tried multiple times. I'm at the end of my rope here. All I want to do is resize images quickly and automatically so I can put them up on my website, yet this has been a massive headache...

Please help me! :(

Update (Additional Points):

  • The error is through FFmpeg, not PHP. FFmpeg spits out the permission denied error, the script just continues doing what it does normally (or, at least, it would if it weren't for my die statement that kicks in in the event of FFmpeg failing).

  • FFmpeg will execute just fine if it's run normally through the command line instead of through the script. However, this does not help the problem of me having to resize hundreds of photos by hand!

  • I'm just running this script in the normal terminal using the CLI engine. Weird use for PHP, I know, but since I already knew how to work with FFmpeg in PHP (but in Linux!) so I figured I might as well use the code as a normal, stand-alone program...

  • FFmpeg spits out the same error regardless of which PHP function is used to execute it. It happens for shell_exec, exec, passthru, and system.


I can remember having the same issue and I would recommend you to start from checking other compilations of FFMpeg for Windows. I used one of the following and they worked perfectly! Please go Zeranoe FFmpeg builds and then let us know if it solves your problem. I used 64-bit Builds (Static) version! Not all compilations of FFMpeg for Windows are the same! If it is still not working let us see the error log and the command line that you're using! Though I think everything should be fine!

On the other hand you can simplify everything and try to use Mogrify Utility that works as simple as that:

 mogrify -resize 640×480 *.jpg

I can confirm that I used it as well instead of FFMpeg. Just install the tool and change the command line in your script and that is it! It will use less resources than FFMpeg most likely and provide you with the same result!

All the best, Ilia.