Opened 9 months ago

Last modified 6 months ago

#7002 new defect

reading wav file from a pipe does not obey the probesize setting

Reported by: akantor Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: wav
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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
% (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.

Attachments (2)

countToTwelve.wav (680.2 KB) - added by akantor 6 months ago.
sample.wav (879.9 KB) - added by akantor 6 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 months ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords wav added
  • Version changed from 3.3.6 to unspecified

Please test current FFmpeg git head to make this a valid ticket.

Can you confirm that the issue is only reproducible if the content of the wav file is pcm_s16le?
Is the issue also reproducible if you configure with --disable-demuxer=spdif?

comment:2 Changed 9 months ago by akantor

Hi,

I confirm the same behavior in the current git head (see the headers of the logs below).


Using mp3 codec in .wav container still seems to give a large delay before probe finishes, but less of one than for pcm_s16le. mulaw codec in .wav container gives the same delay when measured in bytes (and twice as long when measured in audio duration).

$ file mp3InWav.wav mulawInWav.wav 
mp3InWav.wav:   RIFF (little-endian) data, WAVE audio, MPEG Layer 3, stereo 16000 Hz
mulawInWav.wav: RIFF (little-endian) data, WAVE audio, ITU G.711 mu-law, stereo 16000 Hz



(pv -f  -c -L 3200 mp3InWav.wav | ~/ffmpeg_sources/ffmpeg/ffmpeg -v 9 -loglevel 99 -i -  -analyzeduration 200 -probesize 200  countToTwelve.flac) |& tr '\r' '\n'
ffmpeg version N-89955-g118e1b0 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609
  configuration: --prefix=/home/akantor/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/akantor/ffmpeg_build/include --extra-ldflags=-L/home/akantor/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/akantor/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-nonfree
  libavutil      56.  7.100 / 56.  7.100
  libavcodec     58.  9.100 / 58.  9.100
  libavformat    58.  7.100 / 58.  7.100
  libavdevice    58.  0.101 / 58.  0.101
  libavfilter     7. 11.101 /  7. 11.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.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 @ 0x253cb00] Opening 'pipe:' for reading
[pipe @ 0x253d400] Setting default whitelist 'crypto'
Probing mp3 score:25 size:2048
Probing wav score:99 size:2048
[wav @ 0x253cb00] Format wav probed with size=2048 and score=99
[wav @ 0x253cb00] Before avformat_find_stream_info() pos: 104 bytes read:2240 seeks:0 nb_streams:1
3.12KiB 0:00:01 [2.88KiB/s] [>                                 ]  4% ETA 0:00:19
6.25KiB 0:00:02 [3.14KiB/s] [==>                               ]  9% ETA 0:00:18
9.38KiB 0:00:03 [3.14KiB/s] [===>                              ] 14% ETA 0:00:17
[wav @ 0x253cb00] All info found
[wav @ 0x253cb00] stream 0: start_time: -576460752303423.500 duration: 10.952
[wav @ 0x253cb00] format: start_time: -9223372036854.775 duration: 10.952 bitrate=0 kb/s
[wav @ 0x253cb00] After avformat_find_stream_info() pos: 12200 bytes read:12480 seeks:0 frames:50
Input #0, wav, from 'pipe:':
  Metadata:
    encoder         : Lavf58.7.100
  Duration: 00:00:10.95, bitrate: N/A
    Stream #0:0, 50, 1/16000: Audio: mp3 (U[0][0][0] / 0x0055), 16000 Hz, stereo, s16p, 48 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 @ 0x2546700] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (native) -> flac (native))
cur_dts is invalid (this is harmless if it occurs once at the start per stream)

.....



(pv -f  -c -L 16000 mulawInWav.wav | ~/ffmpeg_sources/ffmpeg/ffmpeg -v 9 -loglevel 99 -i -  -analyzeduration 200 -probesize 200  countToTwelve.flac) |& tr '\r' '\n'
ffmpeg version N-89955-g118e1b0 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609
  configuration: --prefix=/home/akantor/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/akantor/ffmpeg_build/include --extra-ldflags=-L/home/akantor/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/akantor/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-nonfree
  libavutil      56.  7.100 / 56.  7.100
  libavcodec     58.  9.100 / 58.  9.100
  libavformat    58.  7.100 / 58.  7.100
  libavdevice    58.  0.101 / 58.  0.101
  libavfilter     7. 11.101 /  7. 11.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.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 @ 0x229ab00] Opening 'pipe:' for reading
