[FFmpeg-trac] #5238(undetermined:new): gapless playback doesn't work (with at least Opus)

FFmpeg trac at avcodec.org
Fri Feb 19 20:22:14 CET 2016


#5238: gapless playback doesn't work (with at least Opus)
-------------------------------------+-------------------------------------
             Reporter:  calestyo     |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by calestyo):

 Hey.

 Uhm... that will definitely take some time to get it tested on git HEAD...
 quite busy right now.

 Have there been any changes with respect to areas that could affect the
 gapless encoding recently, that would make you think it may already be
 fixed?

 Also, the programs where I've noted the gap/distortions use ffmpeg as
 library... so there is no direct command line to reproduce this.


 In the meantime I did the following (but that's again with 2.8.6 and not
 with HEAD):
 {{{
 $ ffmpeg -i 1.opus  1.wav
 ffmpeg version 2.8.6-1+b1 Copyright (c) 2000-2016 the FFmpeg developers
   built with gcc 5.3.1 (Debian 5.3.1-8) 20160205
   configuration: --prefix=/usr --extra-version=1+b1 --build-suffix=-ffmpeg
 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
 --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
 --enable-shared --disable-stripping --disable-decoder=libopenjpeg
 --disable-decoder=libschroedinger --enable-avresample --enable-avisynth
 --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite
 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-
 libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-
 libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-
 libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr
 --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal
 --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883
 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
   WARNING: library configuration mismatch
   avcodec     configuration: --prefix=/usr --extra-version=1+b1 --build-
 suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
 --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
 --enable-shared --disable-stripping --disable-decoder=libopenjpeg
 --disable-decoder=libschroedinger --enable-avresample --enable-avisynth
 --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite
 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-
 libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-
 libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-
 libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr
 --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal
 --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883
 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
 --enable-version3 --disable-doc --disable-programs --disable-avdevice
 --disable-avfilter --disable-avformat --disable-avresample --disable-
 postproc --disable-swscale --enable-libopencore_amrnb --enable-
 libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc
   libavutil      54. 31.100 / 54. 31.100
   libavcodec     56. 60.100 / 56. 60.100
   libavformat    56. 40.101 / 56. 40.101
   libavdevice    56.  4.100 / 56.  4.100
   libavfilter     5. 40.101 /  5. 40.101
   libavresample   2.  1.  0 /  2.  1.  0
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  2.101 /  1.  2.101
   libpostproc    53.  3.100 / 53.  3.100
 [ogg @ 0x1b363c0] 2554 bytes of comment header remain
 [mjpeg @ 0x1b3a280] Changeing bps to 8
 Input #0, ogg, from '1.opus':
   Duration: 00:01:31.54, start: 0.000000, bitrate: 141 kb/s
     Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
     Metadata:
       ENCODER         : opusenc from opus-tools 0.1.9
       ENCODER_OPTIONS : --bitrate 128 --vbr
       TITLE           : Durch die Wildnis zum Schloß
       RELEASECOUNTRY  : DE
       TOTALDISCS      : 2
       LABEL           : Polydor
       TOTALTRACKS     : 17
       MUSICBRAINZ_ALBUMARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       DATE            : 1998-10-12
       disc            : 1
       TRACKTOTAL      : 17
       MUSICBRAINZ_RELEASETRACKID: dcb9a710-97d1-3933-bac5-5f44ddd97026
       ASIN            : B0000243VE
       ALBUMARTISTSORT : Steinman, Jim
       ORIGINALDATE    : 1998-03-02
       SCRIPT          : Latn
       MUSICBRAINZ_ALBUMID: 01dbec76-ef97-4676-9f2e-dc6b3f4df7b2
       RELEASESTATUS   : official
       album_artist    : Jim Steinman
       ACOUSTID_ID     : 5fa1b0cf-1497-4836-abc4-15fc26094a13
       CATALOGNUMBER   : 559 379-2
       ALBUM           : Tanz der Vampire: Die Gesamtaufnahme
       MUSICBRAINZ_ARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       MEDIA           : CD
       RELEASETYPE     : album;soundtrack
       ORIGINALYEAR    : 1998
       ARTIST          : Jim Steinman
       MUSICBRAINZ_RELEASEGROUPID: c7bbfb01-144a-3516-9456-01eb5f3923b8
       DISCTOTAL       : 2
       BARCODE         : 731455937923
       MUSICBRAINZ_TRACKID: 96ebd96e-c88a-4370-b752-ce7a587e0f2e
       ARTISTSORT      : Steinman, Jim
       ARTISTS         : Jim Steinman
       track           : 16
     Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown),
 500x500 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
     Metadata:
       comment         : Cover (front)
 Output #0, wav, to '1.wav':
   Metadata:
     ISFT            : Lavf56.40.101
     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
 stereo, s16, 1536 kb/s
     Metadata:
       track           : 16
       ENCODER_OPTIONS : --bitrate 128 --vbr
       TITLE           : Durch die Wildnis zum Schloß
       RELEASECOUNTRY  : DE
       TOTALDISCS      : 2
       LABEL           : Polydor
       TOTALTRACKS     : 17
       MUSICBRAINZ_ALBUMARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       DATE            : 1998-10-12
       disc            : 1
       TRACKTOTAL      : 17
       MUSICBRAINZ_RELEASETRACKID: dcb9a710-97d1-3933-bac5-5f44ddd97026
       ASIN            : B0000243VE
       ALBUMARTISTSORT : Steinman, Jim
       ORIGINALDATE    : 1998-03-02
       SCRIPT          : Latn
       MUSICBRAINZ_ALBUMID: 01dbec76-ef97-4676-9f2e-dc6b3f4df7b2
       RELEASESTATUS   : official
       album_artist    : Jim Steinman
       ACOUSTID_ID     : 5fa1b0cf-1497-4836-abc4-15fc26094a13
       CATALOGNUMBER   : 559 379-2
       ALBUM           : Tanz der Vampire: Die Gesamtaufnahme
       MUSICBRAINZ_ARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       MEDIA           : CD
       RELEASETYPE     : album;soundtrack
       ORIGINALYEAR    : 1998
       ARTIST          : Jim Steinman
       MUSICBRAINZ_RELEASEGROUPID: c7bbfb01-144a-3516-9456-01eb5f3923b8
       DISCTOTAL       : 2
       BARCODE         : 731455937923
       MUSICBRAINZ_TRACKID: 96ebd96e-c88a-4370-b752-ce7a587e0f2e
       ARTISTSORT      : Steinman, Jim
       ARTISTS         : Jim Steinman
       encoder         : Lavc56.60.100 pcm_s16le
 Stream mapping:
   Stream #0:0 -> #0:0 (opus (native) -> pcm_s16le (native))
 Press [q] to stop, [?] for help
 size=   17164kB time=00:01:31.53 bitrate=1536.1kbits/s
 video:0kB audio:17164kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.000444%
 $ ffmpeg -i 2.opus  2.wav
 ffmpeg version 2.8.6-1+b1 Copyright (c) 2000-2016 the FFmpeg developers
   built with gcc 5.3.1 (Debian 5.3.1-8) 20160205
   configuration: --prefix=/usr --extra-version=1+b1 --build-suffix=-ffmpeg
 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
 --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
 --enable-shared --disable-stripping --disable-decoder=libopenjpeg
 --disable-decoder=libschroedinger --enable-avresample --enable-avisynth
 --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite
 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-
 libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-
 libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-
 libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr
 --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal
 --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883
 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
   WARNING: library configuration mismatch
   avcodec     configuration: --prefix=/usr --extra-version=1+b1 --build-
 suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
 --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
 --enable-shared --disable-stripping --disable-decoder=libopenjpeg
 --disable-decoder=libschroedinger --enable-avresample --enable-avisynth
 --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite
 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-
 libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-
 libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-
 libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr
 --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal
 --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883
 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
 --enable-version3 --disable-doc --disable-programs --disable-avdevice
 --disable-avfilter --disable-avformat --disable-avresample --disable-
 postproc --disable-swscale --enable-libopencore_amrnb --enable-
 libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc
   libavutil      54. 31.100 / 54. 31.100
   libavcodec     56. 60.100 / 56. 60.100
   libavformat    56. 40.101 / 56. 40.101
   libavdevice    56.  4.100 / 56.  4.100
   libavfilter     5. 40.101 /  5. 40.101
   libavresample   2.  1.  0 /  2.  1.  0
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  2.101 /  1.  2.101
   libpostproc    53.  3.100 / 53.  3.100
 [ogg @ 0x1ee53c0] 11772 bytes of comment header remain
 [mjpeg @ 0x1ee9280] Changeing bps to 8
 Input #0, ogg, from '2.opus':
   Duration: 00:10:45.07, start: 0.000000, bitrate: 134 kb/s
     Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
     Metadata:
       ENCODER         : opusenc from opus-tools 0.1.9
       ENCODER_OPTIONS : --bitrate 128 --vbr
       TITLE           : Vor dem Schloß - Finale erster Akt
       RELEASECOUNTRY  : DE
       TOTALDISCS      : 2
       LABEL           : Polydor
       TOTALTRACKS     : 17
       MUSICBRAINZ_ALBUMARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       DATE            : 1998-10-12
       disc            : 1
       TRACKTOTAL      : 17
       MUSICBRAINZ_RELEASETRACKID: 6d86a456-abd4-395e-a35e-cabc457d5561
       ASIN            : B0000243VE
       ALBUMARTISTSORT : Steinman, Jim
       ORIGINALDATE    : 1998-03-02
       SCRIPT          : Latn
       MUSICBRAINZ_ALBUMID: 01dbec76-ef97-4676-9f2e-dc6b3f4df7b2
       RELEASESTATUS   : official
       album_artist    : Jim Steinman
       ACOUSTID_ID     : 277d72a4-c118-4031-b3a7-f8016db3ec75
       CATALOGNUMBER   : 559 379-2
       ALBUM           : Tanz der Vampire: Die Gesamtaufnahme
       MUSICBRAINZ_ARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       MEDIA           : CD
       RELEASETYPE     : album;soundtrack
       ORIGINALYEAR    : 1998
       ARTIST          : Jim Steinman
       MUSICBRAINZ_RELEASEGROUPID: c7bbfb01-144a-3516-9456-01eb5f3923b8
       DISCTOTAL       : 2
       BARCODE         : 731455937923
       MUSICBRAINZ_TRACKID: 125cc226-3f47-4d2a-8aa2-03fe2f9971af
       ARTISTSORT      : Steinman, Jim
       ARTISTS         : Jim Steinman
       track           : 17
     Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown),
 500x500 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
     Metadata:
       comment         : Cover (front)
 Output #0, wav, to '2.wav':
   Metadata:
     ISFT            : Lavf56.40.101
     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
 stereo, s16, 1536 kb/s
     Metadata:
       track           : 17
       ENCODER_OPTIONS : --bitrate 128 --vbr
       TITLE           : Vor dem Schloß - Finale erster Akt
       RELEASECOUNTRY  : DE
       TOTALDISCS      : 2
       LABEL           : Polydor
       TOTALTRACKS     : 17
       MUSICBRAINZ_ALBUMARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       DATE            : 1998-10-12
       disc            : 1
       TRACKTOTAL      : 17
       MUSICBRAINZ_RELEASETRACKID: 6d86a456-abd4-395e-a35e-cabc457d5561
       ASIN            : B0000243VE
       ALBUMARTISTSORT : Steinman, Jim
       ORIGINALDATE    : 1998-03-02
       SCRIPT          : Latn
       MUSICBRAINZ_ALBUMID: 01dbec76-ef97-4676-9f2e-dc6b3f4df7b2
       RELEASESTATUS   : official
       album_artist    : Jim Steinman
       ACOUSTID_ID     : 277d72a4-c118-4031-b3a7-f8016db3ec75
       CATALOGNUMBER   : 559 379-2
       ALBUM           : Tanz der Vampire: Die Gesamtaufnahme
       MUSICBRAINZ_ARTISTID: 80e7cb60-3ed8-46dd-8eec-9052606306f2
       MEDIA           : CD
       RELEASETYPE     : album;soundtrack
       ORIGINALYEAR    : 1998
       ARTIST          : Jim Steinman
       MUSICBRAINZ_RELEASEGROUPID: c7bbfb01-144a-3516-9456-01eb5f3923b8
       DISCTOTAL       : 2
       BARCODE         : 731455937923
       MUSICBRAINZ_TRACKID: 125cc226-3f47-4d2a-8aa2-03fe2f9971af
       ARTISTSORT      : Steinman, Jim
       ARTISTS         : Jim Steinman
       encoder         : Lavc56.60.100 pcm_s16le
 Stream mapping:
   Stream #0:0 -> #0:0 (opus (native) -> pcm_s16le (native))
 Press [q] to stop, [?] for help
 size=  120951kB time=00:10:45.06 bitrate=1536.0kbits/s
 video:0kB audio:120951kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.000063%
 }}}

 When one then looks at the ffmpeg-decoded WAV files, i.e. opens them in
 e.g. audacity and concatenates them there... one again sees a clear gap
 (and also the shifting at the begin and end) that I've already showed
 above in the screenshots.


 I've sent you a link to sample files via email (it's okay if you share
 these with other developers, but please not publicly or the files on file
 sharing networks ;-) )... perhaps you can have a look at them or even
 quickly check it on HEAD.
 The download area contains the original wav files, opus, MP3 and a range
 of differently encoded AACs.

 The sample WAVs obviously playback gaplessly,.. the MP3's as well (e.g.
 when played back with mpv) and when decoding them with ffmpeg to WAV,
 these WAVs look fine in audacity (i.e. no gap, pops, or other
 distortions).

 When decoding however the opus or AACs... they show the various
 gaps/shifts/distortions that I've described here or in the URLs mentioned
 above (please see also there for screenshots and further information about
 how I encoded the AACs).


 At the MPV bug (https://github.com/mpv-
 player/mpv/issues/2823#issuecomment-186240626) a developer implied the
 issue would not happen, when the opus files are muxed from the Ogg into an
 MKV container before... but I couldn't confirm this behaviour.


 Best wishes,
 Chris.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5238#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list