Opened 5 years ago

Closed 20 months ago

#7684 closed defect (fixed)

ffmpeg -ss: issue with one flac uncompressed

Reported by: rdsu Owned by:
Priority: important Component: avformat
Version: git-master Keywords: flac seek regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:
I have my music library in FLAC Uncompressed, and I have an issue with at least one file, when using it with FFmpeg -ss option, in Windows.
If I convert this file to FLAC level 0 it works fine.

I'm using FFmpeg 4.1 Windows.

How to reproduce:

When using FFmpeg -ss with that file FLAC Uncompressed:
ffmpeg -ss 15 -i "02 - Sad But True.uncompressedNotWorking.flac" out.flac 2> log.txt

Errors:
[flac @ 00000226f8543a80] blocksize 16384 > 4608
[flac @ 00000226f8543a80] decode_frame() failed
Error while decoding stream #0:0: Invalid data found when processing input

ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '15'.
Reading option '-i' ... matched as input url with argument '02 - Sad But True.uncompressedNotWorking.flac'.
Reading option 'out.flac' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url 02 - Sad But True.uncompressedNotWorking.flac.
Applying option ss (set the start time offset) with argument 15.
Successfully parsed a group of options.
Opening an input file: 02 - Sad But True.uncompressedNotWorking.flac.
[NULL @ 00000226f84ea680] Opening '02 - Sad But True.uncompressedNotWorking.flac' for reading
[file @ 00000226f84eb7c0] Setting default whitelist 'file,crypto'
Probing flac score:100 size:2048
[flac @ 00000226f84ea680] Format flac probed with size=2048 and score=100
[flac @ 00000226f84ea680] Before avformat_find_stream_info() pos: 11988 bytes read:32768 seeks:0 nb_streams:2
[mjpeg @ 00000226f84fe840] marker=d8 avail_size_in_buf=9603
[mjpeg @ 00000226f84fe840] marker parser used 0 bytes (0 bits)
[mjpeg @ 00000226f84fe840] marker=e0 avail_size_in_buf=9601
[mjpeg @ 00000226f84fe840] marker parser used 16 bytes (128 bits)
[mjpeg @ 00000226f84fe840] marker=db avail_size_in_buf=9583
[mjpeg @ 00000226f84fe840] index=0
[mjpeg @ 00000226f84fe840] qscale[0]: 1
[mjpeg @ 00000226f84fe840] marker parser used 67 bytes (536 bits)
[mjpeg @ 00000226f84fe840] marker=db avail_size_in_buf=9514
[mjpeg @ 00000226f84fe840] index=1
[mjpeg @ 00000226f84fe840] qscale[1]: 2
[mjpeg @ 00000226f84fe840] marker parser used 67 bytes (536 bits)
[mjpeg @ 00000226f84fe840] marker=c0 avail_size_in_buf=9445
[mjpeg @ 00000226f84fe840] Changing bps from 0 to 8
[mjpeg @ 00000226f84fe840] sof0: picture: 500x500
[mjpeg @ 00000226f84fe840] component 0 2:2 id: 0 quant:0
[mjpeg @ 00000226f84fe840] component 1 1:1 id: 1 quant:1
[mjpeg @ 00000226f84fe840] component 2 1:1 id: 2 quant:1
[mjpeg @ 00000226f84fe840] pix fmt id 22111100
[mjpeg @ 00000226f84fe840] Format yuvj420p chosen by get_format().
[mjpeg @ 00000226f84fe840] marker parser used 17 bytes (136 bits)
[mjpeg @ 00000226f84fe840] marker=c4 avail_size_in_buf=9426
[mjpeg @ 00000226f84fe840] marker parser used 0 bytes (0 bits)
[mjpeg @ 00000226f84fe840] marker=c4 avail_size_in_buf=9396
[mjpeg @ 00000226f84fe840] marker parser used 0 bytes (0 bits)
[mjpeg @ 00000226f84fe840] marker=c4 avail_size_in_buf=9324
[mjpeg @ 00000226f84fe840] marker parser used 0 bytes (0 bits)
[mjpeg @ 00000226f84fe840] marker=c4 avail_size_in_buf=9297
[mjpeg @ 00000226f84fe840] marker parser used 0 bytes (0 bits)
[mjpeg @ 00000226f84fe840] escaping removed 63 bytes
[mjpeg @ 00000226f84fe840] marker=da avail_size_in_buf=9261
[mjpeg @ 00000226f84fe840] marker parser used 9198 bytes (73584 bits)
[mjpeg @ 00000226f84fe840] marker=d9 avail_size_in_buf=0
[mjpeg @ 00000226f84fe840] decode frame unused 0 bytes
[flac @ 00000226f84fc8c0] sample/frame number mismatch in adjacent frames
    Last message repeated 20 times
