Skip to content

Commit

Permalink
Allow forcing of transcode to lq VP8 even if input videos are HTML vi…
Browse files Browse the repository at this point in the history
…deo compatible
  • Loading branch information
yoe committed Mar 21, 2024
1 parent 4eefcd2 commit 74e93b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 2 additions & 0 deletions lib/SReview/Config/Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
28 changes: 15 additions & 13 deletions scripts/sreview-previews
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 74e93b9

Please sign in to comment.