Knots

= 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 consits of a Server and Client part. The Server 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.

Non-Tableteers can access the Knots Web-Frontend from any Plattform / Location (including Windows). Firefox & Adobe's Flash Plugin 10 are suggested and work best. Knots will automatically transcode all streams to flv, so they can be watched directly in the Browser.

It is also possible to use the Knots-Client without a Server as a thumb - friendly fronted for mplayer. The Client will scan your tablet for media files, and you can create & save custom Playlists.

= Features =
 * Fully thumb driven intuitive GUI for the Nokia N700 / N8x0 Tablets
 * Gesture support (for CPU frequency scaling & volume)
 * Auto Transcode & Stream Videos to a Knots - Client or to a Remote Computer via the web-frontend.
 * Watch Live TV (DVB) with vlc or as a VDR Streaming Client
 * Watch VDR Recordings, browse VDR EPG & adjust VDR Recording Timers from the Client
 * Playlist Support (worldTV99, ect.)
 * Automatic Subtitle fetching for Movies
 * Automatic Thumbnail Generation using ffmpeg
 * Integrated Search Function
 * Thumb friendly mplayer frontend with playlist & gestures support (if Client is in Offline Mode)

= 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

apt-get install vlc-nox vlc-data libvlccore0 libvlc2 ffmpeg
 * get vlc and a 'unrestricted' ffmpeg build

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
./scripts/install_worldtv99 ./knots restart
 * install wordtv99

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
 * Live-TV (DVB) on Linux without VDR

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

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
 * Converting non-utf-8 filenames

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

Update Knots
Server: ./knots stop ./scripts/update ./knots start

Client:

Connect to your Knots-Server and select 'Check for updates' from the menu. Knots will transfer the updated Package to your tablet automatically and start the Application Manager to install it.

= Knots Client =

Ruby for Maemo OS2008
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 also including 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 right-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 (with a click on the left Cursor key) and hit the start button knots will automatically encode the video in the currently selected profile and transfer the file to your tablet. The save-location can be customized in the Client Preferences Window.

If you configured Knots to connect to a VDR, you can browse the Channellist (you also get the EPG), Stream Live-TV, watch your Recordings and add, activate, deactivate or delete Timers for VDR. This makes knots the most feature complete "streaming client" 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 ). Once switched to Offline Mode, the Knots - Client 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, with a long (2 sec) push on the play button while the desired Clip is selected. A short push will start to play the first entry in the Playlist.

The inbulid Playlist support in Offline Mode can also be used to load a VDR - streamdev channels.m3u Channel list to watch Live TV via VDR & mencoder if no Knots Server is available.

You can sort Playlist entries with the up / down buttons. A long push (2 seconds) puts the selected entry to the beginning / end of the Playlist, and a long push 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: http:// :4212

Check the the logfile (/home/yourusername/.config/knots/knots.log) or start the server with ./knots stick if you don't know them. It will print out the address & port on the first line.

It will open the video in the browser now if you use the bundled Flash-profile. (You need a recent adobe flash plugin installed, i have not tested gnash). You might want to reduce the Dimensions for the Flash Profile if you intend to Stream Video to Remote Computers accessing the web - frontend. The upstream of the flash profile in the Example Configuration causes a Upstream of 60 k/s.

You can also select a different transcoding-profile than flash. Knots will print out a link to a Playlist that you can open with your favorite video player on the remote Computer (e.g. mplayer with the "High" Profile). Encoding Profiles & the Language of the Web - Interface can be changed on the fly.

Authentication
If you pnlan to access the Web- Frontend from Remote Locations, you should secure your installation by enabling Remote-Authentication for Knots:

Edit the main Server configuration file ~/.config/knots/config.yaml and set 'auth_remote: true' in the server section.

./scripts/auth add username password ./scripts/auth delete username
 * To Add / Remove a user:

./scripts/auth add client_id ./scripts/auth delete client_id
 * Add a client to / Remove client from whitelist

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

Firewall / 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.

If you use a software firewall on your server (like ufw or iptables) you might also need to open the port-range from 4212 to 4250 for Knots. See UbuntuFirewall for more information

= Bugs & Requests =

ToDo