Updated nuvexport patch

Share

To get nuvexport working with MythTV User Jobs as a transcoder, I needed to further modify my nuvexport patch to handle the fact that there is no controlling terminal for user jobs. Here is the new patch:

    Index: export/ffmpeg.pm
    ===================================================================
    --- export/ffmpeg.pm    (revision 242)
    +++ export/ffmpeg.pm    (working copy)
    @@ -70,11 +70,11 @@
         # Audio only?
             $self->{'audioonly'} = $audioonly;
         # Gather the supported codecs
    -        my $data      = `$ffmpeg -formats 2>/dev/null`;
    +        my $data      = `$ffmpeg -formats 2>&1`;
             my ($formats) = $data =~ /(?:^|\n\s*)File\sformats:\s*\n(.+?\n)\s*\n/s;
             my ($codecs)  = $data =~ /(?:^|\n\s*)Codecs:\s*\n(.+?\n)\s*\n/s;
             if ($formats) {
    -            while ($formats =~ /^\s(..)\s(\S+)\s*$/mg) {
    +            while ($formats =~ /^\s(.{2})\s(\S+).*$/mg) {
                     $self->formats'}{$2} = $1;
                 }
             }
    @@ -286,7 +286,7 @@
             push @tmpfiles, "/tmp/fifodir_$$", "/tmp/fifodir_$$/audout", "/tmp/fifodir_$$/vidout";
    
         # Execute ffmpeg
    -        print "Starting ffmpeg.\n" unless ($DEBUG);
    +        print "Starting ffmpeg: $ffmpeg\n" unless ($DEBUG);
             ($ffmpeg_pid, $ffmpeg_h) = fork_command("$ffmpeg 2>&1");
             $children{$ffmpeg_pid} = 'ffmpeg' if ($ffmpeg_pid);
    
    Index: export/ffmpeg/PSP.pm
    ===================================================================
    --- export/ffmpeg/PSP.pm        (revision 242)
    +++ export/ffmpeg/PSP.pm        (working copy)
    @@ -170,7 +170,8 @@
             $self->{'ffmpeg_xtra'}  = ' -b ' . $self->{'v_bitrate'}
                                      .' -bufsize 65535'
                                      .' -ab 32 -acodec aac'
    -                                 ." -f psp -title $safe_title";
    +                                 ." -f psp -title $safe_title"
    +                                 .' -ar 24000';
         # Execute the parent method
             $self->SUPER::export($episode, '.MP4');
    
    Index: nuv_export/shared_utils.pm
    ===================================================================
    --- nuv_export/shared_utils.pm  (revision 242)
    +++ nuv_export/shared_utils.pm  (working copy)
    @@ -66,7 +66,11 @@
             $termios->getattr;
             $OSPEED = $termios->getospeed;
         };
    -    our $terminal = Term::Cap->Tgetent({OSPEED=>OSPEED});
    +
    +    my $terminal = Null; # This is the controlling terminal
    +    eval {
    +        $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED});
    +    };
    
     # Gather info about how many cpu's this machine has
         if (-e '/proc/cpuinfo') {
    @@ -85,7 +89,16 @@
    
     # Clear the screen
         sub clear {
    -        print $DEBUG ? "\n" : $terminal->Tputs('cl');
    +        print $terminal;
    +        if ($DEBUG) {
    +            print "\n";
    +        }
    +        elsif ($terminal ne Null ) {
    +            $terminal->Tputs('cl');
    +        }
    +        else {
    +            print "\n";
    +        }
         }
    
     # Byte swap a 32-bit number from little-endian to big-endian
    Index: nuv_export/ui.pm
    ===================================================================
    --- nuv_export/ui.pm    (revision 242)
    +++ nuv_export/ui.pm    (working copy)
    @@ -380,6 +380,7 @@
                 $count++;
                 $query .= (' ' x (3 - length($count)))."$count. ".$exporter->{'name'};
                 $query .= ' (disabled)' unless ($exporter->{'enabled'});
    +            $query .= "\n\t\tErrors: @{$exporter->{'errors'}}\n" unless ($exporter->{'enabled'});
                 $query .= "\n";
             }
             $query .= "\n  q. Quit\n\nChoose a function: ";
    

You can download the patch from here.

