function video_ffmpeg_helper_admin_settings in Video 6.2
Same name and namespace in other branches
- 5 plugins/video_ffmpeg_helper/video_ffmpeg_helper.module \video_ffmpeg_helper_admin_settings()
- 6 plugins/video_ffmpeg_helper/video_ffmpeg_helper.module \video_ffmpeg_helper_admin_settings()
Settings form
1 string reference to 'video_ffmpeg_helper_admin_settings'
- video_ffmpeg_helper_menu in plugins/
video_ffmpeg_helper/ video_ffmpeg_helper.module - Implementation of hook_menu()
File
- plugins/
video_ffmpeg_helper/ video_ffmpeg_helper.module, line 88 - Provide some api for use ffmpeg. Simplify video nodes creation.
Code
function video_ffmpeg_helper_admin_settings() {
// let's execute after video_image and video_upload
if (module_exists('video_image') && variable_get('video_image_auto_thumbnail', 0)) {
$weight = db_result(db_query("SELECT weight FROM {system} WHERE name='video_image'"));
}
else {
// video_image might be disabled.. execute after video_upload
$weight = db_result(db_query("SELECT weight FROM {system} WHERE name='video_upload'"));
}
// update the weight in the system table
db_query("UPDATE {system} SET weight=" . ($weight + 1) . " WHERE name='video_ffmpeg_helper'");
$form['video_ffmpeg_helper_ffmpeg_path'] = array(
'#type' => 'textfield',
'#title' => t('FFmpeg executable path'),
'#description' => t('Set the full path to the ffmpeg executable here.'),
'#default_value' => variable_get('video_ffmpeg_helper_ffmpeg_path', '/usr/bin/ffmpeg'),
);
$form['video_ffmpeg_helper_auto_resolution'] = array(
'#type' => 'checkbox',
'#title' => t('Enable resolution helper'),
'#description' => t('Use ffmpeg Helper to automatically get the resolution from the video.'),
'#default_value' => variable_get('video_ffmpeg_helper_auto_resolution', false),
);
$form['video_ffmpeg_helper_auto_playtime'] = array(
'#type' => 'checkbox',
'#title' => t('Enable playtime helper'),
'#description' => t('Use ffmpeg Helper to automaticcally get the playtime from the video.'),
'#default_value' => variable_get('video_ffmpeg_helper_auto_playtime', false),
);
$form['autothumb'] = array(
'#type' => 'fieldset',
'#title' => t('Automatic video thumbnailing'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['autothumb']['video_ffmpeg_helper_thumbnailer_options'] = array(
'#type' => 'textfield',
'#title' => t('Video thumbnailer options'),
'#description' => t('Provide the options for the thumbnailer. Available argument values are: ') . '<ol><li>' . t('%videofile (the video file to thumbnail)') . '<li>' . t('%thumbfile (a newly created temporary file to overwrite with the thumbnail)') . '<li>' . t('%seek (seconds to seek into video before extracting image).') . '</ol>' . t('Only the first two are mandatory. For example, older versions of ffmpeg should use something like: !old While newer versions should use something like: !new', array(
'!old' => "<div>-i %videofile -y -an -f mjpeg -ss %seek -t 0.001 %thumbfile</div>",
'!new' => '<div>-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile</div>',
)),
'#default_value' => variable_get('video_ffmpeg_helper_thumbnailer_options', '-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile'),
);
$form['autothumb']['video_ffmpeg_helper_auto_thumbnail_seek'] = array(
'#type' => 'textfield',
'#title' => t('Video seek offset for thumbnail'),
'#description' => t('Time in seconds to seek into video before extracting the thumbnail'),
'#default_value' => variable_get('video_ffmpeg_helper_auto_thumbnail_seek', 2),
);
// automatic video conversion settings
$form['autoconv'] = array(
'#type' => 'fieldset',
'#title' => t('Automatic video conversion'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['autoconv']['video_ffmpeg_helper_auto_cvr_cron'] = array(
'#type' => 'checkbox',
'#title' => t('Use drupal cron for autoconversion'),
'#description' => t('Click this if you want to execute the video_scheduler.php from the standard drupal cron. If you want to use distributed encodings you might want to disable this.'),
'#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_cron', FALSE),
);
$form['autoconv']['video_ffmpeg_helper_auto_conversion'] = array(
'#type' => 'checkbox',
'#title' => t('Auto conversion for videos'),
'#description' => t('If set up correctly, this will auto-convert each uploaded video to the configured format.') . '<br />' . t("IMPORTANT: you will need the video_render.php correctly configured and run by cron. See README.txt in the video_ffmpeg_helper folder or <a title='User Guide' href='http://video.heidisoft.com/docs/users-guide-26'>click here</a> for more informations."),
'#default_value' => variable_get('video_ffmpeg_helper_auto_conversion', TRUE),
);
$form['autoconv']['video_ffmpeg_helper_auto_cvr_width'] = array(
'#type' => 'textfield',
'#title' => t('Video rendering width'),
'#description' => t('The width of the converted video. The height will be automatically calculated to maintain aspect ratio.'),
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_width', 400),
);
$form['autoconv']['video_ffmpeg_helper_auto_cvr_video_bitrate'] = array(
'#type' => 'textfield',
'#title' => t('Video bitrate'),
'#description' => t('The video bitrate in bit/s of the converted video.'),
'#size' => 10,
'#maxlength' => 10,
'#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', 200000),
);
$form['autoconv']['video_ffmpeg_helper_auto_cvr_audio_bitrate'] = array(
'#type' => 'textfield',
'#title' => t('Audio bitrate'),
'#description' => t('The audio bitrate in bit/s of the converted video.'),
'#size' => 10,
'#maxlength' => 10,
'#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', 64000),
);
$form['autoconv']['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['autoconv']['advanced']['video_ffmpeg_helper_auto_cvr_options'] = array(
'#type' => 'textfield',
'#title' => t('Video converter options'),
'#description' => t('Provide the ffmpeg options to configure the video conversion. Available argument values are: ') . '<ul>' . '<li>' . t('%videofile (the video file to convert)') . '<li>' . t('%convertfile (a newly created file to store the converted file)') . '<li>' . t('%size (video resolution of the converted file)') . '</ul>' . t('For further informations refer to the !ffmpegdoc', array(
'!ffmpegdoc' => l(t('Official FFMpeg documentation.'), 'http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html', array(
'fragment' => TRUE,
)),
)),
'#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_options', '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate -qscale 1 %convertfile'),
);
return system_settings_form($form);
}