[mythtv] Retrieving the actual length of a recorded show

Torbjörn Jansson torbjorn.jansson at mbox200.swipnet.se
Sun Apr 25 10:47:51 EDT 2004

mythtv-dev-bounces at mythtv.org <> wrote:
> Wayne Hogue wrote:
>> here is how I get the length:
>> "select MAX(mark) from recordedmarkup where chanid='$channel' and
>> starttime ='$syear$smonth$sday$shour$sminute$ssecond' and type='6'";
>> this will give you the key frame count.
>> minutes = ((keyframecount*keyframedistance)/framerate)*60)
> make that
> minutes = ((keyframecount*keyframedistance)/framerate)/60)
> -Wayne

I don't think this will work for all types of recordings.
Asuming the recording is not broken (backend crash) and you have a
nupplevideo type nuv file, the easiest is to parse the file and calculate
the length from the seektable.
You can probably get the seektable from the recordedmarkup table too, but
since you have to know the keyframedistance and framerate you have to read
the file header anyway.

Mpeg2 files is a different thing, I don't know much about them.
Maybe mpeg2 files can change framerate in the middle of the file, if so it
will be a bit harder to calculate the length.

I use the cvs version of mythtv, so I had to change "type=6" to a 7 in your
sql query.

More information about the mythtv-dev mailing list