Update: Isn’t it always the way? Once I had the patch posted I bothered to get a new SVN version, and noticed that some of my patches had been included there. Here’s a new version of the nuvexport patch which will cleanly apply:

    Index: export/ffmpeg.pm
    ===================================================================
    --- export/ffmpeg.pm	(revision 271)
    +++ export/ffmpeg.pm	(working copy)
    @@ -300,7 +300,7 @@
                 $children{$cat_pid} = 'audio dump' if ($cat_pid);
             }
         # Execute ffmpeg
    -        print "Starting ffmpeg.\n" unless ($DEBUG);
    +        print "Starting ffmpeg: $ffmpeg\n" unless ($DEBUG);
             ($ffmpeg_pid, $ffmpeg_h) = fork_command("$ffmpeg 2>&1");
             $children{$ffmpeg_pid} = 'ffmpeg' if ($ffmpeg_pid);
    
    Index: export/ffmpeg/PSP.pm
    ===================================================================
    --- export/ffmpeg/PSP.pm	(revision 271)
    +++ export/ffmpeg/PSP.pm	(working copy)
    @@ -170,7 +170,8 @@
             $self->ffmpeg_xtra'}  = ' -b ' . $self->{'v_bitrate'}
                                      .' -bufsize 65535'
                                      .' -ab 32 -acodec aac'
    -                                 ." -f psp -title $safe_title";
    +                                 ." -f psp -title $safe_title"
    +                                 .' -ar 24000';
         # Execute the parent method
             $self->SUPER::export($episode, '.MP4');
    
    Index: nuv_export/shared_utils.pm
    ===================================================================
    --- nuv_export/shared_utils.pm	(revision 271)
    +++ nuv_export/shared_utils.pm	(working copy)
    @@ -66,7 +66,11 @@
             $termios->getattr;
             $OSPEED = $termios->getospeed;
         };
    -    our $terminal = Term::Cap->Tgetent({OSPEED=li>$OSPEED});
    +
    +    my $terminal = Null; # This is the controlling terminal
    +    eval {
    +        $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED});
    +    };
    
     # Gather info about how many cpu's this machine has
         if (-e '/proc/cpuinfo') {
    @@ -85,7 +89,15 @@
    
     # Clear the screen
         sub clear {
    -        print $DEBUG ? "\n" : $terminal->Tputs('cl');
    +        if ($DEBUG) {
    +            print "\n";
    +        }
    +        elsif ($terminal ne Null ) {
    +            $terminal->Tputs('cl');
    +        }
    +        else {
    +            print "\n";
    +        }
         }
    
     # Byte swap a 32-bit number from little-endian to big-endian
    Index: nuv_export/ui.pm
    ===================================================================
    --- nuv_export/ui.pm	(revision 271)
    +++ nuv_export/ui.pm	(working copy)
    @@ -380,6 +380,7 @@
                 $count++;
                 $query .= (' ' x (3 - length($count)))."$count. ".$exporter->{'name'};
                 $query .= ' (disabled)' unless ($exporter->{'enabled'});
    +            $query .= "\n\t\tErrors: @{$exporter->{'errors'}}\n" unless ($exporter->{'enabled'});
                 $query .= "\n";
             }
             $query .= "\n  q. Quit\n\nChoose a function: ";
    

You can download the patch as well.

Share

PSP transcode working

Share

