convert using ffmpeg without exec

后端 未结 8 2206
北海茫月
北海茫月 2021-01-03 14:16

I have Windows XP, Apache, PHP 5.3 and ffmpeg working fine. I need to convert flv to avi or vice versa without using the exec() command. Is this possible?

8条回答
  •  鱼传尺愫
    2021-01-03 14:52

    It's not possible, at least there seems no example where ffmpeg runs without some type of system call (e.g. exec, system) from PHP.

    Edit: One option is using the dreaded safe_mode. Refer to the manual on exec:

    Note: When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. ...

    In theory you can place the ffmpeg binary in an arbitrary directory and give the path of that directory to the safe_mode_exec_dir. That way users will only be able to run executables in that directory. But you must try and see the implications of such a setup in real life...

    Regarding your PHP extension request: PHP ffmpeg extension is just an informational one. If you need one that can do things on actual files, you will need to build a new extension based on ffmpeg library.

    And if you plan to do this on a shared hosting, you are most probably out of luck. A standard issue shared hosting provider wouldn't provide video functionality like this. Video hosting and processing requires specialized hosting at best.

提交回复
热议问题