VLC Flash Streaming and Recording

One of my projects included streaming audio and video from an SDI source. The goal was to be able to cut different sequences of a live event into various files which must be accessible via web immediately and also stream the same thing live over the internet. The goal was achieved by running 6 instances of VLC on 2 different machines. Why that? The encoding-machine runs a VLC process that modifies the input Signal of it's Osprey 530 card to a h264 stream encapsulated in flv and accessible via http. I used the following vlm-config-file for that:

1
2
3
4
5
6
7
8
9
new stream broadcast enabled
setup stream input "dshow://"
setup stream output #transcode{vcodec=h264{keyint=25},vb=200,fps=25,ab=0,\
acodec=mp3,samplerate=44100,audio-sync=1300}:std{access=http{mime=video/x-flv},\
mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv}
setup stream option dshow-vdev="Osprey-5X0 Video Device 1"
setup stream option dshow-adev="SDI-1/2 1 (Osprey-5X0)"
setup stream option dshow-caching=200
control stream play

The VLC process is started with this batch-file:

1
2
3
c:\program files\videolan\vlc\vlc.exe -I telnet --vlm-conf c:\VLC\config.vlm \
--telnet-host 0.0.0.0 --telnet-password xxx --sout-transcode-high-priority \
--sout-x264-keyint=25 --audio-desync=-100

One may notice that I use a windows-machine for that. It was due to drivers in that case. A second VLC process on the same machine just stores a backup copy of the streaming-file - for security purposes. The content of the stream is important. VLM-Config:

1
2
3
new stream broadcast enabled
setup stream input "http://localhost:8081/stream.flv"
setup stream output #file{dst=l:\\stream_gesamt.flv}

The process is started with these options:

1
2
"c:\program files\videolan\vlc\vlc.exe" -I telnet --telnet-port 4213 --vlm-conf \
c:\VLC\save_to_file.vlm --telnet-host 0.0.0.0 --telnet-password xxx

Now the second server comes into place, which does the multiplexing of the live-stream, and the cutting and disk-storing of the whole live stream. two processes handle the ability to cut the stream. Why two processes? Because once we decide to cut, we want to record five seconds of the current stream while we already record a new file. It's sort of fading the video out. Now this runs on a linux machine. First (and second) vlc process on the linux-side runs with this vlm-config:

1
2
3
new stream broadcast enabled
setup stream input "http://10.3.35.23:8081/stream.flv"
setup stream output #file{dst=/tmp/stream.flv}

This basically just stores the stream to disk. It's started with:

1
2
su - stream -c "cvlc --vlm-conf /home/stream/write_to_disk.vlm -vvv -I telnet \
--telnet-port 10001 --telnet-password xxx --logmode syslog -d --syslog"

The clue is to access those processes with the right tool (basically just a telnet client, more on that later on) And here's the live-muxer that streams the whole stream to a broad audience (again the vlm-configuration file):

1
2
3
4
new stream broadcast enabled
setup stream input "http://10.3.35.23:8081/stream.flv"
setup stream output #std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv}
control stream play

And now for controlling all this, I've written a ruby library that just directs all this stuff.

Letzte Änderung: 20.09.2013