Page 1 of 1

FFMPEG, XAMPP and Windows

PostPosted: 05. January 2009 18:18
by Droobles
If you accept feature requests, I would like you to include FFMPEG in the Windows Installation of XAMPP. :wink:


I hope this is possible as I cannot find any decent information on how to install FFMPEG in PHP5 on Windows. :oops: :cry: :x


thanks

Re: FFMPEG, XAMPP and Windows

PostPosted: 05. January 2009 23:30
by Sharley
Droobles wrote:...I cannot find any decent information on how to install FFMPEG in PHP5 on Windows...
Where did you look?
ffmpeg forum search results

Re: FFMPEG, XAMPP and Windows

PostPosted: 06. January 2009 06:36
by dmphotography
I actually wrote a tutorial on installing that and some other components required for some script programs. Take a look at this:

http://www.imgoingtoreportyou.com/install_vidiscript_windows_xampp.html

That's a guide on how to install a Youtube clone script on your site and I was quite proud of myself to figure it out, because there was very little supporting documents when it came to Windows.

FFMPEG was probably the most difficult thing to figure out, especially where to find the FFMPEG-PHP for windows.

All of my tutorials and installations I've made are based on XAMPP 1.7.0 installs and I test them on Vista, XP, and sometimes Server 2003.
Anyways, I hope that helps.

Re: FFMPEG, XAMPP and Windows

PostPosted: 16. February 2009 22:04
by superfresh
Install ffmpeg for windows

Step 1
Install xampp, use latest version. After installation there should be a directory C:\xampp
In this example i use C:\xampp as default directory.

Step 2
Check if gd2 is installed, you can do this by using phpinfo() in you script.

Step 3
Download ffmpeg.exe from one of the following links:
http://ffdshow.faireal.net/mirror/ffmpeg/
http://arrozcru.no-ip.org/ffmpeg_builds
http://ffdshow.faireal.net/mirror/ffmpeg/
http://www.paehl.com/open_source/?Convert_Tools:FFMPEG
http://oss.netfarm.it/mplayer-win32.php

Step 4
Unpack the downloaded zip or 7z file, three files should show up namely ffmpeg.exe, ffplay.exe, pthreadGC2.dll .

Step 5
Download the ffmpeg windows dll files:
http://azzerti.free.fr/php_ffmpeg_win32.zip

Step 6
Unpack the downloaded zip file, five dlls should show up namely php_ffmpeg_20050123.dll, php_ffmpeg_20050212.dll, php_ffmpeg_20050618.dll and also avcodec.dll and avformat.dll

Step 7
Copy 1 of 3 dlls which you've unpacked in step 6 into C:\xampp\php\extensions. Rename the dll to php_ffmpeg.dll

Step 8
Open your php.ini file which you find in C:\xampp\php .Add the following line to the list with dlls:
extension=php_ffmpeg.dll
Check also if extension=php_gd2.dll is uncommented. If not then remove the ;

Step 9
Copy the avcodec.dll and avformat.dll which you've unpacked in step 6 to C:\WINDOWS\system32

Step 10
Copy pthreadGC2.dll which was unpacked in step 4 to C:\WINDOWS\system32

Step 11
Restart xampp

Simple Example
Step 12
Create a directory in C:\xampp\htdocs for example www.test.dev\www
C:\xampp\htdocs\www.test.dev\www

Step 13
Open the httpd.conf file, this one you find in C:\xampp\apache\conf
Add under the line
NameVirtualHost localhost:80

the next data
<VirtualHost localhost:80>
ServerName www.test.dev
DocumentRoot C:/xampp/htdocs/www.test.dev/www
</VirtualHost>

Step 14
Find the hosts file on your computer, somewhere in the windows directory and add the following line:
127.0.0.1 www.test.dev

Step 15
Restart xampp

Step 16
Make a php file in the DocumentRoot (C:\xampp\htdocs\www.test.dev\www) for example test.php

Step 17
Add a flv file to the DocumentRoot. In this example i call it wattan.flv.

Step 18
Copy ffmpeg.exe which you've unpacked in step 4 into the DocumentRoot.(C:\xampp\htdocs\www.test.dev\www)

Step 19
Add the following code to the test.php file:
<?php
$ffmpegpath = "ffmpeg.exe";
$input = 'wattan.flv';
$output = 'wattan.jpg';

