#7892 closed defect (invalid)
FFMpeg cannot write length for piped WAV files
| Reported by: | Artem S. Tashkinov | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | undetermined |
| Version: | unspecified | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
How to reproduce:
$ ffmpeg -ss 00:00:30 -i 1.flac -vn -acodec pcm_s16le -ar 44100 -f wav -loglevel warning - > 1.wav
$ ffmpeg -i 1.wav -f null -
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8 (GCC)
configuration: --disable-static --enable-nonfree --enable-avfilter --enable-shared --enable-gpl --enable-postproc --enable-pthreads --enable-libspeex --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libopus --enable-libopenjpeg --disable-debug --disable-doc --enable-libpulse --extra-cflags='-mtune=generic' --enable-version3 --enable-libvorbis --enable-libfdk-aac --enable-gnutls --enable-libfreetype --enable-libx265 --libdir=/usr/local/lib64 --enable-lto
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
[wav @ 0x12f4140] Ignoring maximum wav data size, file may be invalid
[wav @ 0x12f4140] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '1.wav':
Duration: 00:03:15.19, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc58.35.100 pcm_s16le
1.wav: corrupt input packet in stream 0
size=N/A time=00:03:15.19 bitrate=N/A speed=2.94e+03x
video:0kB audio:33625kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Change History (10)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:3 by , 7 years ago
| Version: | 4.1 → unspecified |
|---|
follow-up: 7 comment:4 by , 7 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
I need to pipe the resulting file to sox. I can't see any other way to do that and previous FFMpeg versions worked fine, e.g. FFMpeg 3.2.2.
comment:5 by , 7 years ago
| Resolution: | → invalid |
|---|---|
| Status: | reopened → closed |
comment:6 by , 7 years ago
| Resolution: | invalid → wontfix |
|---|
Nevermind, I managed to pipe it without using WAV:
ffmpeg -i source.flac -vn -acodec pcm_s16le -ar 44100 -f s16le \ -loglevel warning - | sox -t raw -r 44100 -e signed -b 16 -c 2 - out.wav reverse
Though it's still a loss since I perfectly remember that it worked in the past.
I'll leave it as WONTFIX since this feature used to work in the past and now you're refusing to change it back.
follow-up: 8 comment:7 by , 7 years ago
Replying to birdie:
I need to pipe the resulting file to sox. I can't see any other way to do that and previous FFMpeg versions worked fine, e.g. FFMpeg 3.2.2.
Applications that accept pipping of wav files should ignore the size field. See for example --ignorelength in opusenc.
ffmpeg can't write a size field if the output is not seekable.
comment:8 by , 7 years ago
Replying to jamrial:
Applications that accept pipping of wav files should ignore the size field. See for example --ignorelength in opusenc.
ffmpeg can't write a size field if the output is not seekable.
This is perhaps the best comment in this bug report: you're right, sox manual says such an option exists:
−−ignore−length
Override an (incorrect) audio length given in an audio file’s header. If this option is given then SoX will keep reading audio until it reaches the end of the input file.
Thank you!
comment:9 by , 7 years ago
| Summary: | FFMpeg produces invalid WAV files → FFMpeg cannot write length for piped WAV files |
|---|
comment:10 by , 7 years ago
| Resolution: | wontfix → invalid |
|---|



Don't use redirection to write your file. FFmpeg can't write a proper size tag if it cannot seek in the file.
right:
ffmpeg -ss 00:00:30 -i 1.flac -vn -acodec pcm_s16le -ar 44100 -f wav -loglevel warning 1.wav
wrong:
ffmpeg -ss 00:00:30 -i 1.flac -vn -acodec pcm_s16le -ar 44100 -f wav -loglevel warning - > 1.wav