vi / udptap_tunnel

Simple UDP tun/tap-based tunnel with mcrypt encryption. Also some more AF_PACKET and tun/tap related tools.
38 stars 14 forks source link

How to use buffered_pipeline? #1

Open czarina opened 7 years ago

czarina commented 7 years ago

Hi,

thanks for the great work!

I have a pipeline where a command records some audio, sends it to a FIFO pipe, which is read by FFMPEG.

My FIFO pipe's buffer is overflowing, so I'd like to insert an extra buffer of size 50M or so.

I saw your reply in: http://unix.stackexchange.com/questions/184093/what-to-use-instead-of-buffer-for-1gb-buffer and I actually have the same issue as you. I'm trying to use 'buffer' but sizes past 20M give me "can't handle that many blocks" errors. Did you ever find a way past this?

As an alternative, I'm interested in using your buffered_pipeline, but a bit confused as to how.

Currently, my pipeline is

mkfifo /tmp/temp_audio.mp3
/usr/bin/rec -c 1 -V3 -r 22050 -b 32 -t mp3 /tmp/temp_audio.mp3
ffmpeg -i /tmp/temp_audio.mp3 .... 

Can you provide guidance on how I could use buffered_pipeline to insert a ~50-100MB buffer in between the rec command and /tmp/temp_audio.mp3? Thanks!

vi commented 7 years ago

It should be something like buffered_pipeline ! /usr/bin/rec -c 1 -V3 -r 22050 -b 32 -t mp3 - ! 50000000 ! ffmpeg -f mp3 -i - ....... !

Make sure that maximum allowed socket buffer size allows this (/proc/sys/net/core/wmem_max, /proc/sys/net/core/rmem_max).

But actually /usr/bin/rec is probably an excess here. You can probably request FFmpeg itself to record sound, if FFmpeg is appropriately configured and built.

ffmpeg -f alsa -i default: .......