FFMPEG Basics  http://www.prodigyview.com
OverviewObjectiveLearn how to convert videos using ffmpeg and the phpfunction exec.Requirements Installed version of ffmp...
Follow Along With A Code          Example1. Download a copy of the example code at  www.prodigyview.com/source.2. Install ...
execIn this tutorial we are going to be using the function exec.In PHP this function will allow you to execute programsdir...
Location of FFMPEGThe first thing we need to is access ffmpeg on yourserver. The program ffmpeg must be installed on yours...
Input FileFor this example to work, we at least need a video thatalready exist. ProdigyView Example code comes with avideo...
SyntaxThe syntax for converting a file is relatively easy. You need thevideo file to be converted and the location to save...
Parameters FFMPEG has arguments that affect the output of a file. Remember that the arguments must be set before the file ...
Changing File FormatsUp until now, we’ve been working within the same format,mp4. FFMPEG is a great piece of software beca...
Cropping a VideoIn this example, we are going to change video formats andalso crop the video. Looking at the documentation...
Padding   In this last example, we will add some padding to the   video, and set the color of the padding. By now, you   s...
FFMPEG DocumentsThe arguments used here is only an example of the ffmpegarguments available. For more information on ffmpe...
More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials                     www.prodigyview.com
Upcoming SlideShare
Loading in …5
×

FFMPEG Video Basics for PHP Tutorial

17,483 views

Published on

Learn how to convert videos in PHP using ffmpeg and php exec function.

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
  • thanks for share
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
17,483
On SlideShare
0
From Embeds
0
Number of Embeds
208
Actions
Shares
0
Downloads
142
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

FFMPEG Video Basics for PHP Tutorial

  1. 1. FFMPEG Basics http://www.prodigyview.com
  2. 2. OverviewObjectiveLearn how to convert videos using ffmpeg and the phpfunction exec.Requirements Installed version of ffmpeg Understanding of the definesEstimated Time8 minutes www.prodigyview.com
  3. 3. Follow Along With A Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/avi/FFMPEG_Video.php http://www.prodigyview.com
  4. 4. execIn this tutorial we are going to be using the function exec.In PHP this function will allow you to execute programsdirectly on the command line.For more information, read the PHP doc.http://php.net/manual/en/function.exec.php http://www.prodigyview.com
  5. 5. Location of FFMPEGThe first thing we need to is access ffmpeg on yourserver. The program ffmpeg must be installed on yourserver environment.On my server ffmpeg is accessible from anywhere. But if yourffmpeg is only accessible from /usr/share/ffmpeg, then changeyour value to that or where ever ffmpeg is accessible from. Ifyou are unsure, ask your hosting provider. http://www.prodigyview.com
  6. 6. Input FileFor this example to work, we at least need a video thatalready exist. ProdigyView Example code comes with avideo in mp4 format.1. PV_ROOT define for the top level directory of your application 2. Location of video file relative to the top level directory
  7. 7. SyntaxThe syntax for converting a file is relatively easy. You need thevideo file to be converted and the location to save the output.Notice in the code at the bottom, we are using PV_VIDEO defineas the location to save the file. Example Syntax: ffmpeg –i input_file.ext output_file.ext 1. Location of FFMPEG program 2. Location of file to convert 3. Output location and name of converted file
  8. 8. Parameters FFMPEG has arguments that affect the output of a file. Remember that the arguments must be set before the file they will affect. Below we are going to change the aspect ratio for the output.1. FFMPEG program 2. File to convert 3. Arguments that will change the aspect of the output file 4. Location and name of the output file http://www.prodigyview.com
  9. 9. Changing File FormatsUp until now, we’ve been working within the same format,mp4. FFMPEG is a great piece of software because youeasily change the formats of the video file by changing theextension. 3. Change the video to an avi
  10. 10. Cropping a VideoIn this example, we are going to change video formats andalso crop the video. Looking at the documentation forffmpeg, we have croptop, cropbottom, cropleft, cropright. 1. Arguments for cropping the video 2. Change the video format to an avi http://www.prodigyview.com
  11. 11. Padding In this last example, we will add some padding to the video, and set the color of the padding. By now, you should understand the pattern that goes into converting a video.1. Use the exec function 2. The location of the file 3.Arguments that addand location of the to convert padding to the outputffmpeg program file 4. Location and name of the output file 5. Change format of the output file http://www.prodigyview.com
  12. 12. FFMPEG DocumentsThe arguments used here is only an example of the ffmpegarguments available. For more information on ffmpeg, visit:http://ffmpeg.org/ffmpeg.html#Video-Options Review 1. FFMPEG must be installed to be used. 2. exec function can be used to access ffmpeg. 3. Ffmpeg follows the format of “ffmpeg –i input_file.ext output_file.ext” 4. Arguments must be added before the file that they are going to affect. 5. Change the file format by changing the extension of the output file
  13. 13. More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com

×