[mythtvnz] Fixing duration errors
David Moore
dmoo1790 at ihug.co.nz
Sat May 19 09:03:27 BST 2012
Not sure if this email reached the list or not so here it is again with
different subject.
-------- Original Message --------
Subject: Re: [mythtvnz] Upgrading to 0.25 from 0.23
Date: Wed, 16 May 2012 19:22:56 +1200
From: David Moore <dmoo1790 at bigpond.net.au>
To: MythTV in NZ <mythtvnz at lists.linuxnut.co.nz>
On 16/05/12 12:27, David Moore wrote:
> On 27/04/12 17:41, David Moore wrote:
>>
>>
>> On 27/04/12 17:08, David Moore wrote:
>>> On 27/04/12 16:44, Steven Ellis wrote:
>>>>
>>>> On Fri, April 27, 2012 4:01 pm, David Moore wrote:
>>>>> I was finally forced to upgrade from 0.23 due to the audio glitch on
>>>>> Prime. Could have patched 0.23 I suppose but decided to bite the
>>>>> bullet
>>>>> and go to 0.25. Works fairly well as far as I have tested so far.
>>>>> Thanks
>>>>> to fellow listers for setup/bugfix clues and myth devs for rapid
>>>>> repairs
>>>>> to code.
>>>>>
>>>>> I am seeing incorrect video lengths on some old recordings.
>>>>> Annoying. I
>>>>> have noticed in the past that this could be a seek table issue. I
>>>>> found
>>>>> in the past that using mythcommflag to rebuild the seek table for
>>>>> some
>>>>> recordings produced incorrect time codes. Forget the details but
>>>>> had to
>>>>> divide seek table entries by two to fix.
>>>>
>>>>
>>>> Hi David
>>>>
>>>> I've been using the following to fix seektables. I've found that
>>>> mythtranscode was a lot more reliable than mythcommflag and I now
>>>> have a
>>>> user job I can easily select when I've got a broken video file.
>>>>
>>>> http://www.mythtv.org/wiki/Repairing_the_Seektable#Automation_of_mythcommflag_repair_function
>>>>
>>>>
>>>>
>>>> --------------------------------------------
>>>> Steven Ellis - Technical Director
>>>> OpenMedia Limited - The Home of myPVR
>>>> email - steven at openmedia.co.nz
>>>> website - http://www.openmedia.co.nz
>>>
>>> Hi Steven, Yes, that will be my last resort method. Thing is I don't
>>> think it's necessary as I don't think the actual seek table values
>>> get updated. Makes sense because the files are seekable but just
>>> have wrong durations. I think the fix is in recordedmarkup but need
>>> to figure out how to generate correct values. Reason I think this is
>>> I noticed the files rebuilt had new rows in recordedmarkup. If we
>>> can work out the correct values then a real fast sql patchup would
>>> do the trick much faster than mythcommflag.
>>
>> Doesn't look like this will work. Looks like new recordedmarkup
>> entries are time and frame number for end of file. Can't work these
>> out myself. But better idea is use the database backup I made before
>> upgrading. If this has the correct info in recordedmarkup and I can
>> figure out how to extract it without overwriting/dropping existing
>> tables then should be a quickish fix.
>
> I had another idea which works and is pretty quick and easy. Here are
> the steps:
>
> 1. Get the video duration in ms using mediainfo: mediainfo
> --Inform=Video\;%Duration% 1001_20110619145800.mpg
> 2. Add two rows to the recordedmarkup table:
> insert into recordedmarkup set
> chanid=1001,starttime="2011-06-19 14:58:00",mark=1,type=32,data=25000;
> insert into recordedmarkup set
> chanid=1001,starttime="2011-06-19 14:58:00",mark=1,type=33,data=3447720;
>
> Done. The data value for the first row is always 25000. The data value
> for the second row is the video duration in ms obtained from mediainfo.
Looks like the 25000 data value is not needed. Here is the script I used
to update 140 shows in about 2 minutes:
#!/bin/bash
storage_dirs=$(mysql -u root mythconverg -sN -e 'select dirname from
storagegroup;')
files=$(mysql -u root mythconverg -sN -e 'select basename from recorded
where chanid=1001 and starttime< "2012-04-03" order by basename desc;')
echo $files
echo $starts
for basename in $files; do
found=0
for f in $storage_dirs; do
if [ -f "$f$basename" ]; then
rec_dir=$f
found=1
fi
done
if [ $found == 0 ]; then
echo "Can't find recording "$CHANID" "$STARTTIME"">&2
else
echo "Found recording: "$rec_dir$basename
duration=$(mediainfo --Inform=Video\;%Duration% $rec_dir$basename)
echo $duration
start=$(mysql -u root mythconverg -sN -e "select starttime from
recorded where chanid=1001 and basename=\"$basename\";")
echo $start
mysql -u root mythconverg -e "insert into recordedmarkup set
chanid=1001,starttime=\"$start\",mark=1,type=33,data=$duration;"
fi
done
More information about the mythtvnz
mailing list