Posts tagged FFMPEG

Encodage MP4 pour smartphones

La commande FFMPEG à utiliser pour générer des fichiers mp4 conformes :

/usr/bin/ffmpeg -i video_source -vcodec libx264 -coder 0 -level 12 -vprofile baseline -s 320×180 -b 150k -maxrate 150k -r 15 -bufsize 1M -acodec libfaac -ac 2 -ar 48000 -ab 48k video_mp4

iPhone HTTP Streaming with FFMpeg and Segmenter in windows

Step 1 execute windows commande
ffmpeg.exe -i <input file> -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320×240 -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq ‘blurCplx^(1-qComp)’ -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 <output MPEG-TS file>

Step 2 execute windows commande
segmenter <input MPEG-TS file> <segment duration in seconds> <output MPEG-TS file prefix> <output m3u8 index file> <http prefix>
segmenter.exe demo.ts 10 demo index.m3u8 http://localhost:81/stream/

Step 3 modifier http.conf
AddType application/x-mpegURL .m3u8
AddType video/MP2T .ts

Step 4 creat a page for iphone
<title>Video Test</title>
<meta name= »viewport » content= »width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0; »/>
<body style= »background-color:#FFFFFF; « >
<video width=’150′ height=’150′ src= »index.m3u8″ />

FFMPEG, XAMPP and Windows 64 bit

by superfresh » 16. February 2009 22:04

Install ffmpeg for windowsStep 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:

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:

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:
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

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>
DocumentRoot C:/xampp/htdocs/

Step 14
Find the hosts file on your computer, somewhere in the windows directory and add the following line:

Step 15
Restart xampp

Step 16
Make a php file in the DocumentRoot (C:\xampp\htdocs\\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)

Step 19
Add the following code to the test.php file:
$ffmpegpath = « ffmpeg.exe »;
$input = ‘wattan.flv’;
$output = ‘wattan.jpg’;

if (make_jpg($input, $output)){
echo ‘success’;
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:\\\test.php in firefox.

Step 20

How to install ffmpeg, mencoder, mplayer and php-ffmpeg on windows server

First you have to download all the required files which can be found here


click to download
(download the zip,rar or 7z extension file)

click here to download
(download the zip,rar or 7z extension file)

click here to download
(download the zip,rar or 7z extension file)

click here to download
(download the zip,rar or 7z extension file. this will not work on php 5.3)

extract all the files you have download in separate folders in a temp directory.

1) copy ffmpeg to c:\ffmpeg (you can choose any path)
2) copy mencoder to c:\mencoder (you can choose any path)
3) copy mplayer codecs in c:\mencoder\codecs (all the codecs should be in that codecs folder of mencoder)
4) copy all php-ffmpeg to windows\system32 and php\ext (extension folder)
5) open php.ini and add extension=php_ffmpeg.dll (to locate php.ini file loaded make a temp php file and put run that file in the webserver and look for php.ini file)

Automated FFmpeg Builds

The autobuilds have come to an end.
(this is not related to the svn->git switch at FFmpeg)

For fresh FFmpeg builds for Windows go to

All old builds from and correponding
source code can be found in the archives below:
log: The log file from the build system.
readme: The readme file for each static build.
source: FFmpeg’s source tarball.
win32 static: A mingw32 static build of FFmpeg.
win32 shared: A mingw32 shared build of FFmpeg.
win32 shared-dev: A package with include and lib files for mingw32 shared builds.
win64 static: A mingw-w64 static build of FFmpeg.
win64 shared: A mingw-w64 shared build of FFmpeg.
win64 shared-dev: A package with include and lib files for mingw-w64 shared builds.
macosx64 static: A macosx64 static build of FFmpeg.
macosx64 shared: A macosx64 shared build of FFmpeg.
macosx64 shared-dev: A package with include and lib files for macosx64 shared builds.
doxy: Doxygen documentation for FFmpeg (built only on Sundays).
Changelog: FFmpeg Changelog for the build.
Repository: apt repository containing source code (how it works)
Go to Top