That I forgot to put the slides from Stewart and my MythTV tutorial at LCA online. So, here they are, and sorry for the delay. You can also see the video of the tutorial here, and the homework we set here. Weirdly, there is even a remix video of the presentation.
Tag: mythtv
I just noticed…
That I forgot to put the slides from Stewart and my MythTV tutorial at LCA online. So, here they are, and sorry for the delay. You can also see the video of the tutorial here, and the homework we set here. Weirdly, there is even a remix video of the presentation.
Controlling DirecTV STB via USB
Might come in handy if I ever change pay TV provider in the US… DirecTV set top boxes are controllable via USB.
Random idea
I’m tired after a trip, so this is short and incoherent. You know how Sun used to hand out demo hardware for evals a couple of months ago? I wonder if they’d give me one to try MythTV backend on? I wonder if it would suck?
Updated nuvexport patch
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: ";
A side by side comparison of MythTV and Windows Media Center
PSP transcode working
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…
Transcoding using MythTV and the PSP
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.