[FFmpeg-trac] #7002(undetermined:new): reading wav file from a pipe does not obey the probesize setting
FFmpeg
trac at avcodec.org
Fri Feb 2 15:07:53 EET 2018
#7002: reading wav file from a pipe does not obey the probesize setting
--------------------------------------+----------------------------------
Reporter: akantor | Type: defect
Status: new | Priority: normal
Component: undetermined | Version: 3.3.6
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
--------------------------------------+----------------------------------
Summary of the bug:
It seems that when a .wav file is read from stdin, the codec probe does
not finish until is sees >100kB of data, or EOS.
Setting the probesize to something smaller doesn't help.
How to reproduce:
{{{
ffmpeg version: 3.3.2-static http://johnvansickle.com/ffmpeg/ (see log
below)
built on: gcc 5.4.1 (Debian 5.4.1-11) 20170519
}}}
{{{#!bash
% (pv -f -c -L 32000 countToTwelve.wav | ./ffmpeg -v 9 -loglevel 99 -i -
-analyzeduration 200 -probesize 200 countToTwelve.flac) |& tr '\r' '\n'
}}}
Any WAV audio will reproduce.
The ` (pv -f -c -L 32000 countToTwelve.wav | ... ) |& tr '\r' '\n' `
pipes the 16khz countToTwelve.wav file at realtime into ffmpeg, and prints
progress lines like
` 375KiB 0:00:12 [31.4KiB/s] [=================> ] 55% ETA
0:00:09}`
Here's the output:
{{{
ffmpeg version 3.3.2-static http://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2017 the FFmpeg developers
built with gcc 5.4.1 (Debian 5.4.1-11) 20170519
configuration: --enable-gpl --enable-version3 --enable-static --disable-
debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio
--cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-
gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-
libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-
libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.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 '-'.
Reading option '-analyzeduration' ... matched as AVOption
'analyzeduration' with argument '200'.
Reading option '-probesize' ... matched as AVOption 'probesize' with
argument '200'.
Reading option 'countToTwelve.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 -.
Successfully parsed a group of options.
Opening an input file: -.
[NULL @ 0x439d6e0] Opening 'pipe:' for reading
[pipe @ 0x439de80] Setting default whitelist 'crypto'
Probing wav score:99 size:2048
[wav @ 0x439d6e0] Format wav probed with size=2048 and score=99
31.2KiB 0:00:01 [28.8KiB/s] [> ] 4% ETA
0:00:20
62.5KiB 0:00:02 [31.4KiB/s] [==> ] 9% ETA
0:00:19
[wav @ 0x439d6e0] Before avformat_find_stream_info() pos: 44 bytes
read:67200 seeks:0 nb_streams:1
[wav @ 0x439d6e0] probing stream 0 pp:32
[wav @ 0x439d6e0] probing stream 0 pp:31
Probing mp3 score:1 size:8192
[wav @ 0x439d6e0] Probe with size=8192, packets=2470 detected mp3 with
score=1
[wav @ 0x439d6e0] probing stream 0 pp:30
[wav @ 0x439d6e0] probing stream 0 pp:29
Probing mp3 score:1 size:16384
[wav @ 0x439d6e0] Probe with size=16384, packets=2472 detected mp3 with
score=1
[wav @ 0x439d6e0] probing stream 0 pp:28
[wav @ 0x439d6e0] probing stream 0 pp:27
[wav @ 0x439d6e0] probing stream 0 pp:26
[wav @ 0x439d6e0] probing stream 0 pp:25
[wav @ 0x439d6e0] probing stream 0 pp:24
[wav @ 0x439d6e0] probing stream 0 pp:23
[wav @ 0x439d6e0] probing stream 0 pp:22
[wav @ 0x439d6e0] probing stream 0 pp:21
[wav @ 0x439d6e0] probing stream 0 pp:20
[wav @ 0x439d6e0] probing stream 0 pp:19
[wav @ 0x439d6e0] probing stream 0 pp:18
[wav @ 0x439d6e0] probing stream 0 pp:17
[wav @ 0x439d6e0] probing stream 0 pp:16
[wav @ 0x439d6e0] probing stream 0 pp:15
[wav @ 0x439d6e0] probing stream 0 pp:14
[wav @ 0x439d6e0] probing stream 0 pp:13
[wav @ 0x439d6e0] probing stream 0 pp:12
[wav @ 0x439d6e0] probing stream 0 pp:11
[wav @ 0x439d6e0] probing stream 0 pp:10
93.8KiB 0:00:03 [31.4KiB/s] [===> ] 13% ETA
0:00:18
[wav @ 0x439d6e0] probing stream 0 pp:9
[wav @ 0x439d6e0] probing stream 0 pp:8
[wav @ 0x439d6e0] probing stream 0 pp:7
[wav @ 0x439d6e0] probing stream 0 pp:6
[wav @ 0x439d6e0] probing stream 0 pp:5
[wav @ 0x439d6e0] probing stream 0 pp:4
[wav @ 0x439d6e0] probing stream 0 pp:3
[wav @ 0x439d6e0] probing stream 0 pp:2
125KiB 0:00:04 [31.4KiB/s] [=====> ] 18% ETA
0:00:17
[wav @ 0x439d6e0] probing stream 0 pp:1
[wav @ 0x439d6e0] probed stream 0
[wav @ 0x439d6e0] parser not found for codec pcm_s16le, packets or times
may be invalid.
156KiB 0:00:05 [31.4KiB/s] [======> ] 22% ETA
0:00:16
187KiB 0:00:06 [31.4KiB/s] [========> ] 27% ETA
0:00:15
[wav @ 0x439d6e0] All info found
[wav @ 0x439d6e0] stream 0: start_time: -576460752303423.500 duration:
-576460752303423.500
[wav @ 0x439d6e0] format: start_time: -9223372036854.775 duration:
-9223372036854.775 bitrate=512 kb/s
[wav @ 0x439d6e0] After avformat_find_stream_info() pos: 204844 bytes
read:208000 seeks:0 frames:50
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'pipe:':
Duration: N/A, bitrate: 512 kb/s
Stream #0:0, 50, 1/16000: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
16000 Hz, stereo, s16, 512 kb/s
Successfully opened the file.
Parsing a group of options: output url countToTwelve.flac.
Successfully parsed a group of options.
Opening an output file: countToTwelve.flac.
[file @ 0x43da0a0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
detected 8 logical cores
[graph_0_in_0_0 @ 0x43bdc00] Setting 'time_base' to value '1/16000'
[graph_0_in_0_0 @ 0x43bdc00] Setting 'sample_rate' to value '16000'
[graph_0_in_0_0 @ 0x43bdc00] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 0x43bdc00] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_0 @ 0x43bdc00] tb:1/16000 samplefmt:s16 samplerate:16000
chlayout:0x3
[format_out_0_0 @ 0x43bda80] Setting 'sample_fmts' to value 's16|s32'
[AVFilterGraph @ 0x43a96e0] query_formats: 4 queried, 9 merged, 0 already
done, 0 delayed
[flac @ 0x43bafe0] compression: 5
[flac @ 0x43bafe0] lpc type: Levinson-Durbin recursion with Welch window
[flac @ 0x43bafe0] prediction order: 1, 8
[flac @ 0x43bafe0] order method: estimate
[flac @ 0x43bafe0] partition order: 0, 8
[flac @ 0x43bafe0] block size: 1152
[flac @ 0x43bafe0] lpc precision: 15
Output #0, flac, to 'countToTwelve.flac':
Metadata:
encoder : Lavf57.71.100
Stream #0:0, 0, 1/16000: Audio: flac, 16000 Hz, stereo, s16, 128 kb/s
Metadata:
encoder : Lavc57.89.100 flac
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
218KiB 0:00:07 [31.4KiB/s] [=========> ] 32% ETA
0:00:14
size= 138kB time=00:00:03.45 bitrate= 327.9kbits/s speed=6.44x
size= 151kB time=00:00:03.81 bitrate= 324.1kbits/s speed=3.54x
250KiB 0:00:08 [31.4KiB/s] [===========> ] 36% ETA
0:00:13
size= 158kB time=00:00:04.03 bitrate= 321.5kbits/s speed=2.49x
size= 171kB time=00:00:04.32 bitrate= 323.9kbits/s speed= 2x
281KiB 0:00:09 [31.4KiB/s] [============> ] 41% ETA
0:00:12
size= 182kB time=00:00:04.60 bitrate= 322.9kbits/s speed=1.65x
size= 192kB time=00:00:04.89 bitrate= 320.9kbits/s speed=1.47x
312KiB 0:00:10 [31.4KiB/s] [==============> ] 45% ETA
0:00:11
size= 205kB time=00:00:05.18 bitrate= 323.6kbits/s speed=1.34x
343KiB 0:00:11 [31.5KiB/s] [================> ] 50% ETA
0:00:10
size= 217kB time=00:00:05.47 bitrate= 324.1kbits/s speed=1.24x
size= 227kB time=00:00:05.76 bitrate= 323.1kbits/s speed=1.16x
375KiB 0:00:12 [31.4KiB/s] [=================> ] 55% ETA
0:00:09
size= 237kB time=00:00:05.97 bitrate= 324.8kbits/s speed=1.09x
size= 247kB time=00:00:06.26 bitrate= 323.5kbits/s speed=1.04x
406KiB 0:00:13 [31.4KiB/s] [===================> ] 59% ETA
0:00:08
size= 257kB time=00:00:06.55 bitrate= 321.4kbits/s speed=0.994x
size= 269kB time=00:00:06.84 bitrate= 321.9kbits/s speed=0.959x
437KiB 0:00:14 [31.4KiB/s] [====================> ] 64% ETA
0:00:07
size= 279kB time=00:00:07.12 bitrate= 320.8kbits/s speed=0.907x
size= 291kB time=00:00:07.48 bitrate= 318.6kbits/s speed=0.891x
468KiB 0:00:15 [31.4KiB/s] [======================> ] 68% ETA
0:00:06
size= 301kB time=00:00:07.70 bitrate= 319.7kbits/s speed=0.861x
500KiB 0:00:16 [31.4KiB/s] [=======================> ] 73% ETA
0:00:05
size= 313kB time=00:00:08.06 bitrate= 318.1kbits/s speed=0.842x
size= 320kB time=00:00:08.28 bitrate= 316.9kbits/s speed=0.818x
531KiB 0:00:17 [28.8KiB/s] [=========================> ] 78% ETA
0:00:04
size= 333kB time=00:00:08.56 bitrate= 318.1kbits/s speed=0.804x
size= 343kB time=00:00:08.85 bitrate= 317.0kbits/s speed=0.79x
562KiB 0:00:18 [31.4KiB/s] [==========================> ] 82% ETA
0:00:03
size= 353kB time=00:00:09.14 bitrate= 316.4kbits/s speed=0.778x
size= 365kB time=00:00:09.43 bitrate= 317.2kbits/s speed=0.762x
593KiB 0:00:19 [31.4KiB/s] [============================> ] 87% ETA
0:00:02
size= 375kB time=00:00:09.72 bitrate= 316.1kbits/s speed=0.752x
size= 383kB time=00:00:09.93 bitrate= 316.0kbits/s speed=0.738x
625KiB 0:00:20 [31.4KiB/s] [=============================> ] 91% ETA
0:00:01
size= 398kB time=00:00:10.29 bitrate= 316.3kbits/s speed=0.735x
656KiB 0:00:21 [31.4KiB/s] [===============================> ] 96% ETA
0:00:00
size= 405kB time=00:00:10.51 bitrate= 315.5kbits/s speed=0.722x
size= 415kB time=00:00:10.80 bitrate= 315.0kbits/s speed=0.716x
680KiB 0:00:21 [31.2KiB/s] [================================>] 100%
[out_0_0 @ 0x43be840] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
size= 419kB time=00:00:10.88 bitrate= 315.1kbits/s speed=0.708x
video:0kB audio:410kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.971850%
Input file #0 (pipe:):
Input stream #0:0 (audio): 171 packets read (696492 bytes); 171 frames
decoded (174123 samples);
Total: 171 packets (696492 bytes) demuxed
Output file #0 (countToTwelve.flac):
Output stream #0:0 (audio): 152 frames encoded (174123 samples); 153
packets muxed (420316 bytes);
Total: 153 packets (420316 bytes) muxed
171 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x43d9f60] Statistics: 2 seeks, 154 writeouts
[AVIOContext @ 0x43a6080] Statistics: 696536 bytes read, 0 seeks
}}}
You can see that the probe finishes only after 187KB of audio is submitted
(6 seconds at real-time)
{{{
187KiB 0:00:06 [31.4KiB/s] [========> ] 27% ETA
0:00:15
[wav @ 0x439d6e0] All info found
}}}
Only after the probe is finished do we see anything transcoded on STDOUT,
which is too long for interactive applications.
Thanks.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7002>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list