[flac @ 00000226f84ea680] All info found
[flac @ 00000226f84ea680] stream 0: start_time: 0.000 duration: 324.706
[flac @ 00000226f84ea680] stream 1: start_time: 0.000 duration: 324.706
[flac @ 00000226f84ea680] format: start_time: 0.000 duration: 324.706 bitrate=4610 kb/s
[flac @ 00000226f84ea680] After avformat_find_stream_info() pos: 262144 bytes read:262144 seeks:0 frames:2
[flac @ 00000226f84ea680] read_seek: 0 1440000
[flac @ 00000226f84ea680] gen_seek: 0 1440000
[NULL @ 00000226f84fc8c0] sample/frame number mismatch in adjacent frames
    Last message repeated 20 times
[NULL @ 00000226f84fc8c0] Junk frame till offset 2065
Input #0, flac, from '02 - Sad But True.uncompressedNotWorking.flac':
  Metadata:
    ALBUM           : Metallica (Studio Master 24bit/96kHz)
    album_artist    : Metallica
    ARTIST          : Metallica
    GENRE           : Pop/Rock
    HDTRACKS        : www.hdtracks.com
    TITLE           : Sad But True
    DATE            : 1991
    track           : 02
    TRACKTOTAL      : 12
  Duration: 00:05:24.71, start: 0.000000, bitrate: 4610 kb/s
    Stream #0:0, 1, 1/96000: Audio: flac, 96000 Hz, stereo, s32 (24 bit)
    Stream #0:1, 1, 1/90000: Video: mjpeg, 1 reference frame, yuvj420p(pc, bt470bg/unknown/unknown, center), 500x500 [SAR 600:600 DAR 1:1], 0/1, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
Successfully opened the file.
Parsing a group of options: output url out.flac.
Successfully parsed a group of options.
Opening an output file: out.flac.
[file @ 00000226f85011c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 8 logical cores
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg (native) -> png (native))
  Stream #0:0 -> #0:1 (flac (native) -> flac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[mjpeg @ 00000226f84ed340] marker=d8 avail_size_in_buf=9603
