Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#3440 closed defect (fixed)

vp8: a/v desync on seek with -auto-alt-ref 1

Reported by: Christian Ebert Owned by:
Priority: important Component: avformat
Version: git-master Keywords: libvpx regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

$ffmpeg -i BigBuckBunny_640x360.m4v -f webm -c:v libvpx -auto-alt-ref 1 -b:v 300k -c:a libvorbis -b:a 64k -pass 1 test.webm
ffmpeg version N-61061-gf34cceb Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar  4 2014 10:23:19 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      52. 66.101 / 52. 66.101
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.101 / 55. 33.101
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BigBuckBunny_640x360.m4v':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V M4A mp42isom
    creation_time   : 2008-06-03 05:23:28
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    date            : 2008
  Duration: 00:09:56.46, start: 0.000000, bitrate: 1626 kb/s
    Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Sound Media Handler
    Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 640x360, 1495 kb/s, 24 fps, 24 tbr, 2400 tbn, 4800 tbc (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Video Media Handler
[libvpx @ 0x7f9e32801e00] v1.3.0-1648-g91e5e5a
Output #0, webm, to 'test.webm':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V M4A mp42isom
    date            : 2008
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    encoder         : Lavf55.33.101
    Stream #0:0(eng): Video: vp8 (libvpx), yuv420p, 640x360, q=-1--1, pass 2, 300 kb/s, 1k tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Sound Media Handler
Stream mapping:
  Stream #0:1 -> #0:0 (h264 -> libvpx)
  Stream #0:0 -> #0:1 (aac -> libvorbis)
Press [q] to stop, [?] for help
frame=14316 fps= 44 q=0.0 Lsize=   26255kB time=00:09:56.50 bitrate= 360.6kbits/s
video:21847kB audio:4094kB subtitle:0 data:0 global headers:4kB muxing overhead 1.196710%

And same for -pass 2 produces a result where video and audio lose sync when seeking, be it in mplayer or in a html5 video tag. The problem is triggered by -auto-alt-ref 1, which is also in every libvpx preset. Omitting that option avoids the issue.

Happens with all input videos I've tried so far.

Aside: I would expect -auto-alt-ref 0 after -vpre to unset auto-alt-ref from the preset, but it does not:

 ffmpeg -i BigBuckBunny_640x360.m4v -f webm -vpre libvpx-360p -b:v 300k -auto-alt-ref 0 -c:a libvorbis -b:a 64k
 -pass 1 test.webm

also exhibits the problem, whereas giving all options except auto-alt-ref on the commandline again circumvents it.

Change History (14)

comment:1 by Carl Eugen Hoyos, 10 years ago

Keywords: regression added; auto-alt-ref removed
Priority: normalimportant
Reproduced by developer: set
Version: unspecifiedgit-master

Seeking with vlc and MPlayer allows to reproduce the problem, works fine with ffplay.

comment:2 by Carl Eugen Hoyos, 10 years ago

Component: undeterminedavformat
Status: newopen

Regression since 3adb5f8d

in reply to:  2 ; comment:3 by Christian Ebert, 10 years ago

Replying to cehoyos:

Regression since 3adb5f8d

Thank you. That helps a lot during the wait for a fix.

in reply to:  3 ; comment:4 by Carl Eugen Hoyos, 10 years ago

Replying to blacktrash:

Replying to cehoyos:

Regression since 3adb5f8d

Thank you. That helps a lot during the wait for a fix.

You are welcome!
(This was the most painful bisect I remember.)

comment:5 by Carl Eugen Hoyos, 10 years ago

Did you test if -max_interleave_delta allows to workaround the issue?

in reply to:  4 comment:6 by Christian Ebert, 10 years ago

Replying to cehoyos:

(This was the most painful bisect I remember.)

I was tempted to bisect myself, but then decided to resist the temptation and instead file a bug report first to see whether a good-natured being would fall in the trap ;-)
Thanks again.

