Your SlideShare is downloading. ×
0
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
FFMPEG Video Basics for PHP Tutorial
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

FFMPEG Video Basics for PHP Tutorial

12,998

Published on

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

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
12,998
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
111
Comments
1
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. FFMPEG Basics http://www.prodigyview.com
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com

×