RTSP streaming to Web App (Using VLC 2.0)

11,824

Ok, so the solution that I was looking for came in the form of CVLC 2.0.1 [Console-only VLC], but also took advantage of the muxing capabilities of ffmpeg.

This one-liner transcodes the RTSP stream into FLV and pushes it to my localhost server at a specified port.

cvlc rtsp://xxx.xxx.xxx.xxx:554/vga.sdp :sout='#transcode{vcodec=FLV1,vb=2048,fps=25,scale=1,acodec=none,deinterlace}:http{mime=video/x-flv,mux=ffmpeg{mux=flv},dst=127.0.0.1:8090/device_1.flv}' :no-sout-standard-sap :ttl=5 :sout-keep :no-audio --video --no-sout-audio 

The advantages of this include not having to edit the ffserver.conf file each time the stream changes resolution, bit rate, frame rate, etc. - Only to restart this one line so that it can re-capture the stream. Also, if the stream has the proper specifications, you don't need the vb= and fps= properties; I would only use them if I needed to throttle the stream for the sake of the web page.

--network-caching was another feature that I was considering, though very useful in certain situations, unnecessary in my case.

The Flowplayer code looks something like:

<div style="width:1280px;height:720px;margin:10px" id="player_1"></div><script language="javascript">
flowplayer("player_1", {src: "/js/flowplayer-3.2.7.swf", wmode:"transparent"},{
clip: {
  url: 'http://127.0.0.1:8090/device_1.flv',
  autoPlay: true,
  autoBuffering: true,
  live: true,
  bufferLength:0
}, 
plugins: { 
   controls: { 
      all: false,
      scrubber: true,
      play: true, 
      fullscreen: true, 
      time: false,
      width: '100%',
      opacity: 0.8,
      tooltips: {
        buttons: true,
        fullscreen: 'Enter fullscreen mode'
    }
   }
} 
});

Hope this helps any viewers running into similar issues!

Mason

Share:
11,824
MasonWinsauer
Author by

MasonWinsauer

I have no idea what I know and what I don't know, but I'm learning quickly.

Updated on June 04, 2022

Comments

  • MasonWinsauer
    MasonWinsauer almost 2 years

    I am working on a web app that needs to display streaming video of a remote desktop. We have already implemented this using ffmpeg/ffserver and flowplayer, transcoding the RTSP into .flv format, but it is very fragile and my research has led me to using the command line version of VLC.

    My question is: Is there a way to pipe transcoded RTSP (as OGG, RTP, or another format) into a browser while avoiding a reliance on flash?

    I know that the tag hasn't supported streaming video for quite some time, but I'm having trouble finding consistent documentation. Some say you can pipe RTP directly in, some say you'll never be able to stream throuh the tag.

    Also, I am currently testing all of this on my local Apache server.

    I'm assuming the transcoding will look something along the lines of:

    • vlc -vvv rtsp://xx.xx.xx.xx:554/vga.sdp --no-sout-audio --sout '#standard{access=http,mux=ogg,dst=http://localhost/test_ogg.php}'

    OR

    • vlc -vvv rtsp://xx.xx.xx.xx:554/vga.sdp --no-sout-audio --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=400}:duplicate{dst=display,dst=rtp{mux=ts,dst=xxx.xxx.xx.xx,port=xxxx}}'

    Thanks - Mason

  • zcaudate
    zcaudate almost 12 years
    thanks for the post, I'm new to streaming as it was a great help. when you use this line: http{mime=video/x-flv,mux=ffmpeg{mux=flv},dst=127.0.0.1:8090‌​/device_1.flv} does cvlc create the server? what happens if you have multiple streams?
  • MasonWinsauer
    MasonWinsauer almost 12 years
    As far as I understand, this is a one-liner that transcodes on the fly with no need for a server. It MAY create a virtual server in the background, but I haven't seen any evidence for that. As far as multiple streams go, I would think you would need to have an instance of this running for each one in a separate shell.