All Things Patrick - Working Hard to be Lazy!

  • home
  • blog
  • links
Home › Blogs › patrick's blog

VLC kicks even more butt - it streams!

patrick — Wed, 2009-03-04 11:16

I knew VLC was great for playing video files, especially those files I hadn't been able to play using other players... & it's even cross-platform! What I hadn't paid attention to before was it's ability to stream videos.

My friend, Craig Fowler (aka ToreadorVampire), recently ran me through the process rather quickly... I didn't have much time and he didn't have anything really written up... It was a last minute discussion over IM and I thought it could help to at least get people pointed in the right direction.

There is some documentation up at videolan.org (Streaming HowTo/VLM - VideoLAN Wiki) that shows how to set VLC up to do the streaming, talks about the HTTP interface, etc, but isn't an instant answer.

Here's what Craig set up for /etc/init.d/vlc (modified slightly to fit the blog):

#!/bin/sh
STARTUP_COMMAND=/usr/local/bin/cvlc
PID_LOCATION=/var/run/vlc/vlc.pid
LOG_LOCATION=/var/log/vlc.log
CONFIG_LOCATION=/etc/vlc/vlm.conf

case $1 in
start)
if [ ! -f $PID_LOCATION ]; then
start-stop-daemon --pidfile $PID_LOCATION \
--chuid vlc --exec $STARTUP_COMMAND \
--start -- --vlm-conf $CONFIG_LOCATION \
--file-logging --logfile $LOG_LOCATION \
--quiet --daemon --pidfile $PID_LOCATION
fi
;;
stop)
if [ -f $PID_LOCATION ]; then
start-stop-daemon --pidfile $PID_LOCATION \
--stop --signal 15
fi ;; restart) if [ -f $PID_LOCATION ]; then start-stop-daemon --pidfile $PID_LOCATION \ --stop fi start-stop-daemon --pidfile $PID_LOCATION \ --chuid vlc --exec $STARTUP_COMMAND \ --start -- --vlm-conf $CONFIG_LOCATION \ --file-logging --logfile $LOG_LOCATION \ --quiet --daemon --pidfile $PID_LOCATION ;; esac

Here's what he set up for /etc/vlc/vlm.conf (also slightly modified for blog):

# VLM Config file, used to configure automated streams


# ==================================================================== # Someone's webcams


# -------------------------------------------------------------------- # Camera 2


# For reference, the original VLC command to stream from this camera # vlc "http://username:pass@webcam.example.com/nphMotionJpeg?Resolution=320x240&Quality=Standard" # --sout "#transcode{vcodec=FLV1,acodec=mp3,sameplerate=44100}:std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv}" --noaudio


new camNumber2 broadcast enabled setup camNumber2 input http://username:pass@webcam.example.com/nphMotionJpeg?Resolution=320x240... setup camNumber2 output #transcode{vcodec=FLV1}:std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=127.0.0.1:8081/directory/camera2.flv} setup camNumber2 loop control camNumber2 play # -------------------------------------------------------------------- # ====================================================================

The URLs /nphMotionJpeg etc are just specific to the HTTP stream I was connecting to (in that instance motion JPEG)

The "setup camNumber2 loop" line tells VLC that if the origin stream goes down or it loses its connection, it should just keep trying to reconnect

The output line is obviously telling it to convert to FLV, and make the result stream available at http://127.0.0.1:8081/directory/camera2.flv

I then used some mod_rewrite magic to proxy http://bsgc.co.uk/webcam-streams/ to http://127.0.0.1:8081/directory/

If this is missing anything I'll try to get more info up later, but for now it should get anybody interested in this a good start.

Trackback URL for this post:

http://blog.whitelionsoft.com/trackback/96
  • Development
  • Freelance
  • Friends
  • Video
  • patrick's blog
  • Add new comment

Right on! I can use this.

Marvin Parker (not verified) — Fri, 2010-01-01 19:38

Right on! I can use this. Just installed VLC and searching the net to get the low down on how to configure it. Not as much info as I would like to see. Just got b2evolution working and plan to post a blog with my findings soon myself. Again, thanks.

  • reply

User login

What is OpenID?
Connect
Sign in using Facebook
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password

Pages

  • About Me
  • About My Boxen
  • Quotes
  • 3d Graphics
  • Color Picker App
  • Resume
  • dailymile
  • facebook
  • twitter

Tags in Tags

CSS Design Development Entertainment EVE-Online Firefox Freelance Friends Games Hardware HTML Internet Explorer JavaScript Job Movies & TV Operating Systems Personal PHP Windows YouTube
more tags

Blogroll

  • 456 Berea Street
  • Anne van Kesteren’s Weblog
  • Clients From Hell
  • Derick Rethans' blog
  • Doug Seitz
  • Eric Meyer
  • The FAIL Blog

Powered by Drupal, an open source content management system
  • home
  • blog
  • links