You are here

public function PHPVideoToolkit::extractAudio in Video 7.2

Same name and namespace in other branches
  1. 7 libraries/phpvideotoolkit/phpvideotoolkit.php5.php \PHPVideoToolkit::extractAudio()

This is an alias for setFormat, but restricts it to audio only formats.

@access public

Parameters

integer $format A supported audio format.:

integer $audio_sample_frequency:

integer $audio_bitrate:

File

libraries/phpvideotoolkit/phpvideotoolkit.php5.php, line 1320
Libary to access FFmpeg

Class

PHPVideoToolkit

Code

public function extractAudio($format = PHPVideoToolkit::FORMAT_MP3, $audio_sample_frequency = 44100, $audio_bitrate = 64) {

  // 			check the format is one of the audio formats
  if (!in_array($format, array(
    self::FORMAT_AAC,
    self::FORMAT_AIFF,
    self::FORMAT_MP2,
    self::FORMAT_MP3,
    self::FORMAT_MP4,
    self::FORMAT_MPEG4,
    self::FORMAT_M4A,
    self::FORMAT_WAV,
  ))) {
    return $this
      ->_raiseError('extractAudio_valid_format', array(
      'format' => $format,
    ));

    // <-			exits
  }
  $this
    ->setFormat($format);

  //			adjust the audio rates
  $this
    ->setAudioBitRate($audio_bitrate);
  $this
    ->setAudioSampleFrequency($audio_sample_frequency);
}