Question

I am creating a website which enables to upload videos. But we know that user can upload any kind of video but the browser can't play them. So, I thought that I somehow can convert them into .swf and play them using a flash player. I tried to use ffmpeg-php but it didn't worked. my code was:

shell_exec('ffmpeg -i in.mp4 out.swf');

It does not show any error neither it returns out.swf.

Please! help me.

Was it helpful?

Solution

Things to check:

  1. Does the in.mp4 file actually exist on the server and is it in the correct temporary folder?

  2. Check that file size limits (upload_max_filesize PHP setting) are not being hit.

  3. Does the ffmpeg command work properly from a shell promt as the user that the webserver is running as? (this test should be performed in the folder where you are processing the file) Use the verbose logging options to check for errors

  4. Capture all the output from the shell_exec and check for errors. Try using system or exec where you can also capture the return value of ffmpeg which can then be used for error checking

Finally, I would specify actual directory names for the input and output files. This will narrow down problems as you know exactly what folder to look in for results. You can also adjust permissions if required

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top