Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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 Hendrik, 5 years ago

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

comment:2 by Elon Musk, 5 years ago

Resolution: invalid
Status: newclosed

comment:3 by Carl Eugen Hoyos, 5 years ago

Version: 4.1unspecified

comment:4 by Artem S. Tashkinov, 5 years ago

Resolution: invalid
Status: closedreopened

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 Elon Musk, 5 years ago

Resolution: invalid
Status: reopenedclosed

comment:6 by Artem S. Tashkinov, 5 years ago

Resolution: invalidwontfix

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.

in reply to:  4 ; comment:7 by James, 5 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.

in reply to:  7 comment:8 by Artem S. Tashkinov, 5 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 Artem S. Tashkinov, 5 years ago

Summary: FFMpeg produces invalid WAV filesFFMpeg cannot write length for piped WAV files

comment:10 by Carl Eugen Hoyos, 5 years ago

Resolution: wontfixinvalid
Note: See TracTickets for help on using tickets.