[FFmpeg-trac] #9755(undetermined:new): gapless playback of *some* MP3 files destroyed

FFmpeg trac at avcodec.org
Fri Apr 29 06:26:11 EEST 2022


#9755: gapless playback of *some* MP3 files destroyed
-------------------------------------+-------------------------------------
             Reporter:  Christoph    |                     Type:  defect
  Anton Mitterer                     |
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 Originally from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797965
 which I just thought I could close.

 What I did was applying R128 gain info to audio files with bs1770gain
 (which uses ffmpeg internally).

 Long time ago, I found that this corrupts gapless playback by adding small
 silence or other distortions at the end of the "first" track.

 I've just retried with current toolset (current in the sense of Debian
 unstable, that is: ffmpeg 4.4.2).

 At first I thought it would work for both now, Opus and MP3, because some
 new test files I had used, were processed correctly.
 But then I dug out my test files from back then, where ffmpeg failed again
 with MP3 (but not with Opus).

 To simplify things, let's keep bs1770gain out of the game and just use
 ffmpeg.

 1) I have two WAVs where the 1st goes right over in the 2nd and which
 should play back gaplessly.
 2) I encode them to opus and MP3 with:
    opusenc --vbr --bitrate 128 --discard-comments --discard-pictures
    lame --verbose -q 0 -v -V 4 --noreplaygain --id3v2-utf16 --add-id3v2
 --id3v1-only
 3) I decode these again with:
    opusdec
    lame --decode
 4) Now I copy the Opus/MP3 files with ffmpeg like:
    ffmpeg -i a.opus -acodec copy -y copy_a.opus
    ffmpeg -i b.opus -acodec copy -y copy_b.opus
    ffmpeg -i a.mp3 -acodec copy -y copy_a.mp3
    ffmpeg -i b.mp3 -acodec copy -y copy_b.mp3
    My understanding is, that the generated files should be audio-wise
 identical to their sources.
 5) I dcode copy_*.* as in (3).
 6) diff each WAV pair
    For Opus, both pairs are bitwise identical
    For MP3, only the B file is, but the A file differs, which one can also
 clearly see at the end of the waveform, where there's a bit more silence
 (and the audio ends with a strange spike).


 So something gets lost in the copying process of ffmpeg, and apparently
 this also depends on the file (as said, I checked another pair of files,
 where this worked even for MP3.


 If any ffmpeg developer is interested in looking into this, I'd rather
 privately share the sample files if that's possible (just tell me your
 email and I can send you a link), the material is copyrighted.


 Thanks,
 Chris
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9755>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list