[mythtv] nuvexport problem with dvb files with fix!

George Styles george at ripnet.co.uk
Sun Nov 14 10:50:51 UTC 2004


OK, here it is with cvs diff -u (also attached)

(As a side note, imho even full perl programs are not 'easy to read', let 
alone patches containing snippets. Obviously a long way for me to go until I 
am comptent with perl!)

ps. Are there ANY docs about command line options for nuvexport except the 
source itself? if not, do you want me to write some up on a wiki somewhere 
as I work them out?

thanks

g

Index: cvs/nuvexport/mythtv/nuvinfo.pm
===================================================================
RCS file: /var/lib/mythcvs/nuvexport/mythtv/nuvinfo.pm,v
retrieving revision 1.2
diff -u -r1.2 nuvinfo.pm
--- cvs/nuvexport/mythtv/nuvinfo.pm     29 Sep 2004 21:17:58 -0000      1.2
+++ cvs/nuvexport/mythtv/nuvinfo.pm     14 Nov 2004 10:47:59 -0000
@@ -125,11 +125,25 @@
         $info{'video_type'} = 'MPEG';
     # Grab tcprobe info
         if ($program =~ /tcprobe$/) {
-            my $data = `$program -i '$file' 2>/dev/null`;
+            $info{'width'}=0;
+            my $amount=10;
+            my $data;
+            my $gotit = 0;
+            while (!$gotit) {
+                $data = `$program -H $amount -i '$file' 2>/dev/null`;
+                if ($data =~ (/frame\s+rate/)) {
+                    $gotit = 1;
+                }
+                $amount += 25;
+                # Sensible maximium
+                if ($amount > 2000) {
+                  die "Failed to read info from file using tcprobe\n\n";
+                }
+            }
             ($info{'width'}, $info{'height'}) = $data =~ 
/frame\s+size:\s+-g\s+(\d+)x(\d+)\b/m;
             ($info{'fps'})                  = $data =~ 
/frame\s+rate:\s+-f\s+(\d+(?:\.\d+)?)\b/m;
             ($info{'audio_sample_rate'}, $info{'audio_bits_per_sample'},
-             $info{'audio_channels'}) = $data =~ 
/audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
+            $info{'audio_channels'}) = $data =~ 
/audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
             if ($data =~ m/MPEG\s+(system|program)/i) {
                 $info{'mpeg_stream_type'}  = "\L$1";
             }


thanks

George

----- Original Message ----- 
From: "Chris Petersen" <lists at forevermore.net>
To: "Development of mythtv" <mythtv-dev at mythtv.org>
Sent: Sunday, November 14, 2004 6:52 AM
Subject: Re: [mythtv] nuvexport problem with dvb files with fix!


