Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#7864 closed defect (duplicate)

FFmpeg (possibly libavformat) seems not to write the correct duration when remuxing a FLAC file with seeking.

Reported by: pbelkner Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

FFmpeg (possibly libavformat) seems not to write the correct duration when remuxing a FLAC file with seeking.

How to reproduce:

1.) Run FFmpeg on a FLAC file with option acodec set to copy and option ss set to e.g. 1:0 (one second), e.g.

peter@debian-9:~$ ffmpeg -i ~/aerosmith/1973_make_it/01_make_it.flac -acodec copy -ss 1:0 -y xx/01_make_it.flac 
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, flac, from '~/aerosmith/1973_make_it/01_make_it.flac':
  Metadata:
    COMMENT         : level: +4.00 dB, track: -0.86 dB, album: -1.22 dB
    ARTIST          : Aerosmith
    ALBUM           : Make It
    DATE            : 1973
    TITLE           : Make It
    REPLAYGAIN_ALGORITHM: EBU R128
    REPLAYGAIN_REFERENCE_LOUDNESS: -23 LUFS
    REPLAYGAIN_TRACK_GAIN: -10.3 LU
    REPLAYGAIN_TRACK_PEAK: 0.956400
    REPLAYGAIN_ALBUM_GAIN: -10.1 LU
    REPLAYGAIN_ALBUM_PEAK: 0.987564
    ENCODER         : Lavf52.93.0
  Duration: 00:03:41.00, start: 0.000000, bitrate: 853 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Side data:
      replaygain: track gain - -10.300000, track peak - 0.000022, album gain - -10.100000, album peak - 0.000023, 
Output #0, flac, to 'xx/01_make_it.flac':
  Metadata:
    DESCRIPTION     : level: +4.00 dB, track: -0.86 dB, album: -1.22 dB
    ARTIST          : Aerosmith
    ALBUM           : Make It
    DATE            : 1973
    TITLE           : Make It
    REPLAYGAIN_ALGORITHM: EBU R128
    REPLAYGAIN_REFERENCE_LOUDNESS: -23 LUFS
    REPLAYGAIN_TRACK_GAIN: -10.3 LU
    REPLAYGAIN_TRACK_PEAK: 0.956400
    REPLAYGAIN_ALBUM_GAIN: -10.1 LU
    REPLAYGAIN_ALBUM_PEAK: 0.987564
    encoder         : Lavf57.56.101
    Stream #0:0: Audio: flac, 44100 Hz, stereo (16 bit)
    Side data:
      replaygain: track gain - -10.300000, track peak - 0.000022, album gain - -10.100000, album peak - 0.000023, 
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=   16736kB time=00:02:40.96 bitrate= 851.8kbits/s speed= 265x    
video:0kB audio:16728kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.050387%
peter@debian-9:~$

2.) Even if FFmpeg claims that the result is one second shorter as the input (i.e. time=00:02:40.96) this is not written to the result:

peter@debian-9:~$ ffmpeg -i ~/aerosmith/1973_make_it/01_make_it.flac -acodec copy -ss 1:0 -y xx/01_make_it.flac 
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, flac, from '~/aerosmith/1973_make_it/01_make_it.flac':
  Metadata:
    COMMENT         : level: +4.00 dB, track: -0.86 dB, album: -1.22 dB
    ARTIST          : Aerosmith
    ALBUM           : Make It
    DATE            : 1973
    TITLE           : Make It
    REPLAYGAIN_ALGORITHM: EBU R128
    REPLAYGAIN_REFERENCE_LOUDNESS: -23 LUFS
    REPLAYGAIN_TRACK_GAIN: -10.3 LU
    REPLAYGAIN_TRACK_PEAK: 0.956400
    REPLAYGAIN_ALBUM_GAIN: -10.1 LU
    REPLAYGAIN_ALBUM_PEAK: 0.987564
    ENCODER         : Lavf52.93.0
  Duration: 00:03:41.00, start: 0.000000, bitrate: 853 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Side data:
      replaygain: track gain - -10.300000, track peak - 0.000022, album gain - -10.100000, album peak - 0.000023, 
Output #0, flac, to 'xx/01_make_it.flac':
  Metadata:
    DESCRIPTION     : level: +4.00 dB, track: -0.86 dB, album: -1.22 dB
    ARTIST          : Aerosmith
    ALBUM           : Make It
    DATE            : 1973
    TITLE           : Make It
    REPLAYGAIN_ALGORITHM: EBU R128
    REPLAYGAIN_REFERENCE_LOUDNESS: -23 LUFS
    REPLAYGAIN_TRACK_GAIN: -10.3 LU
    REPLAYGAIN_TRACK_PEAK: 0.956400
    REPLAYGAIN_ALBUM_GAIN: -10.1 LU
    REPLAYGAIN_ALBUM_PEAK: 0.987564
    encoder         : Lavf57.56.101
    Stream #0:0: Audio: flac, 44100 Hz, stereo (16 bit)
    Side data:
      replaygain: track gain - -10.300000, track peak - 0.000022, album gain - -10.100000, album peak - 0.000023, 
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=   16736kB time=00:02:40.96 bitrate= 851.8kbits/s speed= 265x    
video:0kB audio:16728kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.050387%
peter@debian-9:~$ 
peter@debian-9:~$ ffmpeg -i ./xx/01_make_it.flac 
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, flac, from './xx/01_make_it.flac':
  Metadata:
    comment         : level: +4.00 dB, track: -0.86 dB, album: -1.22 dB
    ARTIST          : Aerosmith
    ALBUM           : Make It
    DATE            : 1973
    TITLE           : Make It
    REPLAYGAIN_ALGORITHM: EBU R128
    REPLAYGAIN_REFERENCE_LOUDNESS: -23 LUFS
    REPLAYGAIN_TRACK_GAIN: -10.3 LU
    REPLAYGAIN_TRACK_PEAK: 0.956400
    REPLAYGAIN_ALBUM_GAIN: -10.1 LU
    REPLAYGAIN_ALBUM_PEAK: 0.987564
    ENCODER         : Lavf57.56.101
  Duration: 00:03:41.00, start: 60.000363, bitrate: 620 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Side data:
      replaygain: track gain - -10.300000, track peak - 0.000022, album gain - -10.100000, album peak - 0.000023, 
At least one output file must be specified
peter@debian-9:~$

Change History (3)

comment:1 by pbelkner, 2 years ago

Above, second should, of course, read minute.

comment:2 by Carl Eugen Hoyos, 2 years ago

Resolution: duplicate
Status: newclosed

Sounds like #4905.

For future tickets, please remember that only current FFmpeg git head is supported on this bug tracker.

comment:3 by pbelkner, 2 years ago

1.) It is indeed a duplicate to #4905
2.) It, of course, also appears with git head.

Note: See TracTickets for help on using tickets.