Ticket #3064: mencoder-pm.patch

File mencoder-pm.patch, 3.6 KB (added by devsk, 14 years ago)

patch for export/mencoder.pm

  • mencoder.pm

    old new  
    4949    sub build_vop_line{
    5050        my $cmdline    = shift;
    5151        my $vop        = '';
    52         while($cmdline =~ m/.*?-vop\s+([^\s]+)\s/gs){
     52        while($cmdline =~ m/.*?-vf\s+([^\s]+)\s/gs){
    5353            $vop .= ",$1";
    5454        }
    5555        $vop =~ s/^,+//;
    5656        $vop =~ s/,+$//;
    57         $cmdline =~ s/-vop\s+[^\s]+\s/ /g;
    58         $cmdline .= " -vop $vop ";
     57        $cmdline =~ s/-vf\s+[^\s]+\s/ /g;
     58        $cmdline .= " -vf $vop " if ($vop);
    5959        return $cmdline;
    6060    }
    6161
     
    104104                         .':fps='.$episode->{'finfo'}{'fps'}
    105105                         ;
    106106        }
    107     # NOTE: this comes before the standard filters below, because
    108     # mencoder applies filters in reverse
    109     # Add any additional settings from the child module
    110         $mencoder .= ' '.$self->{'mencoder_xtra'};
     107        # the order of filters is: deint, crop, scale, denoise.
     108        if ($self->{'deinterlace'}) {
     109            $mencoder .= " -vf lavcdeint";
     110            #smartyuv|smartdeinter|dilyuvmmx
     111        }
    111112    # Crop?
    112113        if ($self->{'crop'}) {
    113114            my $t = sprintf('%.0f', ($self->val('crop_top')    / 100) * $episode->{'finfo'}{'height'});
     
    122123        # Figure out the new width/height
    123124            my $w = $episode->{'finfo'}{'width'}  - $r - $l;
    124125            my $h = $episode->{'finfo'}{'height'} - $t - $b;
    125             $mencoder .= " -vop crop=$w:$h:$l:$t " if ($t || $r || $b || $l);
     126            $mencoder .= " -vf crop=$w:$h:$l:$t " if ($t || $r || $b || $l);
     127            #$mencoder .= " ";
    126128        }
     129    # NOTE: this comes before the standard filters below, because
     130    # mencoder applies filters in order
     131    # Add any additional settings from the child module, this brings in scale.
     132        $mencoder .= ' '.$self->{'mencoder_xtra'};
    127133    # Use the cutlist?  (only for mpeg files -- nuv files are handled by mythtranscode)
    128134    # Can we cut with mencoder?
    129     # Filters (remember, mencoder reads these in reverse order (so deint should be last if used)
     135    # Filters (remember, mencoder reads these in order (so deint should be first if used)
    130136    # Normally you would do -vop filter1=<val>,filter2=<val>,lavcdeint...
    131137        if ($self->{'noise_reduction'}) {
    132138            $mencoder .= " -vf denoise3d";
    133139        }
    134         if ($self->{'deinterlace'}) {
    135             $mencoder .= " -vf lavcdeint";
    136             #smartyuv|smartdeinter|dilyuvmmx
    137         }
    138140    # Output directory set to null means the first pass of a multipass
    139141        if (!$self->{'path'} || $self->{'path'} =~ /^\/dev\/null\b/) {
    140142            $mencoder .= ' -o /dev/null';
     
    157159    #Fix -vop options before we execute mencoder
    158160        $mencoder = build_vop_line($mencoder);
    159161    # Execute mencoder
    160         print "Starting mencoder.\n" unless ($DEBUG);
     162        print "Starting $mencoder.\n" unless ($DEBUG);
    161163        ($mencoder_pid, $mencoder_h) = fork_command("$mencoder 2>&1");
    162164        $children{$mencoder_pid} = 'mencoder' if ($mencoder_pid);
    163165    # Get ready to count the frames that have been processed
     
    208210                }
    209211            }
    210212        # Has the deathtimer been started?  Stick around for awhile, but not too long
    211             if ($death_timer > 0 && time() - $death_timer > 30) {
     213            if ($death_timer > 0 && time() - $death_timer > 60) {
    212214                $str = "\n\n$last_death died early.";
    213215                if ($warnings) {
    214216                    $str .= "See mencoder warnings:\n\n$warnings";