Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

MPEG4 and seektables

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


david.asher at caviumnetworks

Mar 17, 2006, 8:57 AM

Post #1 of 5 (925 views)
Permalink
MPEG4 and seektables

I started using Steve Adeff's tv.com script (thanks Steve!) to load some
videos into the MythTV database.

The are MPEG4 .avi's. They play fine, but seeking is terrible. I kinda
expected that since there was no seek table.

So, I thought: "lets create a seek table for them". I tried:

$ mythcommflag --rebuild -f <avifile>

This acted like it was working, but the resulting seek table is horribly
broken.

I get all sorts of blocky artifacts (BIG blocks), and when first
entering the playback after saving position on exit I get a black screen
which slowly fills in -- sounds like we didn't start on a keyframe?

On starting playback I see (-v playback):

2006-03-16 22:51:40.079 Resyncing position map. posmapStarted = 0
livetv(0) watchingRec(0)
2006-03-16 22:51:40.096 Position map filled from DB to: 59546
2006-03-16 22:51:40.096 SyncPositionMap prerecorded, from DB: 769 entries
2006-03-16 22:51:40.096 SyncPositionMap, new totframes: 59546, new
length: 2483, posMap size: 769
2006-03-16 22:51:40.096 AFD: Position map found

on FF I get:

[mpeg4 @ 0x1191a84]warning: first frame is no keyframe

So, I'm thinking the key frames weren't correctly found.

I've got 2 questions:

1. should i expect seek table generation to work for an MPEG4 ?

2. what is the difference between the --video and --rebuild -f options
for creating the seek table?

Thanks,

David.
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david.asher at caviumnetworks

Mar 17, 2006, 8:30 PM

Post #2 of 5 (867 views)
Permalink
Re: MPEG4 and seektables [In reply to]

I've done some more research into this.

I looked for another way to find keyframes other than mythcommflag. I
found aviindex from transcode-1.0.2. So, just for fun I had it generate
a list of key frames and inserted the key frames it found into the
recordedmarkup table. Lo-and-behold the video seeking is perfect.

Interestingly, it found roughly the same number of keyframes (771 vs 769
for mythcommflag), but their positions are completely different.

Unfortunately, all is not right: after seeking @ >= 20x when I go back
to normal play speed the audio is badly out of sync. If I exit (saving
the position) and return it syncs the video to where the audio was
perfectly. (i.e. it starts in the correct place for the last audio that
was heard, not for the last video seen)

So, my next step is to understand why I'm getting this audio sync
problem. Then, hopefully, I'll have a good enough understanding of how
this all works to figure out why mythcommflag's seek table isn't really
pointing to key frames.

Any tips on looking into these issues would be greatly appreciated.

Thanks,

David.

P.S. I'm running SVN 9372.

David Asher wrote:
> I started using Steve Adeff's tv.com script (thanks Steve!) to load
> some videos into the MythTV database.
>
> The are MPEG4 .avi's. They play fine, but seeking is terrible. I
> kinda expected that since there was no seek table.
>
> So, I thought: "lets create a seek table for them". I tried:
>
> $ mythcommflag --rebuild -f <avifile>
>
> This acted like it was working, but the resulting seek table is
> horribly broken.
>
> I get all sorts of blocky artifacts (BIG blocks), and when first
> entering the playback after saving position on exit I get a black
> screen which slowly fills in -- sounds like we didn't start on a
> keyframe?
>
> On starting playback I see (-v playback):
>
> 2006-03-16 22:51:40.079 Resyncing position map. posmapStarted = 0
> livetv(0) watchingRec(0)
> 2006-03-16 22:51:40.096 Position map filled from DB to: 59546
> 2006-03-16 22:51:40.096 SyncPositionMap prerecorded, from DB: 769 entries
> 2006-03-16 22:51:40.096 SyncPositionMap, new totframes: 59546, new
> length: 2483, posMap size: 769
> 2006-03-16 22:51:40.096 AFD: Position map found
>
> on FF I get:
>
> [mpeg4 @ 0x1191a84]warning: first frame is no keyframe
>
> So, I'm thinking the key frames weren't correctly found.
>
> I've got 2 questions:
>
> 1. should i expect seek table generation to work for an MPEG4 ?
>
> 2. what is the difference between the --video and --rebuild -f options
> for creating the seek table?
>
> Thanks,
>
> David.
>
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


