diff --git a/lib/SReview/Config/Common.pm b/lib/SReview/Config/Common.pm index e3d1068..008c0ef 100644 --- a/lib/SReview/Config/Common.pm +++ b/lib/SReview/Config/Common.pm @@ -82,6 +82,8 @@ sub setup { $config->define('review_template', 'The template name to be used for the review page. Can be one of "full" (full editing capabilities) or "confirm" (confirmation only). Defaults to "full", unless the talk was injected, in which case it defaults to "confirm".', undef); $config->define('inject_fatal_checks', 'Checks to be run on an uploaded video. When a check fails, the upload is rejected. Same syntax as for inject_transcode_skip_checks.', {}); + $config->define('force_preview_transcode', 'If set to nonzero, forces sreview-previews to transcode the video, even if the input video file is HTML video compatible. Use this if the input video format uses a very large bitrate.', 0); + # Values for encoder scripts $config->define('pubdir', 'The directory on the file system where files served by the webinterface should be stored', '/srv/sreview/web/public'); $config->define('workdir', 'A directory where encoder jobs can create a subdirectory for temporary files', '/tmp'); diff --git a/scripts/sreview-previews b/scripts/sreview-previews index 4c66c5b..3c92d7a 100644 --- a/scripts/sreview-previews +++ b/scripts/sreview-previews @@ -66,19 +66,21 @@ sub convert($) { my $vc = $input->video_codec; my $ac = $input->audio_codec; - if (($vc eq "vp8" && $ac eq "vorbis") || ($vc eq "vp9" && $ac eq "vorbis") || ($vc eq "vp9" && $ac eq "opus")) { - my $output_file = $collection->add_file(relname => $relname . ".webm"); - my $output = Media::Convert::Asset->new(url => $output_file->filename); - Media::Convert::Pipe->new(inputs => [$input], output => $output, vcopy => 1, acopy => 1)->run(); - $output_file->store_file; - return; - } - if ($vc eq "h264" && $ac eq "aac") { - my $output_file = $collection->add_file(relname => $relname . ".mp4"); - my $output = Media::Convert::Asset->new(url => $output_file->filename); - Media::Convert::Pipe->new(inputs => [$input], output => $output, vcopy => 1, acopy => 1)->run(); - $output_file->store_file; - return; + if (!$config->force_preview_transcode) { + if (($vc eq "vp8" && $ac eq "vorbis") || ($vc eq "vp9" && $ac eq "vorbis") || ($vc eq "vp9" && $ac eq "opus")) { + my $output_file = $collection->add_file(relname => $relname . ".webm"); + my $output = Media::Convert::Asset->new(url => $output_file->filename); + Media::Convert::Pipe->new(inputs => [$input], output => $output, vcopy => 1, acopy => 1)->run(); + $output_file->store_file; + return; + } + if ($vc eq "h264" && $ac eq "aac") { + my $output_file = $collection->add_file(relname => $relname . ".mp4"); + my $output = Media::Convert::Asset->new(url => $output_file->filename); + Media::Convert::Pipe->new(inputs => [$input], output => $output, vcopy => 1, acopy => 1)->run(); + $output_file->store_file; + return; + } } my $profile = Media::Convert::Asset::ProfileFactory->create('vp8_lq', $input, $config->get('extra_profiles')); my $output_file = $collection->add_file(relname => $relname . ".webm");