11# !/usr/bin/perl -w
2- # Last Updated: 2005.02.15 (xris)
2+ # Last Updated: 2005.02.17 (xris)
33#
44# ffmpeg.pm
55#
@@ -16,14 +16,15 @@ package export::ffmpeg;
1616 use POSIX;
1717
1818 use nuv_export::shared_utils;
19+ use nuv_export::cli;
1920 use nuv_export::ui;
2021 use mythtv::recordings;
2122
2223# This superclass defines several object variables:
2324#
2425# path (defined by generic)
2526# use_cutlist (defined by generic)
26- # denoise
27+ # noise_reduction
2728# deinterlace
2829# crop
2930#
@@ -33,12 +34,12 @@ package export::ffmpeg;
3334 my $self = shift ;
3435 my $audioonly = (shift or 0);
3536 # Make sure we have ffmpeg
36- $Prog { ' ffmpeg' } = find_program(' ffmpeg' );
37- push @{$self -> {' errors' }}, ' You need ffmpeg to use this exporter.' unless ( $Prog { ' ffmpeg ' }) ;
37+ my $ ffmpeg = find_program(' ffmpeg' )
38+ or push @{$self -> {' errors' }}, ' You need ffmpeg to use this exporter.' ;
3839 # Audio only?
3940 $self -> {' audioonly' } = $audioonly ;
4041 # Gather the supported codecs
41- my $formats = ` $Prog {' ffmpeg'} -formats` ;
42+ my $formats = ` $ffmpeg -formats 2>/dev/null ` ;
4243 $formats =~ s / ^.+?\n\s *Codecs:\s *\n (.+?\n )\s *\n .*?$/ $1 / s ;
4344 while ($formats =~ / ^\s (.{6})\s (\S +)\s *$ /mg ) {
4445 $self -> {' codecs' }{$2 } = $1 ;
@@ -82,7 +83,7 @@ package export::ffmpeg;
8283 }
8384
8485 # Here, we have to fork off a copy of mythtranscode (no need to use --fifosync with transcode -- it seems to do this on its own)
85- $mythtranscode = " nice -n $Args {'nice'} mythtranscode --showprogress -p autodetect -c $episode ->{channel} -s $episode ->{start_time_sep} -f \" /tmp/fifodir_$$ /\" " ;
86+ $mythtranscode = " $NICE mythtranscode --showprogress -p autodetect -c $episode ->{channel} -s $episode ->{start_time_sep} -f \" /tmp/fifodir_$$ /\" " ;
8687 $mythtranscode .= ' --honorcutlist' if ($self -> {use_cutlist });
8788
8889 my $videofifo = " /tmp/fifodir_$$ /vidout" ;
@@ -104,12 +105,12 @@ package export::ffmpeg;
104105 else {
105106 # Do noise reduction
106107 if ($self -> {' noise_reduction' }) {
107- $ffmpeg .= " nice -n $Args {'nice'} ffmpeg -f rawvideo" ;
108+ $ffmpeg .= " $NICE ffmpeg -f rawvideo" ;
108109 $ffmpeg .= " -s " . $episode -> {' finfo' }{' width' } . " x" . $episode -> {' finfo' }{' height' };
109110 $ffmpeg .= " -r " . $episode -> {' finfo' }{' fps' };
110111 $ffmpeg .= " -i /tmp/fifodir_$$ /vidout -f yuv4mpegpipe -" ;
111112 $ffmpeg .= " 2> /dev/null | " ;
112- $ffmpeg .= " nice -n $Args {'nice'} yuvdenoise -F -r 16" ;
113+ $ffmpeg .= " $NICE yuvdenoise -F -r 16" ;
113114 if ($self -> {' crop' }) {
114115 $ffmpeg .= " -b $crop_w ,$crop_h ,-$crop_w ,-$crop_h " ;
115116 }
@@ -120,7 +121,7 @@ package export::ffmpeg;
120121 }
121122
122123 # Start the ffmpeg command
123- $ffmpeg .= " nice -n $Args {'nice'} ffmpeg" ;
124+ $ffmpeg .= " $NICE ffmpeg" ;
124125 if ($num_cpus > 1) {
125126 $transcode .= ' -threads ' .($num_cpus );
126127 }
0 commit comments