![]() |
Running FFmpeg in Code Igniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Running FFmpeg in Code Igniter (/showthread.php?tid=57576) |
Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]Sky Warden[/eluser] Hi everyone. I need help in using FFmpeg in Code Igniter. I want to make a thumbnails of a video in video directory, and save it in thumbnails directory. I do it like this for now: Code: $command = 'ffmpeg -itsoffset -7 -i video/test.mp4 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 thumbnails/test.jpg'; That syntax runs perfectly in terminal (I'm using Linux) but it doesn't work with PHP. I've tried to make a simple PHP containing that script and try it manually, but still no result. Maybe I need to load something related to FFmpeg or anything? This is my first time in using FFmpeg in Code Igniter. My PHP version is 5.4.7 if that information can help. Thank you. ![]() Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]TheFuzzy0ne[/eluser] Try using shell_exec instead. It will return the output from the command as a string, so you can see what's going on. Can you tell me more about the server you're running it on? Is it a shared host? If so, there might be an open_basedir restriction in effect. Is FFMPEG installed on your target server? If it's not, you might have problems. Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]Sky Warden[/eluser] [quote author="TheFuzzy0ne" date="1364131470"]Try using shell_exec instead. It will return the output from the command as a string, so you can see what's going on. Can you tell me more about the server you're running it on? Is it a shared host? If so, there might be an open_basedir restriction in effect. Is FFMPEG installed on your target server? If it's not, you might have problems.[/quote] It's just a local host. Just for development. I've installed ffmpeg and it works perfectly fine in the terminal. It's Ubuntu 12.10. Since it's local host, I don't think I need to install it. Well, it's installed already isn't it? I've tried shell_exec and still no result. You sure I don't need to...a kind of determining where my ffmpeg is? Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]TheFuzzy0ne[/eluser] Echo the string returned by shell_exec, and you should have your answer. ![]() Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]Sky Warden[/eluser] [quote author="TheFuzzy0ne" date="1364134482"]Echo the string returned by shell_exec, and you should have your answer. ![]() I've tried that as well. No output at all. I start losing my hope. :lol: Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]TheFuzzy0ne[/eluser] Do you have error reporting enabled? It would certainly help to use the absolute path to the executable, but I don't think that's causing your issue. Are you definitely using shell_exec() and not exec()? Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]Sky Warden[/eluser] [quote author="TheFuzzy0ne" date="1364135824"]Do you have error reporting enabled? It would certainly help to use the absolute path to the executable, but I don't think that's causing your issue. Are you definitely using shell_exec() and not exec()?[/quote] I'm using shell_exec. My error reporting is enabled. I installed only FFmpeg, but it works in the terminal already, so I don't think that's the problem, or is it? Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]TheFuzzy0ne[/eluser] It shouldn't be a problem, no. If it works from the terminal, it should work from within PHP. Are you able to use scandir() to list the contents of the directory where FFMPEG is installed? Code: print_r(scandir('/usr/local/bin/')); // Make sure this is the right path. Once you've tried that, please post the code you have again. Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]TheFuzzy0ne[/eluser] Also, try to use absolute paths to everything. Running FFmpeg in Code Igniter - El Forum - 03-24-2013 [eluser]Sky Warden[/eluser] [quote author="TheFuzzy0ne" date="1364138296"]It shouldn't be a problem, no. If it works from the terminal, it should work from within PHP. Are you able to use scandir() to list the contents of the directory where FFMPEG is installed? Code: print_r(scandir('/usr/local/bin/')); // Make sure this is the right path. Once you've tried that, please post the code you have again.[/quote] Sorry. Timezone. Yes, I'm able to scan the directory, but my ffmpeg is in /usr/bin/ not /usr/local/. I've tried the full path, but still doesn't work. I think the directory stuff. Also, do I need to give any permission? To make sure, I've tried it like this : Code: $command = 'ffmpeg -itsoffset -7 -i http://localhost/celestial_stream/video/test.mp4 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 http://localhost/celestial_stream/thumbnails/test.jpg'; Code: echo shell_exec('ffmpeg -itsoffset -7 -i http://localhost/celestial_stream/video/test.mp4 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 http://localhost/celestial_stream/thumbnails/test.jpg'); |