[FFmpeg-trac] #6333(undetermined:new): ffplay returns error in case of flac picture data error

FFmpeg trac at avcodec.org
Wed Apr 19 15:32:44 EEST 2017


#6333: ffplay returns error in case of flac picture data error
--------------------------------------+----------------------------------
             Reporter:  mikhailnov    |                     Type:  defect
               Status:  new           |                 Priority:  normal
            Component:  undetermined  |                  Version:  3.2.4
             Keywords:  flac          |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
--------------------------------------+----------------------------------
 libavformat/flac_picture.c:116:        av_log(s, AV_LOG_ERROR, "Error
 reading attached picture data.\n");

 In that code, in case of error, it does "goto fail":

 {{{
     memset(data->data + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
     if (avio_read(pb, data->data, len) != len) {
         av_log(s, AV_LOG_ERROR, "Error reading attached picture data.\n");
         if (s->error_recognition & AV_EF_EXPLODE)
             ret = AVERROR(EIO);
         goto fail;
     }
 }}}

 So, I try to ffplay this file and ffmpeg does not play it, returning an
 error:

 {{{
 $ ffplay file.flac
 ffplay version 3.2.4-2~xenial Copyright (c) 2003-2017 the FFmpeg
 developers
   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
   configuration: --prefix=/usr --extra-version='2~xenial'
 --libdir=/usr/lib/ffmpeg --shlibdir=/usr/lib/ffmpeg --disable-static
 --disable-debug --toolchain=hardened --enable-pthreads --enable-runtime-
 cpudetect --enable-gpl --enable-shared --disable-decoder=libopenjpeg
 --disable-decoder=libschroedinger --enable-avresample --enable-avisynth
 --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite
 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-
 libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-
 libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-
 libschroedinger --enable-libshine --enable-netcdf --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-libzvbi
 --enable-openal --enable-opengl --enable-x11grab --enable-version3
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-
 amrwbenc --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-
 frei0r --enable-libx264 --enable-libopencv --enable-libkvazaar --enable-
 libopenh264 --enable-nonfree --enable-libfdk-aac
   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
 [flac @ 0x7f57b0000920] Error reading attached picture data.f=0/0
 Input #0, flac, from 'file.flac':  0KB vq=    0KB sq=    0B f=0/0
   Duration: 00:04:02.23, bitrate: 4517 kb/s
     Stream #0:0: Audio: flac, 44100 Hz, 5.1(side), s32 (24 bit)
     nan M-A:    nan fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0
 }}}

 The same is with other programs using ffmpeg for decoding, e.g. mpv:

 {{{
 $ mpv file.flac
 Playing: file.flac
 [ffmpeg/demuxer] flac: Error reading attached picture data.
  (+) Audio --aid=1 (flac)
 Error initializing audio.
 Audio: no audio

 Exiting... (Errors when loading file)

 }}}

 But the file IS WELL playable with other decoders (e.g. in Amarok,
 Banshee, Clementine), and ffmpeg cannot transcode the file, while it seems
 to not return propper erros, the vast majority of console output is green,
 see the screenshot.

 {{{
 $ ffmpeg -v 9 -loglevel 99 -i file.flac file2.flac
 ffmpeg version 3.2.4-2~xenial Copyright (c) 2000-2017 the FFmpeg
 developers
   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
   configuration: --prefix=/usr --extra-version='2~xenial'
 --libdir=/usr/lib/ffmpeg --shlibdir=/usr/lib/ffmpeg --disable-static
 --disable-debug --toolchain=hardened --enable-pthreads --enable-runtime-
 cpudetect --enable-gpl --enable-shared --disable-decoder=libopenjpeg
 --disable-decoder=libschroedinger --enable-avresample --enable-avisynth
 --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite
 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-
 libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-
 libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-
 libschroedinger --enable-libshine --enable-netcdf --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-libzvbi
 --enable-openal --enable-opengl --enable-x11grab --enable-version3
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-
 amrwbenc --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-
 frei0r --enable-libx264 --enable-libopencv --enable-libkvazaar --enable-
 libopenh264 --enable-nonfree --enable-libfdk-aac
   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
 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 '-i' ... matched as input url with argument 'file.flac'.
 Reading option 'file2.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 file.flac.
 Successfully parsed a group of options.
 Opening an input file: file.flac.
 [file @ 0x55f7b9425cc0] Setting default whitelist 'file,crypto'
 Probing flac score:50 size:2048
 [flac @ 0x55f7b9425460] Format flac probed with size=2048 and score=50
 [flac @ 0x55f7b9425460] Error reading attached picture data.
 [flac @ 0x55f7b9425460] Before avformat_find_stream_info() pos: 4815279
 bytes read:214681 seeks:1 nb_streams:1
 [flac @ 0x55f7b9425460] stream 0: start_time: -209146758205323.719
 duration: 242.227
 [flac @ 0x55f7b9425460] format: start_time: -9223372036854.775 duration:
 242.227 bitrate=4517 kb/s
 [flac @ 0x55f7b9425460] After avformat_find_stream_info() pos: 136786045
 bytes read:132185447 seeks:1 frames:0
 Input #0, flac, from 'file.flac':
   Duration: 00:04:02.23, bitrate: 4517 kb/s
     Stream #0:0, 0, 1/44100: Audio: flac, 44100 Hz, 5.1(side), s32 (24
 bit)
 Successfully opened the file.
 Parsing a group of options: output url file2.flac.
 Successfully parsed a group of options.
 Opening an output file: file2.flac.
 [file @ 0x55f7b9429c20] Setting default whitelist 'file,crypto'
 Successfully opened the file.
 detected 4 logical cores
 [graph 0 input from stream 0:0 @ 0x55f7b942af00] Setting 'time_base' to
 value '1/44100'
 [graph 0 input from stream 0:0 @ 0x55f7b942af00] Setting 'sample_rate' to
 value '44100'
 [graph 0 input from stream 0:0 @ 0x55f7b942af00] Setting 'sample_fmt' to
 value 's32'
 [graph 0 input from stream 0:0 @ 0x55f7b942af00] Setting 'channel_layout'
 to value '0x60f'
 [graph 0 input from stream 0:0 @ 0x55f7b942af00] tb:1/44100 samplefmt:s32
 samplerate:44100 chlayout:0x60f
 [audio format for output stream 0:0 @ 0x55f7b942b6e0] Setting
 'sample_fmts' to value 's16|s32'
 [AVFilterGraph @ 0x55f7b9429de0] query_formats: 4 queried, 9 merged, 0
 already done, 0 delayed
 [flac @ 0x55f7b94290a0]  compression: 5
 [flac @ 0x55f7b94290a0]  lpc type: Levinson-Durbin recursion with Welch
 window
 [flac @ 0x55f7b94290a0]  prediction order: 1, 8
 [flac @ 0x55f7b94290a0]  order method: estimate
 [flac @ 0x55f7b94290a0]  partition order: 0, 8
 [flac @ 0x55f7b94290a0]  block size: 4608
 [flac @ 0x55f7b94290a0]  lpc precision: 15
 Output #0, flac, to 'file2.flac':
   Metadata:
     encoder         : Lavf57.56.101
     Stream #0:0, 0, 1/44100: Audio: flac, 44100 Hz, 5.1(side), s32 (24
 bit), 128 kb/s
     Metadata:
       encoder         : Lavc57.64.101 flac
 Stream mapping:
   Stream #0:0 -> #0:0 (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)
     Last message repeated 2 times
 [output stream 0:0 @ 0x55f7b942ad80] EOF on sink link output stream
 0:0:default.
 No more output streams to write to, finishing.
 size=       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 (file.flac):
   Input stream #0:0 (audio): 0 packets read (0 bytes); 0 frames decoded (0
 samples);
   Total: 0 packets (0 bytes) demuxed
 Output file #0 (file2.flac):
   Output stream #0:0 (audio): 0 frames encoded (0 samples); 1 packets
 muxed (0 bytes);
   Total: 1 packets (0 bytes) muxed
 0 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x55f7b9429aa0] Statistics: 2 seeks, 2 writeouts
 [AVIOContext @ 0x55f7b942e060] Statistics: 132185447 bytes read, 1 seeks
 }}}
 So it reports successfull transcoding, while the output file is not
 decodable. The input (file.flac) is 130 MB, the output (file2.flac) is 8
 KB.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6333>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list