[FFmpeg-devel] [PATCH] avformat/oggparseopus: fix segmented timestamps

Mark Harris mark.hsj at gmail.com
Sat Jan 4 23:10:21 CET 2014

On Sat, Jan 4, 2014 at 1:06 PM, James Almer <jamrial at gmail.com> wrote:

> On 04/01/14 5:19 PM, Mark Harris wrote:
> > On Sat, Jan 4, 2014 at 11:59 AM, Michael Niedermayer <michaelni at gmx.at
> >wrote:
> >
> >> On Tue, Dec 31, 2013 at 11:04:54AM -0800, Mark Harris wrote:
> >>> Fix timestamp calculation for code 3 Ogg Opus packets with less than
> >>> 2 bytes in the last segment (e.g. packet length 255 or 256).
> >>> A sample that would seek incorrectly in ffplay can be created with:
> >>>   ffmpeg -i in.wav -b:a 34k -vbr off -frame_duration 60 out.opus
> >>
> >> i dont seem to be able to reproduce the issue even though it seems
> >> i did have a in.wav file in my local directory. Or maybe iam trying
> >> the wrong things with the generated file
> >>
> >>
> > The input audio doesn't matter as long as you can distinguish beginning,
> > middle, and end (so don't use "sine" or a similar source).  It's the
> > particular Opus packet sizes that cause the problem; encoding anything
> > to 34kb/s CBR with 60ms frame duration will trigger the issue.
> > Without the patch, "ffplay out.opus" and clicking in the middle of the
> > window to seek to the middle will seek to the end instead, due to
> > incorrect timestamps.
> >
> >  - Mark
> Do you know if this is reproducible only with Opus? The code you're
> changing
> is also used in most other parsers (Theora, Vorbis, VP8) for similar
> purposes,
> so it wouldn't be surprising if they all experience the same behavior.

The bug where the segment length is used as the packet length is only
in oggparseopus.

I'm not really familiar with the other codecs but it looks like Vorbis
and VP8 need to read only the first byte of each packet to determine the
timestamp, and they just assume that each packet has at least one byte.
That might be a bug if the page contains 0-byte packets, as it would be
reading outside of the packet, although I don't know if 0-byte Vorbis or
VP8 packets are valid.  For Theora apparently all packets on the page
have the same duration because it only counts packets to compute the

 - Mark

> Regards.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list