etnastyles Posted July 7, 2008 Share Posted July 7, 2008 anyone know how to add ffmpeg into php ????? nightmare - could you provide steps- keep seeing in code around this site ffmpeg -i and some random path. Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/ Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 You would use the exec function. Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583401 Share on other sites More sharing options...
etnastyles Posted July 7, 2008 Author Share Posted July 7, 2008 how would that work if you didnt have ffmpeg set up ??????????????????????? what is the process for setting it up in php / apache and then the script in php would call it i guess via exec() Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583440 Share on other sites More sharing options...
etnastyles Posted July 7, 2008 Author Share Posted July 7, 2008 like this example i see eveywhere : >> exec('ffmpeg -i uploads/videos/original/video7.mpg -an -ss 3 -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg uploads/videos/original/vids.jpg') but where do you get ffmpeg and how do you set it up in your php Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583445 Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 ffmpeg has nothing at all to do with php. Install it on your machine, then call it like any other command line program via exec(). but where do you get ffmpeg and how do you set it up in your php Have you tried googling for it? A google search of ffmpeg brings up the official page as the very first result. Amazing! Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583556 Share on other sites More sharing options...
Jabop Posted July 7, 2008 Share Posted July 7, 2008 I'm not sure what the problem is here. If you know what ffmpeg is and how to use it, doesn't that mean you have it installed? Doesn't that mean you could, theoretically, shell_exec() it? Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583562 Share on other sites More sharing options...
etnastyles Posted July 7, 2008 Author Share Posted July 7, 2008 i have read that you have to add ffmpeg to your ext / ini file pointing to a dll or some kind - i have a ffmpeg .exe file - if this is what you need to get the exec() function working could you please show me how to use it # <?php $test = exec(/www/demo/ffmpeg.exe, $convert_oldformat, $newformat_name); ?> this is ffmpeg calliing exe the only reason i ask is that i have seen methods liek this: $test = exec(ffmpeg -i, $convert_oldformat, $newformat_name); this is the ffmpeg in php modules how the dilly do you call the ffmpeg.exe within your php doc to convert a file???? whats the best method and is there a simple to understand tutorial to how you get ffmepg working through php using exec() Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583616 Share on other sites More sharing options...
Jabop Posted July 7, 2008 Share Posted July 7, 2008 I think you may be referring to ffmpeg-php. Google Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583624 Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 I think you may be referring to ffmpeg-php. Google Nowhere has he refered to ffmpeg-php, thats just going to complicate things. All you need do is as your example. <?php $test = exec(/www/demo/ffmpeg.exe, $convert_oldformat, $newformat_name); ?> Just make sure ffmpeg is installed into /www/demo, or make sure you supply a valid path to where it is installed. Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583627 Share on other sites More sharing options...
Jabop Posted July 7, 2008 Share Posted July 7, 2008 ffmpeg isn't installed to anywhere relating to the web path. He keeps referring to 'IN PHP' which means a php module, to me. Which is ffmpeg-php. Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583635 Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 ffmpeg isn't installed to anywhere relating to the web path. He keeps referring to 'IN PHP' which means a php module, to me. Which is ffmpeg-php. Yeah, but I think his a little confused. Theres not usually much point going the ffmpeg-php route because it not an official extension, alot of hosting providers will not install it. Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583664 Share on other sites More sharing options...
etnastyles Posted July 7, 2008 Author Share Posted July 7, 2008 i think maybe i am confused at the amount of ways to do this as there are so many tutorials on the net for using ffmpeg Is this method for when you have downloaded : http://sourceforge.net/project/showfiles.php?group_id=122353 this type of ffmpeg? <?php if(!exec('ffmpeg -i /www/demo/bigtimeknockout.wmv -ar 22050 -f flv /www/demo/video.flv', $result)) { echo "failed.<br>"; } else { echo "worked.<br>"; echo $result; } ?> whats about this method : http://arrozcru.no-ip.org/ffmpeg_builds/ you can download a ffmpeg.exe <?php if(!exec('ffmpeg.exe, /www/demo/bigtimeknockout.wmv -ar 22050 -f flv /www/demo/video.flv', $result)) { echo "failed.<br>"; } else { echo "worked.<br>"; echo $result; } ?> so which way is best all i want to do is get it working on my loaclhost before i start on my web server... i think i would prefer the method where you install modules into php as i would gain some extra knowledge....has anyone got ffmpeg converting files using php to call it????? if so can you help... Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583713 Share on other sites More sharing options...
Jabop Posted July 7, 2008 Share Posted July 7, 2008 Well are you on a linux or windows box? Exes run on...Windows, and that wouldn't work. If you're running Linux you are going to need to compile ffmpeg from the source Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583720 Share on other sites More sharing options...
etnastyles Posted July 7, 2008 Author Share Posted July 7, 2008 my setup is apache and mysql + php on a windows xp laptop that i got... if that is the case how do you do it - is there a guide with ffmpeg ???? Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583724 Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 Ok, I'll try and explain what is going on. Firstly, there is a php extension for handling ffmpeg through an extension, however this extension is not officially supported. Hence I would not recommend going this route as not many hosts will install the extension for you. Now, both the examples you posted use the same method. You need to install ffmpeg on your machine. ffmpeg is a command line program used for maniulating video. To execute command line programs via php you use one of the exec familly of functions. So, you need to pass exec the same command you would use on the command line. It really is quite simple. ffmpeg has nothing at all to do with php, but php provides a method of executing external applications via exec. Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583726 Share on other sites More sharing options...
etnastyles Posted July 7, 2008 Author Share Posted July 7, 2008 so should i just make sure that the ffmpeg.exe is in the same folder as the script that is calling the exec() function. Would this work on a linux box - if not how would you go about porting from a test windows system to a linux box. Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583733 Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 so should i just make sure that the ffmpeg.exe is in the same folder as the script that is calling the exec() function. The best way is to make sure you install ffmpeg somewhere within your system PATH. I'm not a windows user but I believe the C://system32 (or whatever it is) is within your path. This way you could call ffmpeg directly, otherwise, you will need to supply exec() with the full path to ffmpeg. eg C://foo/bar/ffmpeg.exe Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583738 Share on other sites More sharing options...
etnastyles Posted July 7, 2008 Author Share Posted July 7, 2008 so this is what i will do as i have a windows system <?php define("FFMPEG", "C:\Program Files\EasyPHP 2.0b1\www\phpvideo\ffmpeg.exe"); if(!exec('FFMPEG, /www/demo/bigtimeknockout.wmv -ar 22050 -f flv /www/demo/video.flv', $result)) { echo "failed. "; } else { echo "worked. "; echo $result; } ?> Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583763 Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 That should be more... if(!exec(FFMPEG . '/www/demo/bigtimeknockout.wmv -ar 22050 -f flv /www/demo/video.flv', $result)) Link to comment https://forums.phpfreaks.com/topic/113536-ffmpeg/#findComment-583794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.