>> (This is my first patch - if ive done it wrong, can someone let me know 
>> please?)
>
> Please recreate this with "diff -u" or "cvs diff -u"  (the -u option 
> creates a format that's a bit easier to read.
>
> -Chris
>
>> I have found (and fixed) a 'bug' in nuvexport when it is used with some 
>> (but not all) of the files produced by my Nova-T card. It seems that 
>> sometimes the mpeg info is buried a little further into the file than 
>> tcprobe looks.
>>
>> When I run nuvinfo on the affected files, it fails to read the width, 
>> height or fps of the file, giving errors about Use of uninitialized value 
>> in concatenation (.) or string at /usr/local/bin/nuvinfo line 23.
>>
>> This seems to be because tcprobe fails to find any info in the file:
>>
>> (OUTPUT FROM tcprobe)
>>
>>  tcprobe -i 25728_20041113174700_20041113210000.nuv
>> [tcprobe] MPEG packetized elementary stream (PES)
>> [tcprobe] summary for 25728_20041113174700_20041113210000.nuv, (*) = not 
>> default, 0 = not detected
>>       audio track: -a 0 [0] -e 48000,16,2 [48000,16,2] -n 0x50 [0x2000] 
>> (*)
>>                    PTS=26671.7783, bitrate=192 kbps
>> detected (7) presentation unit(s) (SCR reset)
>>
>> running with -H 100 seems to fix it. (this causes it to parse the first 
>> 100 megs, instead of a little bit). Therefore, what is needed is for 
>> nuvinfo to keep looping round with greater and greater values of -H until 
>> it either finds the info, or hits a maximium (which I have made 2gigs).
>>
>> The patch is as follows: (also attached as a text file)
>>
>> Index: cvs/nuvexport/mythtv/nuvinfo.pm
>> ===================================================================
>> RCS file: /var/lib/mythcvs/nuvexport/mythtv/nuvinfo.pm,v
>> retrieving revision 1.2
>> diff -r1.2 nuvinfo.pm
>> 128c128,142
>> <             my $data = `$program -i '$file' 2>/dev/null`;
>> ---
>>
>>>            $info{'width'}=0;
>>>            my $amount=10;
>>>            my $data;
>>>            my $gotit = 0;
>>>            while (!$gotit) {
>>>                $data = `$program -H $amount -i '$file' 2>/dev/null`;
>>>                if ($data =~ (/frame\s+rate/)) {
>>>                    $gotit = 1;
>>>                }
>>>                $amount += 25;
>>>                # Sensible maximium
>>>                if ($amount > 2000) {
>>>                  die "Failed to read info from file using tcprobe\n\n";
>>>                }
>>>            }
>>
>> 132c146
>> <              $info{'audio_channels'}) = $data =~ 
>> /audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
>> ---
>>
>>>            $info{'audio_channels'}) = $data =~ 
>>> /audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
>>
>>
>>
>> Could we patch the file nuvinfo.pm to have a larger value for -H please?
>>
>> thanks
>>
>> g
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: cvs/nuvexport/mythtv/nuvinfo.pm
>> ===================================================================
>> RCS file: /var/lib/mythcvs/nuvexport/mythtv/nuvinfo.pm,v
>> retrieving revision 1.2
>> diff -r1.2 nuvinfo.pm
>> 128c128,142
>> <             my $data = `$program -i '$file' 2>/dev/null`;
>> ---
>>
>>>            $info{'width'}=0;
>>>            my $amount=10;
>>>            my $data;
>>>            my $gotit = 0;
>>>            while (!$gotit) {
>>>                $data = `$program -H $amount -i '$file' 2>/dev/null`;
>>>                if ($data =~ (/frame\s+rate/)) {
>>>                    $gotit = 1;
>>>                }
>>>                $amount += 25;
>>>                # Sensible maximium
>>>                if ($amount > 2000) {
>>>                  die "Failed to read info from file using tcprobe\n\n";
>>>                }
>>>            }
>>
>> 132c146
>> <              $info{'audio_channels'}) = $data =~ 
>> /audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
>> ---
>>
>>>            $info{'audio_channels'}) = $data =~ 
>>> /audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>_______________________________________________
>>>mythtv-dev mailing list
>>>mythtv-dev at mythtv.org
>>>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev 
-------------- next part --------------
Index: cvs/nuvexport/mythtv/nuvinfo.pm
===================================================================
RCS file: /var/lib/mythcvs/nuvexport/mythtv/nuvinfo.pm,v
retrieving revision 1.2
diff -u -r1.2 nuvinfo.pm
--- cvs/nuvexport/mythtv/nuvinfo.pm     29 Sep 2004 21:17:58 -0000      1.2
+++ cvs/nuvexport/mythtv/nuvinfo.pm     14 Nov 2004 10:47:59 -0000
@@ -125,11 +125,25 @@
         $info{'video_type'} = 'MPEG';
     # Grab tcprobe info
         if ($program =~ /tcprobe$/) {
-            my $data = `$program -i '$file' 2>/dev/null`;
+            $info{'width'}=0;
+            my $amount=10;
+            my $data;
+            my $gotit = 0;
+            while (!$gotit) {
+                $data = `$program -H $amount -i '$file' 2>/dev/null`;
+                if ($data =~ (/frame\s+rate/)) {
+                    $gotit = 1;
+                }
+                $amount += 25;
+                # Sensible maximium
+                if ($amount > 2000) {
+                  die "Failed to read info from file using tcprobe\n\n";
+                }
+            }
             ($info{'width'}, $info{'height'}) = $data =~ /frame\s+size:\s+-g\s+(\d+)x(\d+)\b/m;
             ($info{'fps'})                  = $data =~ /frame\s+rate:\s+-f\s+(\d+(?:\.\d+)?)\b/m;
             ($info{'audio_sample_rate'}, $info{'audio_bits_per_sample'},
-             $info{'audio_channels'}) = $data =~ /audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
+            $info{'audio_channels'}) = $data =~ /audio\s+track:.+?-e\s+(\d+),(\d+),(\d+)\b/m;
             if ($data =~ m/MPEG\s+(system|program)/i) {
                 $info{'mpeg_stream_type'}  = "\L$1";
             }


More information about the mythtv-dev mailing list