[FFmpeg-user] Directshow capture and irregular timing of output to StdErr

Bouke / Videotoolshed bouke at videotoolshed.com
Sat Mar 11 13:39:16 EET 2023


Trying to build a metering tool that displays (almost) RT values.
On Mac, all works fine with AVfoundation, but on Win with Directshow I have an issue:

C:\Users\Bouke>ffmpeg.exe -nostats -f dshow -ar 48000 -i audio="Line (Steinberg CI2)" -filter_complex "ebur128=peak=true" -f null -

Now, this works fine, BUT, the output to stderr is at very irregular intervals.
Output is as expected lines like:
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.199979   TARGET:-23 LUFS    M:-120.7 S:-120.7     I: -70.0 LUFS       LRA:   0.0 LU  FTPK: -55.5 -71.0 dBFS  TPK: -55.2 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.299979   TARGET:-23 LUFS    M:-120.7 S:-120.7     I: -70.0 LUFS       LRA:   0.0 LU  FTPK: -56.2 -72.7 dBFS  TPK: -55.2 -69.8 dBFS

Now, sometimes one line is outputted (as expected) but most of the times it’s 2 up to 4 lines at the same time.
That does not make for a pretty visual show if I parse it ‘as fast as possible’

I could buffer the output and do my display stuff for each line with my own interval / if buffer line length >= 4 or alike, but that would introduce half a second delay, and that does not compute well in my brain when I have to ride the faders…

Is there anything I can do to have FFmpeg spit out each line ‘as soon as it is available’?
(I’m starting FFmpeg from Python, listening to StdOut / StdErr.)

Below the full command, what you cannot see is the irregularity in when the lines arrive….

Thx,

Bouke


C:\Users\Bouke>ffmpeg.exe -nostats -f dshow -ar 48000 -i audio="Line (Steinberg CI2)" -filter_complex "ebur128=peak=true" -f null -

ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, dshow, from 'audio=Line (Steinberg CI2)':
  Duration: N/A, start: 2052080.982000, bitrate: 1536 kb/s
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[Parsed_ebur128_0 @ 00000191617889c0] Summary:

  Integrated loudness:
    I:         -70.0 LUFS
    Threshold:   0.0 LUFS

  Loudness range:
    LRA:         0.0 LU
    Threshold:   0.0 LUFS
    LRA low:     0.0 LUFS
    LRA high:    0.0 LUFS

  True peak:
    Peak:       -inf dBFS
Stream mapping:
  Stream #0:0 (pcm_s16le) -> ebur128:default
  ebur128:out0 -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.0999792  TARGET:-23 LUFS    M:-120.7 S:-120.7     I: -70.0 LUFS       LRA:   0.0 LU  FTPK: -55.2 -69.8 dBFS  TPK: -55.2 -69.8 dBFS
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf60.3.100
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc60.3.100 pcm_s16le
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.199979   TARGET:-23 LUFS    M:-120.7 S:-120.7     I: -70.0 LUFS       LRA:   0.0 LU  FTPK: -55.5 -71.0 dBFS  TPK: -55.2 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.299979   TARGET:-23 LUFS    M:-120.7 S:-120.7     I: -70.0 LUFS       LRA:   0.0 LU  FTPK: -56.2 -72.7 dBFS  TPK: -55.2 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.399979   TARGET:-23 LUFS    M: -65.2 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -56.3 -71.9 dBFS  TPK: -55.2 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.499979   TARGET:-23 LUFS    M: -65.2 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -54.9 -72.0 dBFS  TPK: -54.9 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.593979   TARGET:-23 LUFS    M: -65.2 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -56.3 -71.1 dBFS  TPK: -54.9 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.693979   TARGET:-23 LUFS    M: -65.2 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -56.0 -70.3 dBFS  TPK: -54.9 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.793979   TARGET:-23 LUFS    M: -65.1 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -56.4 -72.0 dBFS  TPK: -54.9 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.893979   TARGET:-23 LUFS    M: -65.1 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -56.0 -72.2 dBFS  TPK: -54.9 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 0.993979   TARGET:-23 LUFS    M: -65.1 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -55.7 -71.4 dBFS  TPK: -54.9 -69.8 dBFS
[Parsed_ebur128_0 @ 000001915fe77a40] t: 1.09398    TARGET:-23 LUFS    M: -65.2 S:-120.7     I: -65.2 LUFS       LRA:   0.0 LU  FTPK: -56.3 -74.1 dBFS  TPK: -54.9 -69.8 dBFS



More information about the ffmpeg-user mailing list