[mjpeg @ 00000226f84ed340] marker parser used 0 bytes (0 bits)
[mjpeg @ 00000226f84ed340] marker=e0 avail_size_in_buf=9601
[mjpeg @ 00000226f84ed340] marker parser used 16 bytes (128 bits)
[mjpeg @ 00000226f84ed340] marker=db avail_size_in_buf=9583
[mjpeg @ 00000226f84ed340] index=0
[mjpeg @ 00000226f84ed340] qscale[0]: 1
[mjpeg @ 00000226f84ed340] marker parser used 67 bytes (536 bits)
[mjpeg @ 00000226f84ed340] marker=db avail_size_in_buf=9514
[mjpeg @ 00000226f84ed340] index=1
[mjpeg @ 00000226f84ed340] qscale[1]: 2
[mjpeg @ 00000226f84ed340] marker parser used 67 bytes (536 bits)
[mjpeg @ 00000226f84ed340] marker=c0 avail_size_in_buf=9445
[mjpeg @ 00000226f84ed340] sof0: picture: 500x500
[mjpeg @ 00000226f84ed340] component 0 2:2 id: 0 quant:0
[mjpeg @ 00000226f84ed340] component 1 1:1 id: 1 quant:1
[mjpeg @ 00000226f84ed340] component 2 1:1 id: 2 quant:1
[mjpeg @ 00000226f84ed340] pix fmt id 22111100
[mjpeg @ 00000226f84ed340] Format yuvj420p chosen by get_format().
[mjpeg @ 00000226f84ed340] marker parser used 17 bytes (136 bits)
[mjpeg @ 00000226f84ed340] marker=c4 avail_size_in_buf=9426
[mjpeg @ 00000226f84ed340] class=0 index=0 nb_codes=10
[mjpeg @ 00000226f84ed340] marker parser used 28 bytes (224 bits)
[mjpeg @ 00000226f84ed340] marker=c4 avail_size_in_buf=9396
[mjpeg @ 00000226f84ed340] class=1 index=0 nb_codes=242
[mjpeg @ 00000226f84ed340] marker parser used 70 bytes (560 bits)
[mjpeg @ 00000226f84ed340] marker=c4 avail_size_in_buf=9324
[mjpeg @ 00000226f84ed340] class=0 index=1 nb_codes=6
[mjpeg @ 00000226f84ed340] marker parser used 25 bytes (200 bits)
[mjpeg @ 00000226f84ed340] marker=c4 avail_size_in_buf=9297
[mjpeg @ 00000226f84ed340] class=1 index=1 nb_codes=146
[mjpeg @ 00000226f84ed340] marker parser used 34 bytes (272 bits)
[mjpeg @ 00000226f84ed340] escaping removed 63 bytes
[mjpeg @ 00000226f84ed340] marker=da avail_size_in_buf=9261
[mjpeg @ 00000226f84ed340] component: 0
[mjpeg @ 00000226f84ed340] component: 1
[mjpeg @ 00000226f84ed340] component: 2
[mjpeg @ 00000226f84ed340] marker parser used 9197 bytes (73573 bits)
[mjpeg @ 00000226f84ed340] marker=d9 avail_size_in_buf=0
[mjpeg @ 00000226f84ed340] decode frame unused 0 bytes
[graph 0 input from stream 0:1 @ 00000226f894b8c0] Setting 'video_size' to value '500x500'
[graph 0 input from stream 0:1 @ 00000226f894b8c0] Setting 'pix_fmt' to value '12'
[graph 0 input from stream 0:1 @ 00000226f894b8c0] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:1 @ 00000226f894b8c0] Setting 'pixel_aspect' to value '600/600'
[graph 0 input from stream 0:1 @ 00000226f894b8c0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:1 @ 00000226f894b8c0] Setting 'frame_rate' to value '90000/1'
[graph 0 input from stream 0:1 @ 00000226f894b8c0] w:500 h:500 pixfmt:yuvj420p tb:1/90000 fr:90000/1 sar:600/600 sws_param:flags=2
[format @ 00000226f8966380] Setting 'pix_fmts' to value 'rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob'
[auto_scaler_0 @ 00000226f8966800] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 00000226f8966800] w:iw h:ih flags:'bicubic' interl:0
[format @ 00000226f8966380] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 00000226f85b0d40] query_formats: 5 queried, 3 merged, 1 already done, 0 delayed
[auto_scaler_0 @ 00000226f8966800] picking rgb24 out of 10 ref:yuvj420p alpha:0
[swscaler @ 00000226f85b0fc0] deprecated pixel format used, make sure you did set range correctly
[auto_scaler_0 @ 00000226f8966800] w:500 h:500 fmt:yuvj420p sar:600/600 -> w:500 h:500 fmt:rgb24 sar:1/1 flags:0x4
[flac @ 00000226f84ed7c0] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 3 times
[flac @ 00000226f8543a80] blocksize 16384 > 4608
[flac @ 00000226f8543a80] decode_frame() failed
Error while decoding stream #0:0: Invalid data found when processing input
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 3 times
[graph_1_in_0_0 @ 00000226f8aecd40] Setting 'time_base' to value '1/49920'
[graph_1_in_0_0 @ 00000226f8aecd40] Setting 'sample_rate' to value '49920'
[graph_1_in_0_0 @ 00000226f8aecd40] Setting 'sample_fmt' to value 's32'
[graph_1_in_0_0 @ 00000226f8aecd40] Setting 'channel_layout' to value '0x4'
[graph_1_in_0_0 @ 00000226f8aecd40] tb:1/49920 samplefmt:s32 samplerate:49920 chlayout:0x4
[format_out_0_1 @ 00000226f8aee380] Setting 'sample_fmts' to value 's16|s32'
[AVFilterGraph @ 00000226f8a51900] query_formats: 5 queried, 12 merged, 0 already done, 0 delayed
[flac @ 00000226f85005c0]  compression: 5
[flac @ 00000226f85005c0]  lpc type: Levinson-Durbin recursion with Welch window
[flac @ 00000226f85005c0]  prediction order: 1, 8
[flac @ 00000226f85005c0]  order method: estimate
[flac @ 00000226f85005c0]  partition order: 0, 8
[flac @ 00000226f85005c0]  block size: 4608
[flac @ 00000226f85005c0]  lpc precision: 15
Output #0, flac, to 'out.flac':
  Metadata:
    ALBUM           : Metallica (Studio Master 24bit/96kHz)
    album_artist    : Metallica
    ARTIST          : Metallica
    GENRE           : Pop/Rock
    HDTRACKS        : www.hdtracks.com
    TITLE           : Sad But True
    DATE            : 1991
    track           : 02
    TRACKTOTAL      : 12
    encoder         : Lavf58.20.100
    Stream #0:0, 0, 1/90000: Video: png, 1 reference frame, rgb24(center), 500x500 [SAR 1:1 DAR 1:1], 0/1, q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
      encoder         : Lavc58.35.100 png
    Stream #0:1, 0, 1/49920: Audio: flac, 49920 Hz, mono, s32 (24 bit), 128 kb/s
    Metadata:
      encoder         : Lavc58.35.100 flac
