This article is part of a series. If you are having problems with stream with VLC, take a look here.
Over the last week or two, I have been tasked with setting up a DVB-T (Digital Terrestrial) streaming box to host the world cup games over the coming months. The only brief was to get it on everyone’s desktop (all running Windows) and without any cost or using any extra software. After looking at Windows Media Encoder (which doesn’t support dvb-t) I decided to go down the Ubuntu 10.04 route. Here is what I did:
=================Choose the Hardware=================
CPU and Network bandwidth are the main considerations when streaming a TV signal to multiple boxes. I was hoping to user a dual core/dual processor system with multiple load balanced network cards. That would have been given, if the only TV aerial wasn’t sat in the Directors office.
As it has to be quiet and out of the way, I ended up using a HP dc5600 with 5GB of RAM. The TV card was a USB Hauppauge Nova-T 70000.
=================Software Setup=================
After building the box, I installed the latest x64 Ubuntu 10.04 and updated it with the latest patches. I then had to install all codecs. To do this, I needed to add the mediabuntu software repo. This is done by:
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
Once added, install the following packages:
sudo apt-get --yes install app-install-data-medibuntu apport-hooks-medibuntu
You now need to install a number of packages to ensure ffmpeg is configured correctly. To do this from the command line, do:
sudo apt-get update
Then
sudo apt-get install libavcodec-extra-52 libavdevice-extra-52 libavfilter-extra-0 libavformat-extra-52 libavextra-util-49
=================DVB-Apps=================
Before I could use my DVB card, I needed to tune it in to my local transmitter. First, install dvb-apps:
sudo apt-get install dvb-apps
Once installed, you need to scan for your channels and output the frequencies to a file. To do this, you will need to find out your local transmitter. The digital switch over site is ideal for UK users. Enter your postcode and you will be told your transmitter. My local was Winterhill. Make sure you replace uk-WinterHill with your transmitter.
Scan by doing the following:
scan /usr/share/dvb/dvb-t/uk-WinterHill > ~/Desktop/Channels.conf
Once done, time to install the media streamer.
=================VLC=================
To do the streaming, I decided to use VLC player to stream the data. Install by:
sudo apt-get install vlc
Now you have it installed, time to test the TV player. Run VLC pointing to the configuration file created above:
vlc ~/Desktop/Channels.conf
All the channels will now be listed in your play list. Simply change channel by double clicking on the relevant entry.
=================Time to stream=================
Here comes the fun (and probably most frustrating part). This requires a fair bit of tweaking depending on your environment and requirements. You need to set the source, any transcoding and the output. As I needed to stream to over 200 machines, all running windows, I used this:
vlc -vvv ~/Desktop/Channels.conf --sout '#transcode{vcodec=DIV3,vb=2048,scale=0.25,acodec=mp3,ab=32,channels=2}:std{access=mmsh,mux=asfh,dst=:8080}'
This sets up a HTTP stream on port 8080, converts it into Divx and sets uses MP3 to encode the sound. The ‘scale=0.25′ shrinks the image to keep CPU and Memory in check when streaming.
=================More to come=================
I will add a couple more articles to this in the next few days that run through a number of troubleshooting and tweaking tips.
Many thanks for this. Also looking into precisely this issue although not to nearly as many clients
Will be following the guide later on today.
One of the codecs doesn’t seem to be valid;
libavextra-filter-0
Hi Cybrey,
Apologies for that, I had typed it in wrong, it should be:
libavfilter-extra-0
I will update the guide now.
I also ran some load tests today, and had some successful results, I will get them posted later this afternoon.
Thanks,
Paul
Thanks mate! I’m stuck on an old PC for a few weeks while I RMA my ram and now I can watch the world cup.
Is there anything VLC can’t do? I’m sure there is a SNES emulator in there if you know the right switch.
VLC is amazingly versitile. I have just finished the first football stream and needed to tweak slightly to increase quality. At one point, I had 110 users connected and CPU was at 50% + Mem at 1GB. At one point, the network connection shot up to 110Mb/s. We still had plently of bandwidth left.
In the end, I found the best command to run is:
[code]vlc -vvv bbc.conf --sout '#transcode{vcodec=DIV3,vb=2048,scale=0.75,acodec=mp3,ab=64,channels=2}:std{access=mmsh,mux=asfh,dst=:8080}'[/code]
Enjoy
Hi Paul,
i was going to ask, how are you changing channels, but now i see that you have spit out a bbc.conf the penny dropped.
Cheers,
Stu
Hi Stu,
I am in the process of writing a new article that ties it all together and makes a little more sense. But basically I have created a login script that asks what channel to stream and then calls the relevant .conf file. Each conf file is made up from the Channels.conf.
I will post a link when it’s done.
Thanks
Oh wow VLC has all these different filters for de-interlacing! Looks much better with the fast movement