[FFmpeg-trac] #10379(ffmpeg:new): concat demuxer produces wrong duration for flac files
FFmpeg
trac at avcodec.org
Mon May 22 08:25:09 EEST 2023
#10379: concat demuxer produces wrong duration for flac files
-------------------------------------+-------------------------------------
Reporter: | Type: defect
slycordinator |
Status: new | Priority: normal
Component: ffmpeg | Version: git-
| master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
Using the concat demuxer with flac files, the generated file's duration is
that of the first file in the list
How to reproduce:
1) create two flac files
In my case, I have one named half_sec.flac and another named 1_sec.flac.
Both are silent files; half_sec is 0.5 seconds and 1_sec is 1.0 seconds in
duration.
2) concatenate them using the concat demuxer as explained at
https://trac.ffmpeg.org/wiki/Concatenate#demuxer
3) use ffprobe to see duration is equal to that of the first file and open
in media player to see same
{{{
mylist.txt:
file '/path/to/half_sec.flac'
file '/path/to/1_sec.flac'
% ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.flac
ffmpeg version N-110692-gc4b3e882f8 Copyright (c) 2000-2023 the FFmpeg
developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr/local --extra-libs='-lpthread -lm'
--bindir=/usr/local/bin --disable-ffplay --disable-doc --disable-htmlpages
--disable-manpages --disable-podpages --disable-txtpages --enable-libass
--enable-libfdk-aac --enable-libaom --enable-libfreetype --enable-
libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-
libx264 --enable-libx265 --enable-gnutls --enable-static --enable-gpl
--enable-nonfree
libavutil 58. 9.100 / 58. 9.100
libavcodec 60. 14.101 / 60. 14.101
libavformat 60. 5.100 / 60. 5.100
libavdevice 60. 2.100 / 60. 2.100
libavfilter 9. 8.100 / 9. 8.100
libswscale 7. 2.100 / 7. 2.100
libswresample 4. 11.100 / 4. 11.100
libpostproc 57. 2.100 / 57. 2.100
Input #0, concat, from 'mylist.txt':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Output #0, flac, to 'output.flac':
Metadata:
encoder : Lavf60.5.100
Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/flac @ 0x562a4f405d40] video:0kB audio:0kB subtitle:0kB other
streams:0kB global headers:0kB muxing overhead: 3871.962617%
size= 8kB time=00:00:01.44 bitrate= 47.2kbits/s speed=71.7x
% ffprobe output.flac
...
[flac @ 0x560349e5ed80] sample/frame number mismatch in adjacent frames
Input #0, flac, from 'output.flac':
Metadata:
encoder : Lavf60.5.100
Duration: 00:00:00.50, start: 0.000000, bitrate: 136 kb/s
Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
}}}
Results:
Duration of file is equal to the first file found in the temporary text
file
As in above output, the first file is 0.5 seconds, the second is 1.0
seconds, the concatenated output file shows a duration of 0.5 seconds, and
the file is 0.5 seconds long when opened in media players/audio editing
utilities
Expected:
The total duration be the the total for all of the combined files and when
opened in an editor/media player, the duration also be that of the
combination of all files.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10379>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list