[Matroska-devel] problems with AVC in Matroska

Steve Lhomme steve.lhomme at free.fr
Sat Jan 15 11:53:42 CET 2005


Moritz Bunkus a écrit :
> My question is -- which timecodes should those reference? They could all
> simply reference the previous frame. That's what we do with "normal"
> MPEG-4 video. But that would actually leave us with the following refs:
> 
> I frame, timecode 0, no ref
> P frame, timecode 167, ref -167
> P frame, timecode 42, ref +125   (!??)
> P frame, timecode 83, ref -41
> P frame, timecode 125, ref -42
> P frame, timecode 292, ref -167
> P frame, timecode 209, ref +83   (!??)
> P frame, timecode 250, ref -41
> I frame, timecode 334, no ref
> I frame, timecode 375, no ref
> P frame, timecode 417, ref -42
> P frame, timecode 501, ref -84
> P frame, timecode 459, ref +50   (!??)
> P frame, timecode 584, ref -125
> 
> As you can see, this leaves us with a couple of frames who only have a
> _forward_ reference. Most parsers would do strange things in this
> case. I'd guess that most would interprete that as a key frame (because
> there's no backward reference), but the parser might also just abort
> parsing or whatever. We should avoid this.

IMO there shouldn't be much problem with that. I think most parsers 
identify an I frame (keyframe) as "no references provided". No matter if 
there is one or not. For seeking it doesn't matter. Especially since 
most don't handle "B frames" in Matroska. Maybe you can tell about that 
in MPlayer and Haali in his parser.

> Now let's get back to the first block of frames. In that case I've
> assumed that the "traditional" B frame model applies to AVC as well. The
> timecodes and references for that example are:
> 
> I frame, timecode 0, no ref
> P frame, timecode 167, ref -167
> B frame, timecode 42, ref -42 and +41
> B frame, timecode 83, ref -41 and +42
> B frame, timecode 125, ref -42 and +42
> P frame, timecode 292, ref -125
> B frame, timecode 209, ref -42 and +41
> B frame, timecode 250, ref -41 and +42
> I frame, timecode 334, no ref
> I frame, timecode 375, no ref
> P frame, timecode 417, ref -42
> P frame, timecode 501, ref -84

should be
P frame, timecode 501, ref -42

> B frame, timecode 459, ref -42 and +42
> P frame, timecode 584, ref -83
> 
> This list can be easily converted to I/P frames only with _sane_
> references by simply forgetting about all forward references and
> re-labeling the "former" B frames as P frames:
> 
> I frame, timecode 0, no ref
> P frame, timecode 167, ref -167
> P frame, timecode 42, ref -42
> P frame, timecode 83, ref -41
> P frame, timecode 125, ref -42
> P frame, timecode 292, ref -125
> P frame, timecode 209, ref -42
> P frame, timecode 250, ref -41
> I frame, timecode 334, no ref
> I frame, timecode 375, no ref
> P frame, timecode 417, ref -42
> P frame, timecode 501, ref -84
> P frame, timecode 459, ref -42
> P frame, timecode 584, ref -83
> 
> IMHO this is the only good way to timestamp frames and calculate the
> references needed for the P frames for our method #2.

IMO that's good if you can achieve this.




More information about the Matroska-devel mailing list