I’m seeing a lot of latency in streaming from a webcam with GNURadio and
The transmit chain looks like:
ffmpeg | ./modulator > tx.fifo &
then I run
modulator is an external code I am running that is not part of gnuradio.
uhd_stream_tx is a python script I made with GRC and it reads tx.fifo,
resamples the signal, and then outputs to the USRP.
The receive chain looks like:
sudo ./usrp_stream_rx.py &
then I run
cat rx.fifo | ./demodulator | ffplay -
demodulator is an external code that is not part of gnuradio.
uhd_stream_rx is a python script that reads samples from the usrp and
writes them to rx.fifo.
First I run the receive chain, then the transmit chain with about a 1-2
second delay in between executing the receive and transmit commands.
When waiving my hand in front of the webcam, the above gives me latency
in the ffplay video player of about 5-10 seconds initially, and this
keeps growing in time to be quite high (even up to 30-45 seconds).
Someone else named Alex Csete had tried a similar DVB transmission and
said he had seen 10 seconds of lag initially with his setup. Does anyone
know what is causing this building lag? Could it be the fifo files in
The external modulator and demodulator code runs in real-time at fixed
data rates that the usrp can handle when sampling a signal at 1MHz. The
ffmpeg encoder bitrate is set to be about the same as the modulator
I also tried the same thing without the USRP by connecting a cat5e cable
between the transmitter and receiver laptops. Then I replace
./usrp_stream_rx.py and ./usrp_stream_tx.py in the tx/rx chains with
netcat commands using nc -l 1234 for the receiver, and nc 18.104.22.168 for
the transmitter. This works great and I don’t see any of the 5-10 second
latency as with the USRP.
I don’t know how or if gnuradio interblock buffers or fusb settings play
in to the latency I’m seeing? The sampling rate for the TX and RX is 1
MHz so it seems samples are pushed through at a fast enough rate and
this latency shouldn’t be buffer related. I don’t see any underrun or
overrun errors on the transmitter or receiver so the signal seems to be
I appreciate any advice. I’m out of ideas and have searched a lot on
latency related to GNURadio and most of the latency I’ve read up on
seems to be in the microsecond to millisecond ranges.
Thanks very much, Tom