[FFmpeg-devel] [PATCH] lavf/mov.c: Make audio timestamps strictly monotonically increasing inside an edit list. Fixes gapless decoding.

Sasi Inguva isasi at google.com
Wed Sep 21 00:29:31 EEST 2016


On Mon, Sep 19, 2016 at 9:22 PM, Michael Niedermayer <michael at niedermayer.cc
> wrote:

> On Mon, Sep 19, 2016 at 06:31:31PM -0700, Sasi Inguva wrote:
> > Signed-off-by: Sasi Inguva <isasi at google.com>
> > ---
> >  libavcodec/utils.c                           | 15 +++---
> >  libavformat/mov.c                            | 75
> ++++++++++++++++++++++++----
> >  tests/ref/fate/gaplessenc-itunes-to-ipod-aac |  2 +-
> >  tests/ref/fate/gaplessenc-pcm-to-mov-aac     |  2 +-
> >  4 files changed, 74 insertions(+), 20 deletions(-)
>
> with this
> ./ffmpeg -i H263_NM_f.mp4
> segfaults
>
fixed.


>
> also theres a problem with initial padding with libvorbis with this
> change (similar to past acc/mp3 issues)
>
> The problem is that libvorbis decoder is not producing any AVFrame, when
we decode the first packet. got_frame_ptr is zero, and frame->nb_samples is
zero when we decode the first packet.
Before this patch first packet is discarded , and skip_samples is set to
zero .
packet|codec_type=audio|stream_index=0|pts=-256|pts_time=-0.016000|dts=-256|dts_time=-0.016000|duration=256|duration_time=0.016000|convergence_duration=N/A|convergence_duration_time=N/A|size=1|pos=36|flags=KD
packet|codec_type=audio|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=384|duration_time=0.024000|convergence_duration=N/A|convergence_duration_time=N/A|size=1|pos=37|flags=K_

After this patch also, the first packet is discarded , but skip_samples is
also set to 256. However when we call decode on first packet  libvorbis
decoder , doesn't output anything in AVFrame and frame->nb_samples is zero.
So the skip_samples still remains to be consumed when the next packet is
decoded. Other decoders aac, mp3 do produce a decoded output frame on the
first packet and set the frame->nb_samples correctly, so it works for
others. I have just disabled setting skip_samples for libvorbis inside the
edit list code.


> i can provide proper testcases if needed tomorrow ?
> (too late ATM need to sleep)
>
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Modern terrorism, a quick summary: Need oil, start war with country that
> has oil, kill hundread thousand in war. Let country fall into chaos,
> be surprised about raise of fundamantalists. Drop more bombs, kill more
> people, be surprised about them taking revenge and drop even more bombs
> and strip your own citizens of their rights and freedoms. to be continued
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list