[pipe @ 0x229b400] Setting default whitelist 'crypto'
Probing mp3 score:1 size:2048
Probing wav score:99 size:2048
[wav @ 0x229ab00] Format wav probed with size=2048 and score=99
[wav @ 0x229ab00] Before avformat_find_stream_info() pos: 92 bytes read:3200 seeks:0 nb_streams:1
[wav @ 0x229ab00] parser not found for codec pcm_mulaw, packets or times may be invalid.
15.6KiB 0:00:01 [14.4KiB/s] [>                                 ]  4% ETA 0:00:20
31.2KiB 0:00:02 [15.7KiB/s] [==>                               ]  9% ETA 0:00:19
46.9KiB 0:00:03 [15.7KiB/s] [===>                              ] 13% ETA 0:00:18
62.5KiB 0:00:04 [15.7KiB/s] [=====>                            ] 18% ETA 0:00:17
78.1KiB 0:00:05 [15.7KiB/s] [======>                           ] 22% ETA 0:00:16
93.8KiB 0:00:06 [15.7KiB/s] [========>                         ] 27% ETA 0:00:15
 109KiB 0:00:07 [15.7KiB/s] [=========>                        ] 31% ETA 0:00:14
 125KiB 0:00:08 [15.7KiB/s] [===========>                      ] 36% ETA 0:00:13
 140KiB 0:00:09 [15.7KiB/s] [============>                     ] 40% ETA 0:00:12
 156KiB 0:00:10 [15.7KiB/s] [==============>                   ] 45% ETA 0:00:11
 171KiB 0:00:11 [15.7KiB/s] [================>                 ] 50% ETA 0:00:10
    Last message repeated 1 times
[wav @ 0x229ab00] max_analyze_duration 5000000 reached at 5120000 microseconds st:0
[wav @ 0x229ab00] stream 0: start_time: -576460752303423.500 duration: 10.980
[wav @ 0x229ab00] format: start_time: -9223372036854.775 duration: 10.980 bitrate=0 kb/s
[wav @ 0x229ab00] After avformat_find_stream_info() pos: 176220 bytes read:177600 seeks:0 frames:42
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'pipe:':
  Metadata:
    encoder         : Lavf58.7.100
  Duration: 00:00:10.98, bitrate: N/A
    Stream #0:0, 42, 1/16000: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 16000 Hz, stereo, s16, 256 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 @ 0x22d8e80] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_mulaw (native) -> flac (native))
cur_dts is invalid (this is harmless if it occurs once at the start per stream)



The same behavior is there even with --disable-demuxer=spdif .

(pv -f  -c -L 32000 countToTwelve.wav | ./ffmpeg -v 9 -loglevel 99 -i -  -analyzeduration 200 -probesize 200  countToTwelve.flac) |& tr '\r' '\n'
ffmpeg version N-89955-g118e1b0 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609
  configuration: --prefix=/home/akantor/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/akantor/ffmpeg_build/include --extra-ldflags=-L/home/akantor/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/akantor/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --disable-demuxer=spdif --enable-nonfree
  libavutil      56.  7.100 / 56.  7.100
  libavcodec     58.  9.100 / 58.  9.100
  libavformat    58.  7.100 / 58.  7.100
  libavdevice    58.  0.101 / 58.  0.101
  libavfilter     7. 11.101 /  7. 11.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.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 @ 0x31d5b00] Opening 'pipe:' for reading
