Knots

Contents

About Knots

Knots is a feature rich GPLv2 Video Streaming Application for Linux, FreeBSD and OS X by Janne Mäkinen. It's written in ruby and uses vlc 0.9.6+ to do the transcoding. Knots can be configured to stream Video Files (any format/codec supported by vlc), DVB-Broadcasts, Custom Playlists or any other media to a Knots-Client on a N700/N8x0 or to any other computer, via the Knots Web-Frontend.

Features

  • Auto Transcode & Stream Videos to a Knots - Client or to the web-frontend.
  • watch Live TV (DVB) with vlc or VDR (incl. EPG & Timer Management)
  • Playlist Support (worldTV99, ect.)
  • Automatic Subtitle fetching for Movies
  • Automatic Thumbnail Generation
  • integrated Search Function


Knots Server

Install

Knots Server can be installed on any *nix based OS like Gnu/Linux, BSD & OSX.

Ubuntu

  • Enable the Multiverse & Universe software sources, and open a root terminal (sudo -s), to install the Ruby Dependencies

NOTE: This are my currently installed ruby1.8 packages, please remove unneeded packages if they are not required for knots

apt-get install libactiveldap-ruby1.8 libactivesupport-ruby1.8 libalgorithm-diff-ruby1.8 libao-ruby1.8 libart2-ruby1.8 libatk1-ruby1.8 libbreakpoint-ruby1.8 libbsearch-ruby1.8 libbuilder-ruby1.8 libbz2-ruby1.8 libcairo-ruby1.8 libcgikit-ruby1.8 libcmd-ruby1.8 libcmdparse2-ruby1.8 libdaemons-ruby1.8 libdbm-ruby1.8 libgconf2-ruby1.8 libgdbm-ruby1.8 libgdk-pixbuf2-ruby1.8 libgettext-ruby1.8 libglade2-ruby1.8 libglib2-ruby1.8 libgnome2-ruby1.8 libgnomecanvas2-ruby1.8 libgtk2-ruby1.8 libldap-ruby1.8 liblog4r-ruby1.8 libmmap-ruby1.8 libmocha-ruby1.8 libncurses-ruby1.8 libopenssl-ruby1.8 libpango1-ruby1.8 libreadline-ruby1.8 libredcloth-ruby1.8 libruby1.8 libruby1.8-extras libsqlite3-ruby1.8 libtcltk-ruby1.8 libuconv-ruby1.8 libxml-parser-ruby1.8 
  • get vlc and a 'unrestricted' ffmpeg build
apt-get install vlc-nox vlc-data libvlccore0 libvlc2 ffmpeg

If you have X on your Knots-Server you can also install the packages "vlc" and "vlc-plugin-pulse" to get a GUI and PulseAudio Output (default ubunu Sound Server) for the vlc Player.

now install these unrestricted ffmpeg libaries (they will remove the restricted builds, if installed)

apt-get install libavcodec-unstripped-51 libavdevice-unstripped-52 libavformat-unstripped-52 libavutil-unstripped-49 libpostproc-unstripped-51 libswscale-unstripped-0 
  • download and install Knots - Server

Still in the root terminal change to the directory where you want to keep the Server Files (in this example I use /opt/kserver , change the path accordingly) and download & extract Knots - Server :

cd ~/work
wget http://nakkiboso.com/knots/dl.php?file=server 
tar xvzf knots_server.tar.gz

That's it! knots is installed under /opt/kserver. Go to First Run now to configure it.

Mac OSX

ToDo see http://nakkiboso.com/knots/doc.php

First run

Knots-Server keeps its config at the folder ~/.config/knots . It is located under the home directory of the user who runs the following setup script, so do NOT run ./scripts/setup from a root terminal !

su yourusername
cd /opt/kserver
./scripts/setup

The Script will ask you various questions about your installation and has reasonable default settings. So if you are not sure, accept the default settings.

  • Server name : Enter a custom Name for your Knots Server
  • Select interface to bind to: choose on which network interface Knots to bind to
  • Is all your media under one directory? : if you keep all you video files under one Directory answer yes here.
  • Full path to your media files: Full path to your video archive (e.g. /media/video)
  • Do you have the program Video Disk Recorder (VDR) with streamdev-plugin installed? : Knots can interact nicely with VDR. If you have a VDR running somewhere on your local home network, or on the same computer as knots, answer yes here . The next VDR specific Questions are about the used VDR OSD & File System Charset (different from UTF-8 in VDR releases < 1.7) and you can also supply a Folder where your local VDR Recordings are stored.


