[FFmpeg-trac] #10957(undetermined:new): ffmpeg flac seek demux failure

FFmpeg trac at avcodec.org
Tue Apr 9 09:52:33 EEST 2024


#10957: ffmpeg flac seek demux failure
-------------------------------------+-------------------------------------
             Reporter:  Peter Z      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 Demux seeking in some flac files created by ffmpeg fails. Demux and decode
 without seeking (just skip the -ss in the repro) in the same file succeeds
 and produces good results so it appears the file itself is fine.
 Official flac tool has no complaints about the original file either.

 Example file was cut from the end of the original file that I
 unfortunately can not share.

 Tested on master as of 2024-04-08
 (b0ef9e35e80990b0ba03dd724a6d41cccba100b1).

 How to reproduce:
 {{{
 % ./ffmpeg -v trace -ss 0.1 -i seek_not_working.flac -f null =
 ffmpeg version N-114734-gb0ef9e35e8 Copyright (c) 2000-2024 the FFmpeg
 developers
   built with Apple clang version 15.0.0 (clang-1500.3.9.4)
   configuration: --enable-static --enable-ffmpeg --enable-ffprobe
 --disable-shared --enable-gpl --enable-gray --enable-nonfree --enable-
 iconv --enable-libxml2 --enable-libmp3lame --enable-libfdk-aac --enable-
 libvorbis --enable-libopus --enable-libtheora --enable-libvpx --enable-
 libx264 --enable-libx265 --disable-stripping --enable-libfreetype
 --enable-libsoxr --extra-cflags=-I/opt/homebrew/include --extra-
 ldflags='-L/opt/homebrew/lib -Wl,-ld_classic'
   libavutil      59. 13.100 / 59. 13.100
   libavcodec     61.  5.101 / 61.  5.101
   libavformat    61.  3.100 / 61.  3.100
   libavdevice    61.  2.100 / 61.  2.100
   libavfilter    10.  2.101 / 10.  2.101
   libswscale      8.  2.100 /  8.  2.100
   libswresample   5.  2.100 /  5.  2.100
   libpostproc    58.  2.100 / 58.  2.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument 'trace'.
 Reading option '-ss' ... matched as option 'ss' (start transcoding at
 specified time) with argument '0.1'.
 Reading option '-i' ... matched as input url with argument
 'seek_not_working.flac'.
 Reading option '-f' ... matched as option 'f' (force container format
 (auto-detected otherwise)) with argument 'null'.
 Reading option '=' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument trace.
 Successfully parsed a group of options.
 Parsing a group of options: input url seek_not_working.flac.
 Applying option ss (start transcoding at specified time) with argument
 0.1.
 Successfully parsed a group of options.
 Opening an input file: seek_not_working.flac.
 [AVFormatContext @ 0x137504680] Opening 'seek_not_working.flac' for
 reading
 [file @ 0x600000438280] Setting default whitelist 'file,crypto,data'
 Probing flac score:100 size:2048
 [flac @ 0x137504680] Format flac probed with size=2048 and score=100
 [flac @ 0x137504680] Before avformat_find_stream_info() pos: 8288 bytes
 read:32768 seeks:0 nb_streams:1
 [flac @ 0x137504680] All info found
 [flac @ 0x137504680] stream 0: start_time: 109.923265 duration: 112
 [flac @ 0x137504680] format: start_time: 109.923265 duration: 112
 (estimate from stream) bitrate=6 kb/s
 [flac @ 0x137504680] After avformat_find_stream_info() pos: 59392 bytes
 read:65536 seeks:0 frames:1
 [flac @ 0x137504680] read_seek: 0 4852026
 [flac @ 0x137504680] gen_seek: 0 4852026
 [NULL @ 0x137504d90] Junk frame till offset 684
 Input #0, flac, from 'seek_not_working.flac':
   Metadata:
     encoder         : Lavf55.33.100
   Duration: 00:01:52.00, start: 109.923265, bitrate: 6 kb/s
   Stream #0:0, 1, 1/44100: Audio: flac, 44100 Hz, stereo, s32 (24 bit)
 Successfully opened the file.
 Parsing a group of options: output url =.
 Applying option f (force container format (auto-detected otherwise)) with
 argument null.
 Successfully parsed a group of options.
 Opening an output file: =.
 [out#0/null @ 0x600001f20000] No explicit maps, mapping streams
 automatically...
 [aost#0:0/pcm_s16le @ 0x137505ee0] Created audio stream from input stream
 0:0
 detected 10 logical cores
 Successfully opened the file.
 Stream mapping:
   Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
 [aost#0:0/pcm_s16le @ 0x137505ee0] Starting thread...
 [af#0:0 @ 0x600001820000] Starting thread...
 [aist#0:0/flac @ 0x137505620] [dec:flac @ 0x137104d00] Starting thread...
 [in#0/flac @ 0x600001624200] Starting thread...
 Press [q] to stop, [?] for help
 [in#0/flac @ 0x600001624200] EOF while reading input
 [in#0/flac @ 0x600001624200] Terminating thread with return code 0
 (success)
 [aist#0:0/flac @ 0x137505620] [dec:flac @ 0x137104d00] Decoder thread
 received EOF packet
 [flac @ 0x137105a10] invalid residual
 [flac @ 0x137105a10] decode_frame() failed
 [aist#0:0/flac @ 0x137505620] [dec:flac @ 0x137104d00] Decoding error:
 Invalid data found when processing input
 [aist#0:0/flac @ 0x137505620] [dec:flac @ 0x137104d00] Decoder returned
 EOF, finishing
 [aist#0:0/flac @ 0x137505620] [dec:flac @ 0x137104d00] Decode error rate 1
 exceeds maximum 0.666667
 [aist#0:0/flac @ 0x137505620] [dec:flac @ 0x137104d00] Task finished with
 error code: -1145393733 (Error number -1145393733 occurred)
 [aist#0:0/flac @ 0x137505620] [dec:flac @ 0x137104d00] Terminating thread
 with return code -1145393733 (Error number -1145393733 occurred)
 [graph_0_in_0:0 @ 0x600001d20160] Setting 'time_base' to value '1/44100'
 [graph_0_in_0:0 @ 0x600001d20160] Setting 'sample_rate' to value '44100'
 [graph_0_in_0:0 @ 0x600001d20160] Setting 'sample_fmt' to value 's32'
 [graph_0_in_0:0 @ 0x600001d20160] Setting 'channel_layout' to value
 'stereo'
 [graph_0_in_0:0 @ 0x600001d20160] tb:1/44100 samplefmt:s32
 samplerate:44100 chlayout:stereo
 [format_out_0_0 @ 0x600001d20370] Setting 'sample_fmts' to value 's16'
 [format_out_0_0 @ 0x600001d20370] auto-inserting filter 'auto_aresample_0'
 between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
 [AVFilterGraph @ 0x600000138000] query_formats: 5 queried, 6 merged, 7
 already done, 0 delayed
 [auto_aresample_0 @ 0x600001d38000] [SWR @ 0x120008000] Using fltp
 internally between filters
 [auto_aresample_0 @ 0x600001d38000] ch:2 chl:stereo fmt:s32 r:44100Hz ->
 ch:2 chl:stereo fmt:s16 r:44100Hz
 [out_0_0 @ 0x600001d202c0] EOF on sink link out_0_0:default.
 [af#0:0 @ 0x600001820000] Filtergraph returned EOF, finishing
 [af#0:0 @ 0x600001820000] All consumers returned EOF
 [aost#0:0/pcm_s16le @ 0x137505ee0] No filtered frames for output stream,
 trying to initialize anyway.
 Output #0, null, to '=':
   Metadata:
     encoder         : Lavf61.3.100
   Stream #0:0, 0, 1/44100: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411
 kb/s
       Metadata:
         encoder         : Lavc61.5.101 pcm_s16le
 [out#0/null @ 0x600001f20000] Starting thread...
 [aost#0:0/pcm_s16le @ 0x137505ee0] Encoder thread received EOF
 [aost#0:0/pcm_s16le @ 0x137505ee0] Terminating thread with return code 0
 (success)
 [out#0/null @ 0x600001f20000] All streams finished
 [out#0/null @ 0x600001f20000] Terminating thread with return code 0
 (success)
 [af#0:0 @ 0x600001820000] Terminating thread with return code 0 (success)
 [out#0/null @ 0x600001f20000] Output file #0 (=):
 [out#0/null @ 0x600001f20000]   Output stream #0:0 (audio): 0 frames
 encoded (0 samples); 0 packets muxed (0 bytes);
 [out#0/null @ 0x600001f20000]   Total: 0 packets (0 bytes) muxed
 [out#0/null @ 0x600001f20000] video:0KiB audio:0KiB subtitle:0KiB other
 streams:0KiB global headers:0KiB muxing overhead: unknown
 [out#0/null @ 0x600001f20000] Output file is empty, nothing was
 encoded(check -ss / -t / -frames parameters if used)
 size=N/A time=N/A bitrate=N/A speed=N/A
 [in#0/flac @ 0x600001624200] Input file #0 (seek_not_working.flac):
 [in#0/flac @ 0x600001624200]   Input stream #0:0 (audio): 1 packets read
 (228 bytes); 0 frames decoded; 1 decode errors (0 samples);
 [in#0/flac @ 0x600001624200]   Total: 1 packets (228 bytes) demuxed
 [AVIOContext @ 0x1375048f0] Statistics: 152340 bytes read, 1 seeks
 Conversion failed!

 }}}
 Patches should be submitted to the ffmpeg-devel mailing list and not this
 bug tracker.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10957>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list