[pipe @ 0x31d6400] Setting default whitelist 'crypto'
Probing wav score:99 size:2048
[wav @ 0x31d5b00] Format wav probed with size=2048 and score=99
[wav @ 0x31d5b00] Before avformat_find_stream_info() pos: 44 bytes read:3200 seeks:0 nb_streams:1
[wav @ 0x31d5b00] probing stream 0 pp:32
[wav @ 0x31d5b00] probing stream 0 pp:31
Probing mp3 score:1 size:8192
[wav @ 0x31d5b00] Probe with size=8192, packets=2470 detected mp3 with score=1
[wav @ 0x31d5b00] probing stream 0 pp:30
[wav @ 0x31d5b00] probing stream 0 pp:29
Probing mp3 score:1 size:16384
[wav @ 0x31d5b00] Probe with size=16384, packets=2472 detected mp3 with score=1
[wav @ 0x31d5b00] probing stream 0 pp:28
[wav @ 0x31d5b00] probing stream 0 pp:27
[wav @ 0x31d5b00] probing stream 0 pp:26
31.2KiB 0:00:01 [28.8KiB/s] [>                                 ]  4% ETA 0:00:20
[wav @ 0x31d5b00] probing stream 0 pp:25
[wav @ 0x31d5b00] probing stream 0 pp:24
[wav @ 0x31d5b00] probing stream 0 pp:23
[wav @ 0x31d5b00] probing stream 0 pp:22
[wav @ 0x31d5b00] probing stream 0 pp:21
[wav @ 0x31d5b00] probing stream 0 pp:20
[wav @ 0x31d5b00] probing stream 0 pp:19
[wav @ 0x31d5b00] probing stream 0 pp:18
62.5KiB 0:00:02 [31.4KiB/s] [==>                               ]  9% ETA 0:00:19
[wav @ 0x31d5b00] probing stream 0 pp:17
[wav @ 0x31d5b00] probing stream 0 pp:16
[wav @ 0x31d5b00] probing stream 0 pp:15
[wav @ 0x31d5b00] probing stream 0 pp:14
[wav @ 0x31d5b00] probing stream 0 pp:13
[wav @ 0x31d5b00] probing stream 0 pp:12
[wav @ 0x31d5b00] probing stream 0 pp:11
[wav @ 0x31d5b00] probing stream 0 pp:10
93.8KiB 0:00:03 [31.4KiB/s] [===>                              ] 13% ETA 0:00:18
[wav @ 0x31d5b00] probing stream 0 pp:9
[wav @ 0x31d5b00] probing stream 0 pp:8
[wav @ 0x31d5b00] probing stream 0 pp:7
[wav @ 0x31d5b00] probing stream 0 pp:6
[wav @ 0x31d5b00] probing stream 0 pp:5
[wav @ 0x31d5b00] probing stream 0 pp:4
[wav @ 0x31d5b00] probing stream 0 pp:3
[wav @ 0x31d5b00] probing stream 0 pp:2
 125KiB 0:00:04 [31.4KiB/s] [=====>                            ] 18% ETA 0:00:17
[wav @ 0x31d5b00] probing stream 0 pp:1
[wav @ 0x31d5b00] probed stream 0
[wav @ 0x31d5b00] 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 @ 0x31d5b00] All info found
[wav @ 0x31d5b00] stream 0: start_time: -576460752303423.500 duration: -576460752303423.500
[wav @ 0x31d5b00] format: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=512 kb/s
[wav @ 0x31d5b00] 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 @ 0x321ba40] 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)


comment:3 Changed 8 months ago by akantor

  • Version changed from unspecified to git-master

comment:4 Changed 8 months ago by akantor

Hi, any thoughts on this? Isn't it kind of strange that .wav is the only container that needs to look far into the stream before the probe finishes...

comment:5 Changed 6 months ago by akantor

A couple of things:

  1. In the examples above, I was giving the wrong way to reproduce. Instead of

(pv -f -c -L 32000 countToTwelve.wav | ./ffmpeg -v 9 -loglevel 99 -i - -analyzeduration 200 -probesize 200 countToTwelve.flac) |& tr '\r' '\n'
it should have been
(pv -f -c -L 32000 countToTwelve.wav | ./ffmpeg -v 9 -loglevel 99 -analyzeduration 200 -probesize 200 -i - countToTwelve.flac) |& tr '\r' '\n'

  1. Somehow the problem is fixed in 3.4.2 (was still broken in 3.3.2).

So, please close this ticket.

comment:6 Changed 6 months ago by cehoyos

I get identical behaviour with different versions of FFmpeg, please provide your input file.

Changed 6 months ago by akantor

Changed 6 months ago by akantor

comment:7 follow-up: Changed 6 months ago by akantor

You are right - it comes down to a difference in the .wav files themselves.

$ file countToTwelve.wav 
countToTwelve.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 16000 Hz
$ file sample.wav 
sample.wav: RIFF (little-endian) data, WAVE audio, stereo 16000 Hz

countToTwelve.wav is slow, sample.wav is fast. So the problem isn't yet solved.

It seems the difference is that sample has 32bit floats, and countToTwelve has 16bit shorts (which is way more common).

comment:8 in reply to: ↑ 7 Changed 6 months ago by cehoyos

Replying to akantor:

It seems the difference is that sample has 32bit floats, and countToTwelve has 16bit shorts (which is way more common).

Isn't that what I wrote in comment:1?

comment:9 Changed 6 months ago by akantor

Ah, now I see what you meant. Yes, you did write that :)

Right, the problem doesn't seem to happen if the audio is not 16bit shorts. Does this give some hint of where to look?

Note: See TracTickets for help on using tickets.