if (make_jpg($input, $output)){
echo 'success';
}else{
echo 'bah!';
}

function make_jpg($input, $output, $fromdurasec="01") {
global $ffmpegpath;

if(!file_exists($input)) return false;
$command = "$ffmpegpath -i $input -an -ss 00:00:$fromdurasec -r 1 -vframes 1 -f mjpeg -y $output";

@exec( $command, $ret );
if(!file_exists($output)) return false;
if(filesize($output)==0) return false;
return true;
}
?>

Step 19
Open the url http:\\www.test.dev\test.php in firefox.

Step 20
enjoy!

Re: FFMPEG, XAMPP and Windows

PostPosted: 16. February 2009 22:31
by Izzy
Step 8
Open your php.ini file which you find in C:\xampp\php...
Incorrect, the php.ini file that XAMPP uses is to be found in the xampp\apache\bin folder and can be confirmed by going to http://localhost/xampp/phpinfo.php and look for this line Loaded Configuration File.

I have not had time to check the rest for any more incorrect steps.

Re: FFMPEG, XAMPP and Windows

PostPosted: 20. February 2009 01:52
by dmphotography
Izzy wrote:I have not had time to check the rest for any more incorrect steps.


LOL, no need to Izzy. That has got to be the worse instructions I've seen so far. It's way too vague for one and it makes no sense to do all of the things this person has described. GD2 has nothing to do with FFMPEG for one and it's enabled by default in XAMPP. Plus, a lot of the instructions are wrong.

It was instructions like that that made me make my website trying to straighten it out for those who tried following something like that. Wew, that's rough.

Re: FFMPEG, XAMPP and Windows

PostPosted: 03. June 2009 07:18
by adeelshahid
Regardsless of all you guys discourging superfresh that the steps are this way or that way,

the steps worked for me and I think they are pretty easy, you just need a brain :wink:

Re: FFMPEG, XAMPP and Windows

PostPosted: 29. October 2010 23:25
by BDS1400
I stopped at STEP 11 and got it to work on XAMPP 1.7.3 in Windows 7

Re: FFMPEG, XAMPP and Windows

PostPosted: 25. November 2010 01:26
by Charca
Worked great for me too on Windows 7, thanks for the instructios, superfresh.

Just one thing, to make it work on Win7 64 bits I had to copy the dlls on Windows/SysWOW64/ as well.
Hope this helps anyone.

Re: FFMPEG, XAMPP and Windows

PostPosted: 29. December 2010 00:50
by nickgee
Hi first post, but after spending close to 5 hours on this I'd like to say that the above dll files didn't work for me but the two links at the bottom of this page http://tutpages.com/?page_id=20 provided more friendly results and ffmpeg now shows up in php_info(). :)

I'm on Vista (bleh), 32-bit, and am using XAMPP 1.7.1 Beta5. (Can't use the latest because it comes with PHP 5.3 and some Drupal modules still have problems with that.)

Hope that helps if you're having problems with this.

Re: FFMPEG, XAMPP and Windows

PostPosted: 24. February 2011 13:42
by vladkras
Charca wrote:Just one thing, to make it work on Win7 64 bits I had to copy the dlls on Windows/SysWOW64/ as well.
Hope this helps anyone.

it helped my very much, big thx

i'm using the latest xampp lite with php 5.3.1 on Windows 7 64-bit
http://quezar.ro/php_ffmpeg/ link doesn't work anymore, so i took the archive here: http://rapidshare.com/#!download|934l34 ... _5.3.1.rar
copied php_ffmeg.dll to php\ext & other DLLs to Windows/SysWOW64 (only for 64-bit), and added extension=php_ffmeg.dll in php.ini file
that's all, now i can see ffmpeg in phpinfo()

(whatch readme.txt inside the archive for better English)

Re: FFMPEG, XAMPP and Windows

PostPosted: 20. April 2011 08:59
by cham
Created zero sized file. May I know what's the error?
I run the command in command line and gives error as follows.
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)
[flv @ 00AA6C70]Unsupported video codec (7)

Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000
/1) -> 25.00 (25/1)
Input #0, flv, from 'wattan.flv':
Duration: 00:05:54.0, start: 0.000000, bitrate: N/A
Stream #0.0: Video: 0x0007, 25.00 tb(r)
Stream #0.1: Audio: 0x000a, 44100 Hz, stereo
picture size invalid (0x0)
Cannot allocate temp picture, check pix fmt