function video_install in Video 6.5
Same name and namespace in other branches
- 5 video.install \video_install()
- 6 video.install \video_install()
- 6.2 video.install \video_install()
- 6.3 video.install \video_install()
- 6.4 video.install \video_install()
- 7.2 video.install \video_install()
- 7 video.install \video_install()
Implementation of hook_install().
File
- ./
video.install, line 151 - Provides installation functions for video.module.
Code
function video_install() {
$t = get_t();
drupal_install_schema('video');
$paddingtext = '-vf "pad=!paddingwidth:!paddingheight:!paddingleft:!paddingtop:000000"';
$presetids = array();
db_query('INSERT INTO {video_preset} SET name="%s", extension="%s", filenamesuffix="%s", help="%s"', 'Flash', 'flv', '', $t('Creates files that play in any Flash player, including older versions.'));
$presetids['hq_flash'] = db_last_insert_id('video_preset', 'id');
db_query('INSERT INTO {video_preset_settings} SET presetid=%d, transcoder="%s", data = "%s"', $presetids['hq_flash'], 'video_localcommand', serialize(array(
'commands' => array(
'!cmd_path -y -i !videofile -s !widthx!height -r 15 -b 250 -ar 22050 -ab 48 ' . $paddingtext . ' !convertfile',
),
'useflvtool2' => 1,
)));
db_query('INSERT INTO {video_preset} SET name="%s", extension="%s", filenamesuffix="%s", help="%s"', 'HTML5 MP4', 'mp4', '', $t('Creates files that natively play in Internet Explorer 9+ and Google Chrome using HTML5 and in any other browser using Flash.'));
$presetids['html5_mp4'] = db_last_insert_id('video_preset', 'id');
db_query('INSERT INTO {video_preset_settings} SET presetid=%d, transcoder="%s", data = "%s"', $presetids['html5_mp4'], 'video_localcommand', serialize(array(
'commands' => array(
'!cmd_path -strict experimental -y -i !videofile -pass 1 -s !widthx!height -b 500k -threads 0 -vcodec libx264 ' . $paddingtext . ' -vpre slow_firstpass -an !convertfile',
'!cmd_path -strict experimental -y -i !videofile -pass 2 -s !widthx!height -b 500k -threads 0 -vcodec libx264 ' . $paddingtext . ' -vpre slow -acodec aac -ab 128k !convertfile',
),
'useqtfaststart' => variable_get('video_ffmpeg_enable_faststart', FALSE) ? 1 : 0,
)));
db_query('INSERT INTO {video_preset} SET name="%s", extension="%s", filenamesuffix="%s", help="%s"', 'HTML5 Ogg Theora / Vorbis', 'ogv', '', $t('Creates files that natively play in Firefox using HTML5.'));
$presetids['html5_ogv'] = db_last_insert_id('video_preset', 'id');
db_query('INSERT INTO {video_preset_settings} SET presetid=%d, transcoder="%s", data = "%s"', $presetids['html5_ogv'], 'video_localcommand', serialize(array(
'commands' => array(
'ffmpeg2theora --videobitrate 500 --max_size !widthx!height --output !convertfile !videofile',
),
)));
db_query('INSERT INTO {video_preset} SET name="%s", extension="%s", filenamesuffix="%s", help="%s"', 'HTML5 WebM', 'webm', '', $t('Creates files that natively play in Google Chrome using HTML5.'));
$presetids['html5_webm'] = db_last_insert_id('video_preset', 'id');
db_query('INSERT INTO {video_preset_settings} SET presetid=%d, transcoder="%s", data = "%s"', $presetids['html5_webm'], 'video_localcommand', serialize(array(
'commands' => array(
'!cmd_path -strict experimental -y -i !videofile -pass 1 -s !widthx!height -b 500k -threads 0 -vcodec libvpx -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -f webm ' . $paddingtext . ' -an -y NUL',
'!cmd_path -strict experimental -y -i !videofile -pass 2 -s !widthx!height -b 500k -threads 0 -vcodec libvpx -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -f webm ' . $paddingtext . ' -acodec libvorbis -ac 2 -y !convertfile',
),
)));
db_query('INSERT INTO {video_preset} SET name="%s", extension="%s", filenamesuffix="%s", help="%s"', 'iPhone MOV', 'mov', '', $t('Creates files that natively play on the iPhone using HTML5.'));
$presetids['iphone_mov'] = db_last_insert_id('video_preset', 'id');
db_query('INSERT INTO {video_preset_settings} SET presetid=%d, transcoder="%s", data = "%s"', $presetids['iphone_mov'], 'video_localcommand', serialize(array(
'commands' => array(
'!cmd_path -strict experimental -y -i !videofile -s !widthx!height -f mp4 -vcodec mpeg4 -maxrate 1000k -b 700k -qmin 3 -qmax 5 -bufsize 4096k -g 300 -acodec aac -ab 192k ' . $paddingtext . ' !convertfile',
),
'useqtfaststart' => 1,
)));
variable_set('vid_preset', array(
$presetids['hq_flash'],
$presetids['html5_mp4'],
));
}