[FFmpeg-devel] [PATCH] Fix MPEG-TS seek and frame positions in general

Ivan Schreter schreter
Wed Feb 11 11:10:52 CET 2009

Michael Niedermayer wrote:
>>> the time when a frame end/start is detected can be several packets after
>>> the point where the first byte of that frame was stored.
>>> the obvious way to fix this is to pass pos into av_parser_parse()
>>> and reorder it like the timestamps.
>> The only objection could be (to see the problem you are mentioning), if 
>> packets inside one AVStream (e.g., single video stream) would be 
>> interleaved. I cannot really imagine why would someone do it, but the 
> RTFS before guessing
> there are things called startcodes they are 4 bytes long and they are
> used to detect the end and start of a frame.
I know.

> As it is with these, they can (and are in reality as well) be split across
> packets.
> thats mpeg ...
> EAC3 is more complex ...
If I understand you correctly (including previous mails), you'd like to 
see the following: The packet position is passed to parser function by 
extending the parser context by two fields: one passing the position of 
current packet to the parser (currently only buffer and size is passed) 
and one returning the position of packet which contained the startcode. 
The parser should take care of filling it (or not). If filled, it will 
be used, if not, current (broken) last packet position can be used as 
fallback, until all parsers do. Alternatively, one could extend parser 
function by extra parameter with in/out position (in = current packet 
pos, out = first frame packet pos). This would require change in all 
parsers, though, making the patch large, OTOH making the aforementioned 
fallback unnecessary (it will work so implicitly). Which one do you want?



More information about the ffmpeg-devel mailing list