in reply to:  5 comment:7 by Christian Ebert, 10 years ago

Replying to cehoyos:

Did you test if -max_interleave_delta allows to workaround the issue?

No, not yet, will do so immediately.

in reply to:  5 ; comment:8 by Christian Ebert, 10 years ago

Replying to cehoyos:

Did you test if -max_interleave_delta allows to workaround the issue?

Do you have a promising value to give to that option?

in reply to:  8 comment:9 by Christian Ebert, 10 years ago

Replying to blacktrash:

Replying to cehoyos:

Did you test if -max_interleave_delta allows to workaround the issue?

Do you have a promising value to give to that option?

Clueless and blind attempt of -max_interleave_delta 0 seems to work in a first test. I have no idea whether this makes sense though.

Last edited 10 years ago by Christian Ebert (previous) (diff)

comment:10 by Michael Niedermayer, 10 years ago

i tried to encode 2 files one with -max_interleave_delta 0 and one without, but they dont differ.
How can i reproduce the difference with -max_interleave_delta 0 that fixes this ?

in reply to:  10 comment:11 by Christian Ebert, 10 years ago

Replying to michael:

i tried to encode 2 files one with -max_interleave_delta 0 and one without, but they dont differ.
How can i reproduce the difference with -max_interleave_delta 0 that fixes this ?

I can still reproduce the difference with ffmpeg version N-64623-g15e933b and libvpx v1.3.0-3444-g84744a4:

ffmpeg -y -i BigBuckBunny_640x360.m4v -f webm -c:v libvpx -auto-alt-ref 1 -b:v 300k -c:a libvorbis -b:a 64k -pass 1 async.webm
ffmpeg -y -i BigBuckBunny_640x360.m4v -f webm -c:v libvpx -auto-alt-ref 1 -b:v 300k -c:a libvorbis -b:a 64k -pass 2 async.webm
ffmpeg -y -i BigBuckBunny_640x360.m4v -f webm -c:v libvpx -auto-alt-ref 1 -max_interleave_delta 0 -b:v 300k -c:a libvorbis -b:a 64k -pass 1 sync.webm
ffmpeg -y -i BigBuckBunny_640x360.m4v -f webm -c:v libvpx -auto-alt-ref 1 -max_interleave_delta 0 -b:v 300k -c:a libvorbis -b:a 64k -pass 2 sync.webm

Without -max-interleave-delta 0 a-v desync on seek.

in reply to:  10 comment:12 by Carl Eugen Hoyos, 10 years ago

Replying to michael:

i tried to encode 2 files one with -max_interleave_delta 0 and one without, but they dont differ.
How can i reproduce the difference with -max_interleave_delta 0 that fixes this ?

$ md5sum BigBuckBunny_640x360.m4v
bc59ea5addcb3efb82a8865574e7763c  BigBuckBunny_640x360.m4v
$ ffmpeg -i BigBuckBunny_640x360.m4v -auto-alt-ref 1 -strict -2 -pass 1 test.webm
$ ffmpeg -i BigBuckBunny_640x360.m4v -auto-alt-ref 1 -strict -2 -pass 2 -y test.webm
$ ffmpeg -i BigBuckBunny_640x360.m4v -auto-alt-ref 1 -strict -2 -max_interleave_delta 0 -pass 1 test2.webm
$ ffmpeg -i BigBuckBunny_640x360.m4v -auto-alt-ref 1 -strict -2 -max_interleave_delta 0 -pass 2 -y test2.webm

The second output file is smaller, seeking works better even with ffplay (seeking in the first output file with MPlayer and vlc leads to massive A/V desync).

comment:13 by Michael Niedermayer, 10 years ago

Resolution: fixed
Status: openclosed

in reply to:  13 comment:14 by Christian Ebert, 10 years ago

Replying to michael:

Fixed in a06fac353ce2bd055f920e7f6f5e2145736d2d2c

Confirming that this fixes the problem. Thank you.

Note: See TracTickets for help on using tickets.