[FFmpeg-devel] Patch for ticket #1138

Eelco Lempsink eelco at lempsink.nl
Thu Apr 26 10:42:41 CEST 2012

On 24 apr. 2012, at 19:10, Michael Niedermayer wrote:
> On Tue, Apr 24, 2012 at 12:06:20PM +0200, Eelco Lempsink wrote:
>> On 17 apr. 2012, at 15:08, Eelco Lempsink wrote:
>>> Attached is a patch with a fix for trac issue #1138 (http://ffmpeg.org/trac/ffmpeg/ticket/1138)
>>> When using the copy codec and the -ss option (before the input) the PTS and DTS are read from the packet.  For MKVs there is no DTS in the packet which means it is copied from the input stream.  However, the seek offset is not taken into account.
>>> I found it a bit tricky to fix, since the first packet must have been read before the correct DTS can be determined and it depends on the format where the seek ended up exactly.  The big if statement basically checks if all values are equal to the ones set in init_input_stream and if so it assumes this is the first packet.
>>> This is my first FFmpeg patch, so please correct me if I misunderstood something.
>>> <0001-Fix-for-pts-dts-errors-in-case-of-stream-copying-aft.patch>
>> Reminder.
> Fixed
> Ive solved it very similarly to your patch but a bit different so
> the code does not depend on some "distant" code setting specific
> values.

Ah, yes, that is much better.  I was unsure where to add such a flag.  Thank you.

Eelco Lempsink

More information about the ffmpeg-devel mailing list