HTPC: FreeBSD for your TV

A solution to online TV freezes

by ross at 13:30:15 on November 9, 2012

The problem

OK, so you have 100Mbit at home and no packet loss but most of the channels play only for a minute or two then the picture starts to freeze.

If you open xbmc.log you will find audio/video decoding problems or even channels switching audio codecs on the fly. If so then you can solve this.

It's not magic, if you have high ping to streaming server or even packet loss then there's nothing you can do except for switching the Internet provider.

The solution

All you have to do is to switch from built-in player to standalone mplayer for watching rtmp streams.

You do this by creating file ~/.xbmc/userdata/playercorefactory.xml:

<playercorefactory>
<players>
   <player name="livestreamplayer" type="ExternalPlayer" audio="false" video="true">
     <filename>/usr/local/bin/live-stream-player</filename>
     <args>{1}</args>
     <hidexbmc>false</hidexbmc>
     <hideconsole>false</hideconsole>
     <warpcursor>none</warpcursor>
   </player>
</players>
<rules action="prepend">
   <rule protocols="rtmp" player="livestreamplayer" />
</rules>
</playercorefactory>

Now fetch the player (it's a simple wrapper for rtmpdump and mplayer):

# cd /usr/local/bin
# fetch http://daemon-notes.com/downloads/assets/scripts/live-stream-player
# chmod a+x live-stream-player

Install the mplayer itself (check VDPAU, uncheck GUI and SKINS):

# cd /usr/ports/multimedia/mplayer
# make install clean

rtmpdump is already installed as a dependency of xbmc.

Create mplayer config (~/.mplayer/config):

vo=vdpau,
volume=100

Note the comma at the end of vo line — it means use vdpau if available.

Create key bindings (~/.mplayer/input.conf):

MOUSE_BTN0 quit
MOUSE_BTN1 quit
MOUSE_BTN2 quit
MOUSE_BTN3 quit
MOUSE_BTN4 quit
MOUSE_BTN5 quit

As you can see pressing any mouse button will terminate the running mplayer and return you to xbmc.

That's it. Use LiveStreams addon as usual.

Comments