mtdean at thirdcontact

Mar 17, 2006, 11:48 PM

Post #3 of 5 (879 views)
Permalink
Re: MPEG4 and seektables [In reply to]

On 03/17/2006 11:57 AM, David Asher wrote:
> I started using Steve Adeff's tv.com script (thanks Steve!) to load some
> videos into the MythTV database.
>
> The are MPEG4 .avi's. They play fine, but seeking is terrible. I kinda
> expected that since there was no seek table.
>
> So, I thought: "lets create a seek table for them". I tried:
>
> $ mythcommflag --rebuild -f <avifile>
>
> This acted like it was working, but the resulting seek table is horribly
> broken.
>
...
> So, I'm thinking the key frames weren't correctly found.
>
> I've got 2 questions:
>
> 1. should i expect seek table generation to work for an MPEG4 ?
>
> 2. what is the difference between the --video and --rebuild -f options
> for creating the seek table?
>

mythcommflag --help
2006-03-18 02:46:31.809 Valid Options are:
-c OR --chanid chanid Flag recording with given channel ID
-s OR --starttime starttime Flag recording with given starttime
-f OR --file filename Flag recording with specific filename
--video filename Rebuild the seektable for a video
(non-recording) file

Use "--video" for non-recordings.

Mike

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david.asher at caviumnetworks

Mar 18, 2006, 5:42 AM

Post #4 of 5 (854 views)
Permalink
Re: MPEG4 and seektables [In reply to]

Thanks, I know about the --video option. I've imported the .avi into
the MythTV database -- it looks like a recording. So either is an
option. --video if i want to play from MythVideo and --rebuild -f if I
play from Watch Recordings.

When I looked under the hood it appears the only difference between
--video and --rebuild -f is the table the data is inserted into. I can
see in the -v playback log the seek table being used. It is just corrupt.

Now I'm trying to track down WHY the seek table is corrupt. It looks
like the keyframes produced by aviindex (see my second post) are correct
for video seeking, but lose audio sync. I'm trying to get a better
understanding of how seeking works to debug this.

Thanks,

David.

Michael T. Dean wrote:
> On 03/17/2006 11:57 AM, David Asher wrote:
>
>> I started using Steve Adeff's tv.com script (thanks Steve!) to load some
>> videos into the MythTV database.
>>
>> The are MPEG4 .avi's. They play fine, but seeking is terrible. I kinda
>> expected that since there was no seek table.
>>
>> So, I thought: "lets create a seek table for them". I tried:
>>
>> $ mythcommflag --rebuild -f <avifile>
>>
>> This acted like it was working, but the resulting seek table is horribly
>> broken.
>>
>>
> ...
>
>> So, I'm thinking the key frames weren't correctly found.
>>
>> I've got 2 questions:
>>
>> 1. should i expect seek table generation to work for an MPEG4 ?
>>
>> 2. what is the difference between the --video and --rebuild -f options
>> for creating the seek table?
>>
>>
>
> mythcommflag --help
> 2006-03-18 02:46:31.809 Valid Options are:
> -c OR --chanid chanid Flag recording with given channel ID
> -s OR --starttime starttime Flag recording with given starttime
> -f OR --file filename Flag recording with specific filename
> --video filename Rebuild the seektable for a video
> (non-recording) file
>
> Use "--video" for non-recordings.
>
> Mike
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev [at] mythtv
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
>
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david.asher at caviumnetworks

Apr 1, 2006, 8:59 PM

Post #5 of 5 (779 views)
Permalink
Re: MPEG4 and seektables [In reply to]

