Audio Conversions PHP

1,099 views
1,019 views

Published on

Learn how to compress audio files with PVAudio and compress audio files.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,099
On SlideShare
0
From Embeds
0
Number of Embeds
20
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Audio Conversions PHP

  1. 1. Audio Conversion www.prodigyview.com
  2. 2. OverviewObjectiveLearn how to convert audio files using PVAudio classRequirements Installed version of ffmpeg Understanding of ffmpeg from the ffmpeg tutorial Understanding of the definesEstimated Time10 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/Audio_Conversion.php http://www.prodigyview.com
  4. 4. Basic Conversion Basic conversion of audio files can be accomplished with the PVAudio class. We simply pass in the file the be converted and the location to save the outputted file.1. Location of the file to be converted 2. Location and name of the outputted file www.prodigyview.com
  5. 5. Converting FormatsConverting formats is very simple. The only thing that needs tobe done changing the extension of the output file, and theformat will be automatically changed. Remember that ouroriginal file was an .mp3 Change the extension to change the format of the file www.prodigyview.com
  6. 6. Add OptionsOur next step is adding options. Options can be added toboth the input and output files. In our example, we aregoing to add options to the output file by prefixing an theffmpeg option acodec with ‘output.’. 1. Add acodec to options of the output file 2. Pass options to conversion www.prodigyview.com
  7. 7. Compression Audio FilesFor the remainder of this tutorial, we are going to be compressingaudio files by changing the bit rate. There are various qualities whenconvertings files.1. CD Audio: The highest quality of audio.2. 320kbs: A very high quality of audio, barely distinguishable from the cd quality.3. 256kbs: A still very high quality of audio, hard to distinguish from the cd quality.4. 192kbs: Slight differences from the original cd audio.5. 160kbs: More notable difference in the quality and depth of the sound.6. 112kbs:Sound in the stage of very noticeably, quality is no where near as sharp.7. 96kbs: Poor quality of sound, considered radio quality.
  8. 8. Compression Example 1For a simple compression of sound we, are are going tostart by changing the bit rate to 160kbs. The ffmpegoption used is –ab.1. Set the audio bit rate to 160kbs 2. Pass options to conversion www.prodigyview.com
  9. 9. Compression Example 2For the next example, we no longer want the full song andwant a lesser quality. We can delay the start location with–ss option.1. Set the audio bit rate to 128kbs 2. Set the time to start converting 3. Pass options to conversion www.prodigyview.com
  10. 10. Compression Example 3For our last examples, we are going to add the ffmpegoption –t, that will set a limit on how much is converted.1. Set the audio bit rate to 96kbs 2. Set the time to start converting 3. Set the amount of time to convert for
  11. 11. API ReferenceFor a better understanding of the audiomanipulation, check out the api at the two links below.PVAudioFFMPEG API More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com

×