#9403 closed defect (fixed)

Cannot decode .caf file streamed from stdin

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

Description

Summary of the bug:
How to reproduce:

% cat input.caf | ffmpeg -i - -ac 1 -ar 16000 -f f32le - > output.raw

This command produces a zero byte output file, even though the stream format was detected:

ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.9)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, caf, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: 1536 kb/s
  Stream #0:0: Audio: pcm_f32le (lpcm / 0x6D63706C), 48000 Hz, mono, flt, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_f32le (native) -> pcm_f32le (native))
Output #0, f32le, to 'pipe:':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Audio: pcm_f32le, 16000 Hz, mono, flt, 512 kb/s
    Metadata:
      encoder         : Lavc58.134.100 pcm_f32le
size=       0kB 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
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)



However, if the file is read by ffmpeg directly then output is returned:

% ffmpeg -i input.caf -ac 1 -ar 16000 -f f32le - > output.raw

ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.9)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[caf @ 0x7fb63c809400] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, caf, from 'input.caf':
  Duration: 00:00:05.80, start: 0.000000, bitrate: 1541 kb/s
  Stream #0:0: Audio: pcm_f32le (lpcm / 0x6D63706C), 48000 Hz, mono, flt, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_f32le (native) -> pcm_f32le (native))
Press [q] to stop, [?] for help
Output #0, f32le, to 'pipe:':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Audio: pcm_f32le, 16000 Hz, mono, flt, 512 kb/s
    Metadata:
      encoder         : Lavc58.134.100 pcm_f32le
size=     362kB time=00:00:05.79 bitrate= 512.1kbits/s speed= 675x
video:0kB audio:362kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%


ffmpeg version 4.4_2

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (1)

comment:1 by Elon Musk, 13 months ago

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