Okay, further research.

It turns out the keyframe positions provided by mythcommflag are EXACTLY
8 bytes ahead of the real position (which aviindex correctly found). I
haven't tried to figure out why yet.

I'm still getting the AV sync problem after fast forwarding. I noticed
that in the .avi file in question the PTS on the audio packets in the
file are roughly 400-500ms ahead of the video. So, if we start at a
specific byte position within the file (at a keyframe, for instance),
the first video packet seen is behind the first audio packet seen by
400-500ms

My question is what mechanism in NuppelVideoPlayer/avformatdecoder is
supposed to resync after a seek when the RingBuffer is repositioned to a
keyframe byte position and the next audio packet is 400-500ms ahead of
the key frame? This appears to be going a bit haywire here... Upon
returning to 1x speed after fast forward I see lastvpts in
avformatdecoder hold constant waiting for lastapts to catch up. BUT, as
I said, the audio is actually AHEAD of the video. So i'm confused whats
going on.

Any guidance would be greatly appreciated, otherwise I'll keep slogging
away.

David.

David Asher wrote:
> I've done some more research into this.
>
> I looked for another way to find keyframes other than mythcommflag. I
> found aviindex from transcode-1.0.2. So, just for fun I had it
> generate a list of key frames and inserted the key frames it found
> into the recordedmarkup table. Lo-and-behold the video seeking is
> perfect.
>
> Interestingly, it found roughly the same number of keyframes (771 vs
> 769 for mythcommflag), but their positions are completely different.
>
> Unfortunately, all is not right: after seeking @ >= 20x when I go back
> to normal play speed the audio is badly out of sync. If I exit
> (saving the position) and return it syncs the video to where the audio
> was perfectly. (i.e. it starts in the correct place for the last
> audio that was heard, not for the last video seen)
>
> So, my next step is to understand why I'm getting this audio sync
> problem. Then, hopefully, I'll have a good enough understanding of
> how this all works to figure out why mythcommflag's seek table isn't
> really pointing to key frames.
>
> Any tips on looking into these issues would be greatly appreciated.
>
> Thanks,
>
> David.
>
> P.S. I'm running SVN 9372.
>
> David Asher wrote:
>> I started using Steve Adeff's tv.com script (thanks Steve!) to load
>> some videos into the MythTV database.
>>
>> The are MPEG4 .avi's. They play fine, but seeking is terrible. I
>> kinda expected that since there was no seek table.
>>
>> So, I thought: "lets create a seek table for them". I tried:
>>
>> $ mythcommflag --rebuild -f <avifile>
>>
>> This acted like it was working, but the resulting seek table is
>> horribly broken.
>>
>> I get all sorts of blocky artifacts (BIG blocks), and when first
>> entering the playback after saving position on exit I get a black
>> screen which slowly fills in -- sounds like we didn't start on a
>> keyframe?
>>
>> On starting playback I see (-v playback):
>>
>> 2006-03-16 22:51:40.079 Resyncing position map. posmapStarted = 0
>> livetv(0) watchingRec(0)
>> 2006-03-16 22:51:40.096 Position map filled from DB to: 59546
>> 2006-03-16 22:51:40.096 SyncPositionMap prerecorded, from DB: 769
>> entries
>> 2006-03-16 22:51:40.096 SyncPositionMap, new totframes: 59546, new
>> length: 2483, posMap size: 769
>> 2006-03-16 22:51:40.096 AFD: Position map found
>>
>> on FF I get:
>>
>> [mpeg4 @ 0x1191a84]warning: first frame is no keyframe
>>
>> So, I'm thinking the key frames weren't correctly found.
>>
>> I've got 2 questions:
>>
>> 1. should i expect seek table generation to work for an MPEG4 ?
>>
>> 2. what is the difference between the --video and --rebuild -f
>> options for creating the seek table?
>>
>> Thanks,
>>
>> David.
>>
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.