4

I would like to access my security camera that communicates through rtsp feed with an API that only supports a character video kind of entry (I'm new on linux, and I'm not sure if it's called "character video" the '/dev/video1' sort). I followed this post and I get the output below for the following command:

gst-launch-1.0 -v rtspsrc location=rtsp://admin:[email protected]:554/CH001.sdp ! v4l2sink device=/dev/video1

...Progress: (request) Sending PLAY request...

ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc3: Internal data flow error.
Additional debug info:
gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc3:
streaming task paused, reason not-linked (-1)

How do i solve this error? Do you know any way other than gstream for this task?

PS: there are more on the message, I've just resumed to be more readable.

Rinaldi Segecin
  • 257
  • 2
  • 11
  • How sure are you that your URL is correct? Anyways, my first attempt would be to use ffmpeg. https://www.ffmpeg.org/ffmpeg-protocols.html#Examples – Cestarian Jan 29 '16 at 18:03
  • I posted the wrong command by mistake sorry I'm correcting now but with the right one I get the same output. I verified opening the url with VLC, and it's streaming. – Rinaldi Segecin Jan 29 '16 at 18:20
  • Allright, my first guess then would be that the v4l2sink command is what's tripping this process up (has to be either that, or gst itself). (if the gst command is what's wrong, then you can try replacing it with ffmpeg as I suggested) maybe this will work. **ffmpeg -rtsp_flags listen -i rtsp://admin:[email protected]:554/CH001.sdp -f v4l2 /dev/video1** (just make sure you have both v4l2loopback and ffmpeg installed) – Cestarian Jan 29 '16 at 18:26
  • ffmpeg gives gives me the output:
    `[[rtsp @ 0x2252660] Unable to open RTSP for listening rtsp://admin:[email protected]:554/CH001.sdp: Cannot assign requested address`
    but I can still see on VLC entering the same network url.
    – Rinaldi Segecin Jan 29 '16 at 18:38
  • This is the nmap output: `Starting Nmap 6.47 ( http://nmap.org ) at 2016-01-29 16:48 BRST Nmap scan report for 192.168.1.142 Host is up (0.0025s latency). PORT STATE SERVICE 554/tcp open rtsp | rtsp-url-brute: | Discovered URLs | rtsp://192.168.1.142/ | rtsp://192.168.1.142/1.AMP | rtsp://192.168.1.142/1/stream1 | rtsp://192.168.1.142/CAM_ID.password.mp2 | rtsp://192.168.1.142/CH001.sdp Nmap done: 1 IP address (1 host up) scanned in 10.16 seconds` – Rinaldi Segecin Jan 29 '16 at 18:51
  • @RinaldiSegecin It sounds like you should try ffmpeg w/o the `-rtsp_flags listen` part. – derobert Jan 29 '16 at 19:21
  • @Cestarian if that winds up working, please post it as an answer. – derobert Jan 29 '16 at 19:22
  • Maybe... **ffplay -max_delay 500000 -rtsp_transport udp rtsp://admin:[email protected]:554/CH001.sdp -f v4l2 /dev/video1** works? (if it doesn't, try changing "udp" to "http"). But yeah you can also try the ffmpeg command I gave first without **-rtsp_flags listen** as derobert said. And if it works I'll gladly post it as an answer. I don't have a camera of my own to test it on though, so that's up to OP. – Cestarian Jan 29 '16 at 20:43

2 Answers2

6

I've got the rtsp streaming on '/dev/video1' working with the following command:

ffmpeg -i rtsp://admin:[email protected]:554/CH001.sdp -f v4l2 -pix_fmt yuv420p /dev/video1.

Thank you guys for the great support.

Rinaldi Segecin
  • 257
  • 2
  • 11
0

You can also use gstreamer, since ffmpeg and avconv may have problems with the v4l2 format. Please note the use of decodebin in the pipeline.

gst-launch rtspsrc location=rtsp://192.168.2.18/play.sdp ! decodebin ! v4l2sink device=/dev/video1