VLC Multicasting » History » Version 2
Andy Brown, 2012-08-31 14:51
1 | 1 | Andy Brown | h1. VLC Multicasting for IPTV into TVHeadend |
---|---|---|---|
2 | |||
3 | h2. Requirements |
||
4 | |||
5 | Various other video formats exist that are not natively able to be displayed within TV Headend, these include systems such as CCTV, v4l devices and various other inputs. Generally if they can be viewed/opened by VLC then they should be able to be transcoded by VLC and multicast which allows TV Headend to receive them as an IPTV channel. |
||
6 | |||
7 | h2. Implementation |
||
8 | |||
9 | To implement this you need to have VLC and whatever video plugins required to read/encode various formats. In my example the source is an mjpeg stream (Produced by http://motion.sourceforge.net common v4l cctv software for linux. Each camera provides an mjpeg stream on a specific http port). Therefore on my (headless) TVH server I installed vlc (Debian package). |
||
10 | |||
11 | First you should check VLC will decode and display your input stream, so in my case running (On a machine with X11 or X11 forwarding, or windows machine with VLC for testing): |
||
12 | |||
13 | <pre> |
||
14 | vlc -vvv http://192.168.0.1:8001 |
||
15 | </pre> |
||
16 | |||
17 | Allowed me to stream and watch the video being produced. (In this case my motion server was on 192.168.0.1 and the webcam_port defined in motion set to 8001). |
||
18 | |||
19 | h3. VLC transcoding |
||
20 | |||
21 | To get vlc to transcode (headless), you simply run the vlc stream adding an sout command which will incorporate the transcode options as well as the multicast destination and port (Remember multicast is 'broadcast' on your network, so you must ensure your network adapter has MULTICAST enabled too). So for my example, to multicast my webcam I would use: |
||
22 | |||
23 | <pre> |
||
24 | cvlc -v http://192.168.0.1:8001 --sout "#transcode{vcodec=mp2v,vb=800,scale=1,acodec=none}:std{access=udp{ttl=1},mux=ts,dst=239.0.0.1:1234}" |
||
25 | </pre> |
||
26 | |||
27 | So this sends to multicast address (group) 239.0.0.1 on UDP port 1234. When you've ran this command you should get output from vlc showing it open the stream and begin the multicast. |
||
28 | Jump back to your testing machine and then run: |
||
29 | |||
30 | <pre> |
||
31 | vlc -vvv udp://239.0.0.1:1234 |
||
32 | </pre> |
||
33 | |||
34 | You should see your multicast stream. If so then you're multicasting! You can now add the stream into TV Headend. If you don't receive your stream, slowly increase the number of v's on the command line for your streamer (the cvlc above) or the client until you get enough debug to see the issue. Generally if your input stream drops frames or is slow to respond then you may have issues with the transcode (Dropped frames/slow replies are bad for multicast/transcoded streams). |
||
35 | |||
36 | h4. TV Headend |
||
37 | |||
38 | In TV Headend you need to add your stream, go to Configuration > IPTV and add a service, you should fill in the details based on your cvlc command, so as my example above you would enter: |
||
39 | |||
40 | <pre> |
||
41 | Enabled - ticked |
||
42 | Channel name - The name you wish to appear in your main channel line-ups |
||
43 | Interface - the ethernet interface you're multicasting on (Typically eth0 for most single-adapter machines) |
||
44 | Group - This is the multicast address, so 239.0.0.1 here |
||
45 | UDP Port - the port defined in your multicast, so 1234 here |
||
46 | </pre> |
||
47 | |||
48 | Save changes, and you should now see this channel in your channel line-up (Add a channel number) and tune into the channel, you should get your CCTV stream. |
||
49 | |||
50 | |||
51 | *NOTE* : There are various caveats within VLC to get this working which are outside the scope of this document, until you can get VLC streaming/multicasting then don't proceed! It may take trial and error to get this part right. |
||
52 | |||
53 | 2 | Andy Brown | - andyb2000 31/August/2012 |