I’ve been having troubles getting PSP transcoding working with Mythtv for use on my TOWER Software memorial PSP. All it needed was this diff:

    Index: export/ffmpeg.pm
    ===================================================================
    --- export/ffmpeg.pm    (revision 242)
    +++ export/ffmpeg.pm    (working copy)
    @@ -70,11 +70,11 @@
         # Audio only?
             $self->{'audioonly'} = $audioonly;
         # Gather the supported codecs
    -        my $data      = `$ffmpeg -formats 2>/dev/null`;
    +        my $data      = `$ffmpeg -formats 2>&1`;
             my ($formats) = $data =~ /(?:^|\n\s*)File\sformats:\s*\n(.+?\n)\s*\n/s;
             my ($codecs)  = $data =~ /(?:^|\n\s*)Codecs:\s*\n(.+?\n)\s*\n/s;
             if ($formats) {
    -            while ($formats =~ /^\s(..)\s(\S+)\s*$/mg) {
    +            while ($formats =~ /^\s(.{2})\s(\S+).*$/mg) {
                     $self->{'formats'}{$2} = $1;
                 }
             }
    @@ -286,7 +286,7 @@
             push @tmpfiles, "/tmp/fifodir_$$", "/tmp/fifodir_$$/audout", "/tmp/fifodir_$$/vidout";
    
         # Execute ffmpeg
    -        print "Starting ffmpeg.\n" unless ($DEBUG);
    +        print "Starting ffmpeg: $ffmpeg\n" unless ($DEBUG);
             ($ffmpeg_pid, $ffmpeg_h) = fork_command("$ffmpeg 2>&1");
             $children{$ffmpeg_pid} = 'ffmpeg' if ($ffmpeg_pid);
    
    Index: export/ffmpeg/PSP.pm
    ===================================================================
    --- export/ffmpeg/PSP.pm        (revision 242)
    +++ export/ffmpeg/PSP.pm        (working copy)
    @@ -170,7 +170,8 @@
             $self->{'ffmpeg_xtra'}  = ' -b ' . $self->{'v_bitrate'}
                                      .' -bufsize 65535'
                                      .' -ab 32 -acodec aac'
    -                                 ." -f psp -title $safe_title";
    +                                 ." -f psp -title $safe_title"
    +                                 .' -ar 24000';
         # Execute the parent method
             $self->SUPER::export($episode, '.MP4');
    
    Index: nuv_export/ui.pm
    ===================================================================
    --- nuv_export/ui.pm    (revision 242)
    +++ nuv_export/ui.pm    (working copy)
    @@ -380,6 +380,7 @@
                 $count++;
                 $query .= (' ' x (3 - length($count)))."$count. ".$exporter->{'name'};
                 $query .= ' (disabled)' unless ($exporter->{'enabled'});
    +            $query .= "\n\t\tErrors: @{$exporter->{'errors'}}\n" unless ($exporter->{'enabled'});
                 $query .= "\n";
             }
             $query .= "\n  q. Quit\n\nChoose a function: ";
    

Nothing to it really. Oh, although the progress counter is still wrong, but I will work on that later. Now all I need to do is submit the diff…

Share

Transcoding using MythTV and the PSP

Share

I’ve been working on getting nuvexport to transcode my MythTV recordings to PSP in my spare time for the last couple of days and I think I am getting closer. I had to hack some of the nuvexport perl, and at least I now have all of the packages installed (would you believe that nuvexport doesn’t tell you what packages are missing?). I think that my final problem — which is that the video doesn’t work on the PSP. I suspect it has something to do with the ffmpeg command line. Check this out:

    Starting ffmpeg: /usr/bin/nice -n19 ffmpeg -f rawvideo -s 720x480 \
    -r 29.9700298309326 -i /tmp/fifodir_24287/vidout -f yuv4mpegpipe - \
    2> /dev/null | /usr/bin/nice -n19 yuvdenoise 2> /dev/null | \
    /usr/bin/nice -n19 ffmpeg -threads 2 -y -f s16le -ar 48000 -ac 2 \
    -i /tmp/fifodir_24287/audout -f yuv4mpegpipe -s 720x480 \
    -aspect 1.33333333333333 -r 29.9700298309326 -i - -aspect 1.3333 \
    -r 14.985 -deinterlace -croptop 10 -cropbottom 10 -cropleft 14 \
    -cropright 14 -s 320x240  -b 768 -bufsize 65535 -ab 32 -acodec aac \
    -f psp -title 'The Simpsons - The Sweetest Apu' \
    '/data/psp/The Simpsons - The Sweetest Apu.MP4'
    

I’ll keep you posted on when I get it working.

Share

UMD a failure?

Share

Is anyone really surprised that Sony’s UMD format is a failure? I was the lucky recipient of a PSP when I quit TOWER, and it came with a UMD disc for free. That I’ve never watched, never wanted to watch, and will almost certainly never want to watch. Why? Well, the movie is a good one (Spiderman), but why would I want to watch a format which is low resolution and expensive? I’d much rather transcode things for my PSP (although I am having troubles with MythTV and this at the moment) than buy the same content over and over, which seems to be Sony’s goal here.

Rule of thumb? Don’t release a new format unless it’s actually better than the existing ones.

Share

Procrastination

Share

In an effort to avoid actually packing for my little journey around the planet, I have found a Macintosh application which will convert video to the right format for the Play Station Portable. I haven’t had much joy with Linux just yet, but you can be sure that I will certainly let you know as soon as I experience any.

Oh, and I got a fantastic price on a 1gb memory stick duo from EB.

Share