Friday, 6 October 2017

How to install ffmpeg in wamp server in Windows7

How to install ffmpeg in wamp server in Windows

Question: What are Simple steps to install ffmpeg in wamp server in Windows?
  1. Download FFmpeg for Windows
    https://ffmpeg.zeranoe.com/builds/
  2. Extract the downloaded Zip file.
  3. Copy bin/ffmpeg.exe, bin/ffplay.exe and bin/ffprobe.exe from downloaded and paste in C:\Windows\System32
  4. Create a folder with name ffmpegtest in path d:/wamp/www (Drive can be different as per wamp installation)
  5. Login to Command prompt and go to d:/wamp/www/ffmpegtest using cd command
  6. Execute following command (To download composer)
    php -r "readfile('https://getcomposer.org/installer');" | php
    

    It will download the composer.phar
  7. Execute following command to download PHP-FFMPEG library.
    php composer.phar require php-ffmpeg/php-ffmpeg
    
  8. Test the FFMPEG with php
    include "vendor/autoload.php";
    $ffmpeg = FFMpeg\FFMpeg::create();
    print_r($ffmpeg);
    
    When it print the object, means FFMPEG setup successfully.


Question: What can we do with ffmpeg?
-Cut the video
-Combine two or more videos into one
-Extract the one video portion from main video
-Resize the video
-Extract the audio from video
-Combine photo+audio into video
-Change the sample rate
-Watermarking on vi



Question: What is Bitrate?
Bitrate describes the rate at which bits are transferred in ffmpeg. Bitrate is commonly measured in bits per second (bps),kilobits per second (Kbps), or megabits per second (Mbps).


Question: What is Frame Rate?
the frame rate is the number of frames or images that are projected or displayed per second.


Question: What is demux?
A demux(er) is a module responsible for extracting the contents of a given file/stream format, for instance AVI, OGG, MPEG2, WAV, etc.


Question: How to convert .wav to .mp3?
include "vendor/autoload.php";
$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open( 'audiofile.wav' );
$audio_format = new FFMpeg\Format\Audio\Mp3();
// Extract the audio into a new file as mp3 and save in folder
$video->save($audio_format, 'audiofile.mp3');



Question: How to transcode a wav to flac?
include "vendor/autoload.php";
$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open( 'audiofile.wav' );
$audio_format = new FFMpeg\Format\Audio\Mp3();
$video->save($audio_format, 'audiofile.mp3');