I have an IP-CAM that streams video over RTSP and I want to detect bar codes from it with zbarcam (from Ubuntu's zbar-tools package).

According zbarcam's manual, it expects to be given a video4linux character device (default /dev/video0). How can I let it receive that RTSP stream instead?

I tried to use mplayer, but I can't figure out how I could use that to pipe the stream to zbarcam.

  • 2
    You might be able to implement it using the instructions from superuser.com/questions/411897/… Aug 31, 2014 at 20:35
  • Great hint. Meantime I tried to create a node (mknod) but this didn't worked. I will try that ffmpeg v4l-device. Thank you. You better should use answers, then i can vote. Sep 1, 2014 at 6:54
  • I wasn't actually giving a real answer, it was just a hint. I'll try to suggest an answer more properly. Sep 2, 2014 at 15:24

1 Answer 1


Try something on these lines:

sudo apt-get install v4l2loopback-utils gstreamer1.0-tools
sudo modprobe v4l2loopback # might not be needed
gst-launch-1.0 -v rtspsrc location=rtsp://your_stream_url ! v4l2sink device=/dev/video1

Then you should be able to use zbarcam against /dev/video1 as usual.

  • 1
    I think this could work, but not on my rasp pi. there is a problem with that v4l2loopback, can't get it to work. Sep 3, 2014 at 20:06
  • What exactly fails? I guess v4l2loopback should be cross-platform... Sep 9, 2014 at 18:23
  • Is not part of my dist. so i have to compile it. won't compile because i didn't setup the infrastructure correct. I only need time, it's not a technical problem anymore. thx Sep 10, 2014 at 15:12
  • It's not working on my RaspPi either. The error is given below, ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc0: streaming stopped, reason not-linked (-1) Dec 8, 2022 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.