[out_0_1 @ 00000226f8aee280] EOF on sink link out_0_1:default.
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[out_0_0 @ 00000226f894c7c0] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
[flac @ 00000226f84ed7c0] No packets were sent for some of the attached pictures.
frame=    0 fps=0.0 q=0.0 Lsize=       8kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (02 - Sad But True.uncompressedNotWorking.flac):
  Input stream #0:0 (audio): 1 packets read (13296 bytes); 0 frames decoded (0 samples); 
  Input stream #0:1 (video): 1 packets read (9605 bytes); 1 frames decoded; 
  Total: 2 packets (22901 bytes) demuxed
Output file #0 (out.flac):
  Output stream #0:0 (video): 0 frames encoded; 0 packets muxed (0 bytes); 
  Output stream #0:1 (audio): 0 frames encoded (0 samples); 1 packets muxed (0 bytes); 
  Total: 1 packets (0 bytes) muxed
1 frames successfully decoded, 1 decoding errors
[AVIOContext @ 00000226f8541340] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 00000226f84f3a40] Statistics: 577507 bytes read, 7 seeks

You have the files here to download (I also share a file flac uncompressed, from the same album, that works fine to compare):
https://cp.sync.com/dl/68426db80/e5ffyb9f-hcg6ibqz-xffkhw6u-amghr5aj

Change History (6)

comment:1 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegavformat
Keywords: regression added; uncompressed removed
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

Regression since d0b21b28a3d348c0302c98cee23c4820cd13e1e2, see ticket #5428

comment:2 by rdsu, 5 years ago

It's possible to know when this issue can be fixed and deployed?

Thanks for your support!

in reply to:  2 comment:3 by Carl Eugen Hoyos, 5 years ago

Replying to rdsu:

It's possible to know when this issue can be fixed and deployed?

Did you send a patch that fixed this issue and that we missed?

comment:4 by Gyan, 5 years ago

Workaround is to trim the audio using a filter.

ffmpeg -i "02 - Sad But True.uncompressedNotWorking.flac" -af atrim=15 -c:v copy out.flac

comment:5 by mkver, 5 years ago

Analyzed by developer: set

There is a wrong header at 187108258 that passes all checks. It is read via flac_read_timestamp and ff_find_last_ts. Said header indicates a blocksize of 16384 samples, a sample rate of 49920 and a timestamp of 0. So the file appears to have a duration of zero.

Last edited 5 years ago by mkver (previous) (diff)

comment:6 by Elon Musk, 20 months ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.