[FFmpeg-user] delay time in live ultrasound converter
Paul B Mahol
onemda at gmail.com
Thu Aug 22 20:27:02 EEST 2019
On Thu, Aug 22, 2019 at 7:07 PM Michael Koch <astroelectronic at t-online.de>
wrote:
> Hello,
>
> I'm using the following batch file (Windows 7) for a live ultrasound
> conversion.
>
> set "SR=44100" :: Sample rate
> set "F=14000" :: Subtracted frequency
> set "VOL=10" :: Volume factor
> set /a "N=4096*%F%/%SR%" :: N = 4096 * F / SR
>
> c:\ffmpeg\ffmpeg -f dshow -sample_rate %SR% -sample_size 16 -channels 2
> -i audio="Microphone (SoundMAX Integrated" -af
> volume=%VOL%,afftfilt='real=if(lt(b+%N%,nb),real(b+%N%,ch),0)':'imag=if(lt(b+%N%,nb),imag(b+%N%,ch),0)'
>
> -f nut - | c:\ffmpeg\ffplay -
>
> FFmpeg gets the audio input from the computer's microphone input and
> passes the converted output to FFplay.
> This works fine for hearing bats, but it has about 1-2 seconds delay
> between input and output.
> Are there any options for minimizing the delay?
>
ffplay and using pipe gives you huge delay. By using mpv and filtergraph
directly you would get much lesser delay.
Default delay introduced by this filter is the one set by win_size in
number of samples, which is by default 4096.
If you need less delay even than this one and can not use lower win_size
because of lesser precision use amultiply solution which
inherently have 0 delay.
Consult documentation of this filter for more info.
>
> The console output is copied below.
>
> Thanks,
> Michael
>
>
> C:\Users\mkoch\Desktop\Ultrasound Live>c:\ffmpeg\ffmpeg -f dshow
> -sample_rate 44
> 100 -sample_size 16 -channels 2 -i audio="Microphone (SoundMAX
> Integrated" -af v
>
> olume=10,afftfilt='real=if(lt(b+1300,nb),real(b+1300,ch),0)':'imag=if(lt(b+1300,
> nb),imag(b+1300,ch),0)' -f nut - | c:\ffmpeg\ffplay -
> ffmpeg version N-92857-g3e461f9d4c Copyright (c) 2000-2018 the FFmpeg
> developers
>
> built with gcc 8.2.1 (GCC) 20181201
> configuration: --enable-gpl --enable-version3 --enable-sdl2
> --enable-fontconfi
> g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
> --enable-lib
> freetype --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amr
> wb --enable-libopenjpeg --enable-libopus --enable-libshine
> --enable-libsnappy --
> enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
> --enable-l
> ibwavpack --enable-libwebp --enable-libx264 --enable-libx265
> --enable-libxml2 --
> enable-libzimg --enable-lzma --enable-zlib --enable-gmp
> --enable-libvidstab --en
> able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
> --enable-libspeex --en
> able-libxvid --enable-libaom --enable-libmfx --enable-amf
> --enable-ffnvcodec --e
> nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec
> --enable-dxva2 --enab
> le-avisynth --enable-libopenmpt
> libavutil 56. 25.100 / 56. 25.100
> libavcodec 58. 42.104 / 58. 42.104
> libavformat 58. 25.100 / 58. 25.100
> ffplay version N-92857-g3e461f9d4c libavdevice 58. 6.101 / 58.
> 6.101 Copyr
> ight (c) 2003-2018 the FFmpeg developers
>
> libavfilter 7. 46.101 / 7. 46.101 built with gcc 8.2.1 (GCC)
> 20181201
>
> configuration: --enable-gpl --enable-version3 --enable-sdl2
> --enable-fontconfi
> g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
> --enable-lib
> freetype --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amr
> wb --enable-libopenjpeg --enable-libopus --enable-libshine
> --enable-libsnappy --
> enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
> --enable-l
> ibwavpack --enable-libwebp --enable-libx264 --enable-libx265
> --enable-libxml2 --
> enable-libzimg --enable-lzma --enable-zlib --enable-gmp
> --enable-libvidstab --en
> able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
> --enable-libspeex --en
> able-libxvid --enable-libaom --enable-libmfx --enable-amf
> --enable-ffnvcodec --e
> nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec
> --enable-dxva2 --enab
> le-avisynth --enable-libopenmpt
> libswscale 5. 4.100 / 5. 4.100
> libswresample 3. 4.100 / 3. 4.100
> libpostproc 55. 4.100 / 55. 4.100
> libavutil 56. 25.100 / 56. 25.100
> libavcodec 58. 42.104 / 58. 42.104
> libavformat 58. 25.100 / 58. 25.100
> libavdevice 58. 6.101 / 58. 6.101
> libavfilter 7. 46.101 / 7. 46.101
> libswscale 5. 4.100 / 5. 4.100
> libswresample 3. 4.100 / 3. 4.100
> libpostproc 55. 4.100 / 55. 4.100
> Guessed Channel Layout for Input Stream #0.0 : stereo 0B f=0/0
> Input #0, dshow, from 'audio=Microphone (SoundMAX Integrated':
> Duration: N/A, start: 1701.243000, bitrate: 1411 kb/s
> Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
> Stream mapping:
> Stream #0:0 -> #0:0 (pcm_s16le (native) -> vorbis (libvorbis))
> Press [q] to stop, [?] for help
> Output #0, nut, to 'pipe:': aq= 0KB vq= 0KB sq= 0B f=0/0
> Metadata:
> encoder : Lavf58.25.100
> Stream #0:0: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 44100
> Hz, stereo
> , fltp
> Metadata:
> encoder : Lavc58.42.104 libvorbis
> Input #0, nut, from 'pipe:':
> Metadata:
> encoder : Lavf58.25.100
> Duration: N/A, start: 0.000000, bitrate: N/A
> Stream #0:0: Audio: vorbis (oV[0][0] / 0x566F), 44100 Hz, stereo, fltp
> Metadata:
> encoder : Lavc58.42.104 libvorbis
> 16.27 M-A: 0.000 fd= 0 aq= 3KB vq= 0KB sq= 0B f=0/0
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list