You can accept the default values for any other Questions asked by the setup script.

After the script has gathered the necessary info it shows you the location of the generated config.yaml file:

Configuration saved to /home/yourusername/.config/knots/config.yaml.
You can edit this file with a text editor for more advanced settings.
You can now start the server with './knots start'

config.yaml

If you want to customize your configuration File, open it in a text editor. The full path to the configuration file was printed to the terminal when you ran './scripts/setup'

Configuration Options

  • cache: You can enable cache for one (or more) of your categories. Keep in mind that it's not wise to Cache the "Latest Videos" or VDR categories.
  • vlc: This section configures vlc. You can customize the port_range for vlc to your Network. Keep in mind that you need to forward those ports by your router (or Firewall) to the Knots-Server if you want the Web-Frontend to be remote accessible.
  • vdr: You can connect as many VDR's as you wish to knots. All you need to create is another vdr2, vdr3 ... Configuration and adjust the IP - addresses, streamdev_ports & svdrp_ports to fit your configuration.
  • server: you can configure some general Server settings in this section. If you need more verbose logging, you can add 'log_level: 2' (without the quotes) to this section, to generate much more debug output in the logfile.
  • media: adjust the stream able Media Container Formats, and the full patch to your ffmpeg installation
  • transcoding: Knots ships some transcoding presets (Video Dimensions, target Bitrate, Codec) , that should be optimal for your Tablet (you can change to another Preset on the fly from the Knots-Client running on your Tablet). If you want to use the Web-Frontend remote, you might want to set smaller Dimensions in the flash profile (see example Configuration below)
  • categories: This Section lists your Categories. Use this names for the 'cache' settings

Example Configuration

for Knots-Server 0.4.1 with local VDR 1.6.0 (VDR using german charset ISO-8859-1):

--- 
cache: 
 - Video
 - Recordings
vlc: 
 startup_wait: 5
 tmpdir: /var/tmp
 remote_play_options: 
   freetype-effect: 2
   vout: xvideo
   freetype-fontsize: 12
   volume: 100
   fullscreen: ""
 path: /usr/bin/vlc
 resume_rollback: 5
 port_range: 4214-4244
vdr: 
 vdr1: 
   timer_interval_before: 0
   address: 192.168.1.100
   streamdev_port: 3000
   svdrp_port: 2001
   disable_epg: false
   timer_interval_after: 0
   charset: iso-8859-1
   force_charset_conversion: false
   disable_streamdev: false
server: 
 log_level: 2
 name: panta-rhei
 remote_auth: false
 port: 4212
 os: linux
 ip: 192.168.1.100
 bind: eth0
 vdr_charset: iso-8859-1
 service_discovery: 4212
 force_update: false
 auth_timeout: 60
 local_auth: false
 log_append: false
media: 
 extensions: avi,mpg,mpeg,wmv,vdr,img,iso,mkv,vob,flv,mov,nuv,sh
 ffmpeg_path: /usr/bin/ffmpeg
 subtitles: sub,srt
 avfs_extensions: tgz,gz,bz2,zip,rar,arj,uha,lha
transcoding: 
 N800: 
   audio_format: mpga
   resolution: 400x240
   audio_channels: 2
   audio_bitrate: 128
   video_bitrate: 900
   video_format: xvid
 High: 
   audio_format: mp3
   resolution: 608x256
   audio_channels: 2
   audio_bitrate: 128
   video_bitrate: 900
   video_format: xvid
 Flash: 
   stream_extension: flv
   audio_format: mp3
   resolution: 400x300
   audio_rate: 44100
   audio_channels: 2
   audio_bitrate: 128
   video_bitrate: 1000
   mux: ffmpeg{mux=flv}
   video_format: FLV1
categories: 
 TV: 
 - vdr1
 Recordings: 
 - /media/recordings/vdr
 Video: 
 - /media/video

Extras

  • install wordtv99
./scripts/install_worldtv99
./knots restart 
  • Live-TV (DVB) on Linux without VDR

Scan your channels with dvb-scan using the vdr-format and then create an xml-playlist from it.

(dvb-)scan -o vdr /usr/share/doc/dvb-utils/examples/scan/dvb-t/your_city > /tmp/channels.conf ./scripts/create_dvb_playlist /tmp/channels.conf
./knots restart

You may need to edit ~/.config/knots/dvb.xml to make it work with your dvb-card.

  • Converting non-utf-8 filenames

