[FFmpeg-devel] [PATCH] AVCHD/H.264 parser: determination of frame type, question about timestamps
Ivan Schreter
schreter
Fri Jan 23 09:08:08 CET 2009
Ivan Schreter wrote:
> Hi,
>
> Loren Merritt wrote:
>> On Thu, 22 Jan 2009, Ivan Schreter wrote
>>> Your patch is much more elegant, but I changed the following:
>>>
>>>> + case NAL_IDR_SLICE:
>>>> + case NAL_SLICE:
>>>> + get_ue_golomb(&h->s.gb);
>>>> + if(get_ue_golomb(&h->s.gb) % 5 == 2)
>>>> + s->pict_type= FF_I_TYPE;
>>>> + else
>>>> + s->pict_type= FF_P_TYPE;
>>>> + return;
>>>> +
>>>>
>>> to this:
>>>
>>> + case NAL_IDR_SLICE:
>>> + case NAL_SLICE:
>>> + get_ue_golomb(&h->s.gb);
>>> + s->pict_type=
>>> golomb_to_pict_type[get_ue_golomb(&h->s.gb) % 5];
>>> + return;
>>>
>>> Reason: Your code didn't correctly set pict_type to FF_B_TYPE for
>>> B-frames, so timing didn't work correctly. Since we already have
>>> mapping
>>> array, I simply used it to map it instead of adding another if
>>> statement.
>>>
>> Certainly frame type should be fixed, but what does this have to do
>> with timing? H.264 allows any frame types to be reordered, or not, as
>> the encoder pleases.
>>
> This part has nothing to do with timing, only with returning proper
> frame type.
Ah, sorry, to correct myself: It does, indirectly. If picture type is
not set, it does not know which frame is a B-frame and computes DTS/PTS
wrong in compute_pkt_fields() heuristics.
Regards,
Ivan
More information about the ffmpeg-devel
mailing list