public function PHPVideoToolkit::setAudioCodec in Video 7
Same name and namespace in other branches
- 7.2 libraries/phpvideotoolkit/phpvideotoolkit.php5.php \PHPVideoToolkit::setAudioCodec()
* Sets the audio format for audio outputs * * @access public *
Parameters
integer $audio_codec Valid values are PHPVideoToolkit::FORMAT_AAC, PHPVideoToolkit::FORMAT_AIFF, PHPVideoToolkit::FORMAT_AMR, PHPVideoToolkit::FORMAT_ASF, PHPVideoToolkit::FORMAT_MP2, PHPVideoToolkit::FORMAT_MP3, PHPVideoToolkit::FORMAT_MP4, PHPVideoToolkit::FORMAT_MPEG2, PHPVideoToolkit::FORMAT_RM, PHPVideoToolkit::FORMAT_WAV: * @param boolean $validate_codec Queries ffmpeg to see if this codec is available to use. * @return boolean false on error encountered, true otherwise
1 call to PHPVideoToolkit::setAudioCodec()
- PHPVideoToolkit::setAudioFormat in libraries/
phpvideotoolkit/ phpvideotoolkit.php5.php - * @access public * @depreciated *
File
- libraries/
phpvideotoolkit/ phpvideotoolkit.php5.php, line 1415
Class
Code
public function setAudioCodec($audio_codec, $validate_codec = true) {
// validate input
if (!in_array($audio_codec, array(
self::FORMAT_AAC,
self::FORMAT_AIFF,
self::FORMAT_AMR,
self::FORMAT_ASF,
self::FORMAT_MP2,
self::FORMAT_MP3,
self::FORMAT_MP4,
self::FORMAT_MPEG2,
self::FORMAT_RM,
self::FORMAT_WAV,
))) {
//return $this->_raiseError('setAudioFormat_valid_format', array('format'=>$audio_codec));
//<- exits
}
// run a libmp3lame check as it require different mp3 codec
// updated thanks to Varon for providing the research
if ($audio_codec == self::FORMAT_MP3) {
$info = $this
->getFFmpegInfo(false);
if (isset($info['formats']['libmp3lame']) === true || in_array('--enable-libmp3lame', $info['binary']['configuration']) === true) {
$audio_codec = 'libmp3lame';
}
}
// do we need to validate this codec?
if ($validate_codec === true) {
if ($this
->canCodecBeEncoded('audio', $audio_codec) === false) {
return $this
->_raiseError('setAudioFormat_cannnot_encode', array(
'codec' => $audio_codec,
));
//<- exits
}
}
return $this
->addCommand('-acodec', $audio_codec);
}