If you for example have german umlauts that are iso-8859-1 in your filenames, libxml fails to parse them. You can convert them to utf-8 easily (but use at your own risk):

./scripts/fix_filenames
  • Sound in Flash-video

Flash-video (flv) requires mp3 -support. Make sure your ffmpeg is compiled with libmp3lame-support.


Update Knots

Server:

./knots stop
./scripts/update
./knots start

Client:

Connect to server and select 'Check for updates' from the menu

Knots Client

Install

Ruby for Maemo

Add Repository:

Catalogue Name: Ruby1.8 for Maemo
Web address: http://stage.rubyx.co.uk/maemo/
Distribution: diablo
Components: user

Open a terminal & change to root:

apt-get install libhildon1-ruby1.8 libgconf2-ruby1.8 libconic-ruby1.8 ruby1.8 libosso-ruby1.8
wget http://stage.rubyx.co.uk/projects/ruby-maemo/packages/maemo4/armel/libxml2-ruby1.8_0.9.7-0maemo1_armel.deb
dpkg -i libxml2-ruby1.8_0.9.7-0maemo1_armel.deb

Knots Client

Open a terminal & change to root:

wget http://nakkiboso.com/knots/dl.php?file=client
dpkg -i knots_*.deb

Client Settings

Menu Functions:

  • Server Scan: Automatically search and connect to a knots Server in the local LAN
  • Manual Connection: Specify the IP & Port of a Knots Server manually
  • Offline Mode: Disconnect from a Knots Server, and Display local Media Files
  • Preferences: see below
  • Refresh: Reload current Directory or Refresh list of local files
  • Go to Root: Retun to the Start - Folder
  • Switch Transcoding Profile: Use the next predefined Transcoding profile
  • Switch Theme: Switch Knots theme (no restart required)
  • Remote Playback: Play a media File directly on the Server
  • Check for Updates: Searches for available updates & installs if found.

Client Preferences:

  • Language: Set Application Language
  • Language for Subtitles: Set Language for Subtitles
  • Cache: Buffer in KB. 128 is a good starting point for a stable wlan
  • Local Directories: Knots scans these directories for Media when switched to Offline Mode.
  • Join split Videos: Automatically join split videos (e.g. 001.vdr & 002.vdr)
  • Show Screenshots: generate random Screenshots of Videos

Usage

The Knots Client is designed to be totally thumb controlled, and is including also gesture-support. Most of it's functions are very intuitive to use and self - explaining. The Start Screen gives an Overview of you defined Categories and has an entry to show unfinished Videos as well as the 10 latest additions to the Server.

If you want to watch a video on the way, you can left-click on any video file in your Archive and Knots will put the file on a "Transcoding List". If you change to this transcoding list and hit the start button knots will encode the video in the pre-defined profile and transfer the file to your tablet.

If you configured Knots to connect to a VDR, you can browse the Channellist (you also get the EPG), Stream Live-TV or manage Recording Timers for VDR.

ToDo much more usage tips :)

Offline Mode

In Offline Mode, the Knots Client is a thumb friendly mplayer frontend (with gestures support to change the volume, seek,ect ), that will automatically scan your tablet for media files, and display them in the GUI. You can add them to a playlist, or start playing them directly

Playlist support in offline mode can be used to load a VDR - streamdev channels.m3u Channel list to watch Live TV via VDR if no Knots Server is available.

You can sort playlist entries with the up / down buttons. A long click (2 seconds) pushes the selected entry to the beginning / end of the playlist. A long Click on the play button will start the selected entry directly.


Web Frontend

Point your desktop's browser to the Knots server address, followed by it's port. If you don't know what it is, check the the logfile or start the server with

./knots stick

It will print out the address on the first line. If you use the bundled Flash-profile, it will try to open the video in the browser. If you select a different transcoding-profile, it prints out a link to a playlist. You can then open this playlist with your favorite video player.

Authentication

To secure your installation, enable Remote-Authentication for Knots:

Edit ~/.config/knots/config.yaml and set 'auth_remote: true'

  • To Add / Remove a user:
./scripts/auth add username password
./scripts/auth delete username
  • Add a client to / Remove client from whitelist

./scripts/auth add client_id ./scripts/auth delete client_id

You can find your clients id from the logfile (~/.config/knots/knots.log)

Router Configuration

If you want Remote Access to your knots Server, you need to open & forward the ports 4212 - 4250 from your Router to the IP of your Knots Server.

Bugs & Requests

ToDo