IT

Vlc transcoding and CPU usage / bandwidth.

I like watching TV at home, and since the ‘server’ runs Ubuntu (I guess even if it ran Windows), the software of choice to do the transcoding and streaming is VLC.

I also like to have the highest quality over a limited bandwidth, so below you’ll see a summary of CPU / bandwidth usage that I’ve noticed while altering various standard transcoding parameters.

Before the graphs, a short introduction to the setup:
a) Intel Core2Duo E8500, 2Gb of DD-RAM 800Mhz running on Ubuntu 10.04.
b) Of course, I was using the RemoteCAdm I’ve created which you can see here.
c) Having the streaming port opened did not sound like a good idea, so for a long time I was using putty to create ssh tunnels for the streaming. Even with public keys, it was always a pain to start the .bat file to have the ports forwared, etc.
Now I’ve switched to OpenVPN which does a perfect job 🙂 (I still need to investigate why, when resuming laptop from standby, it doesn’t reconnect, even if OpenVPN GUI says that I’m connected).

Anyway, the standard transcoding parameters that I was using were:

#transcode{venc=x264,vcodec=h264,vb=512,scale=1,fps=25,threads=1,acodec=mpga,
ab=96,channels=1,samplerate=22050}:std{access=http,mux=ts,dst=0.0.0.0:1234}

Changing only one at a time, the table below summarizes the impact on both CPU usage as well as bandwidth:

Results\Parameter scale=0.5 scale=1 threads=2 acodec=mp3
CPU Usage 40% 80% 160% 40%
Bandwidth 81Kb/s 81Kb/s 81Kb/s 81Kb/s

Bandwidth usage:

Conclusions:

a) Bandwidth is directly dependent on the vb parameter.
b) CPU usage is directly dependent on the scale and threads parameters. If you half any of the two, CPU usage drops in half. CPU usage is also not fixed, I put the average. Sometimes it sits at 35%, then it might jump to 48% for a bit, then to hoover at around 42% etc. I averaged it to 40%.
c) Tomato 1.27 running on my Router uses about 10kb/s when continually updating the Bandwidth reports in the browser. That’s why the screenshot shows 91kb/s on average. If I stop streaming, the bandwidth usage drops to 10kb/s while having the browser open to monitor the bandwidth.
d) hq parameter which stands for ‘high quality’ seems not to create any improvements (since the quality of the TV station (cable) is not crystal clear anyway).
e) OpenVPN CPU usage for VLC streaming is insignificant for 80kb/s stream. I did not even see it ‘up there’ while running top to check the CPU usage (sometimes appears as using 1% of CPU, but then disappears from the list).

Teaser on setup:

1 Comment

  1. jose andres

    decrease the screen-fps parameters reduce the cpu usage too

Leave a Reply