2

I run this command: ffmpeg -f f32le -i pipe:0 -f wav pipe:1

ffmpeg version 4.1-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
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
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, f32le, from 'pipe:0':
Duration: N/A, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_f32le, 44100 Hz, mono, flt, 1411 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_f32le (native) -> pcm_s16le (native))
Output #0, wav, to 'pipe:1':
Metadata:
    ISFT            : Lavf58.20.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
    Metadata:
    encoder         : Lavc58.35.100 pcm_s16le
size=   15144kB time=00:02:55.82 bitrate= 705.6kbits/s speed= 352x    
size=   30684kB time=00:05:56.24 bitrate= 705.6kbits/s speed= 356x    
size=   32043kB time=00:06:12.01 bitrate= 705.6kbits/s speed= 354x    
video:0kB audio:32042kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000238%

Where pipe:0 is the raw PCM data of the left channel of this file. Here is the output wav.

The output seems to be semi valid. It won't play in Quicktime or iTunes. When attempting to add it to an Ableton project, I get "output.wav could not be read. It may be corrupt or not licensed."

However, it does play fine if I simply drag the output wav in Chrome.

The ffprobe output confirms some sort of problem with the file. For this command:

ffprobe -loglevel verbose /Users/maximedupre/Desktop/Dropbox/Programming/api/gg.wav

ffprobe version 3.4.2 Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --disable-jack --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil      55. 78.100 / 55. 78.100
libavcodec     57.107.100 / 57.107.100
libavformat    57. 83.100 / 57. 83.100
libavdevice    57. 10.100 / 57. 10.100
libavfilter     6.107.100 /  6.107.100
libavresample   3.  7.  0 /  3.  7.  0
libswscale      4.  8.100 /  4.  8.100
libswresample   2.  9.100 /  2.  9.100
libpostproc    54.  7.100 / 54.  7.100
[wav @ 0x7f81e3004a00] Ignoring maximum wav data size, file may be invalid
[wav @ 0x7f81e3004a00] parser not found for codec pcm_s16le, packets or times may be invalid.
[wav @ 0x7f81e3004a00] Estimating duration from bitrate, this may be inaccurate
Input #0, wav, from '/Users/maximedupre/Desktop/Dropbox/Programming/api/gg.wav':
Metadata:
    encoder         : Lavf58.20.100
Duration: 00:06:12.01, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 1 channels, s16, 705 kb/s

How can I modify my ffmpeg command to produce a valid wav file?

Cheers!

1 Answer 1

2

FFmpeg can't update metadata in WAVE files when output is written over a non-seekable protocol like a pipe. Quicktime seems to rely on metadata to determine file validity. You have to write to file or some other seekable protocol.

ffmpeg -f f32le -i pipe:0 -f wav file-out.wav

BTW, your input is stereo, so it should be

ffmpeg -f f32le -channels 2 -i pipe:0 -f wav file-out.wav
2
  • This seems to be correct. I'm trying to find official documentation for this, are you aware of some? Thanks! Commented May 14, 2019 at 20:53
  • 1
    Many muxers which store metadata have limitations with non-seekable output. Not explicitly documented, but may be a good idea. Will look into it.
    – Gyan
    Commented May 15, 2019 at 6:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .