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.8+ to do the transcoding. Knots consists of a server and client. 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 770/N8x0 or to any other computer, via the Knots' Web-frontend.
Non-tableteers can access the Knots Web-Frontend from any platform / 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 the server as a thumb friendly fronted for MPlayer. The client will scan your tablet for media files, and you can create & save custom playlists.
There is no server for Microsoft Windows so if you are running Windows, you might want to try Orb [1] or TVersity [2] instead.
Contents |
Features
- Fully thumb driven intuitive GUI for the Nokia 770 / N8x0 tablets
- Gesture support (for CPU frequency scaling (rootsh required), information and volume)
- Stream videos with on-the-fly transcoding to a Knots client or to a remote computer via the web-frontend. Seeking is supported when possible.
- Watch Live TV (DVB) with VLC directly or make Knots act as a VDR Streaming Client.
- Stream VDR Live-TV and recordings, browse the EPG & adjust VDR recording timers from the client
- Playlist support (WorldTV99, etc.)
- Automatic subtitle fetching for movies, provided by http://subtitlesource.org
- Automatic thumbnails for local clips using ffmpeg
- Integrated search function
- Thumb friendly MPlayer frontend with playlist editing (in offline mode) and gestures support
- Remote play feature for playing videos on the server and controlling it with the client (doesn't work on OS X yet)
- Additional info for movies, provided by http://themoviedb.org
Knots Server
Install
Knots Server can be installed on any *nix based OS like Gnu/Linux, BSD & OSX.
Ubuntu
This instructions are for Ubuntu Intrepid Ibex (8.10). Other Debian derivates might use slightly different package names, but the general concept of the install is the same for all distros.
- Enable the Multiverse & Universe software sources, and add the Medibuntu repository (for ffmpeg), reload your Package information and open a root terminal (sudo -s), to install the Ruby Dependencies:
apt-get install ruby1.8 ruby
- install unzip for automatic subtitle download feature
apt-get install unzip
- get vlc and a 'unrestricted' ffmpeg build
apt-get install vlc-nox vlc-data libvlccore0 libvlc2 ffmpeg
If you have Xorg running on your Knots-Server you can also install the packages "vlc" and "vlc-plugin-pulse" to get a GUI and PulseAudio Output (default Ubuntu 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 /opt wget http://nakkiboso.com/knots/dl.php?file=server tar xvzf knots_server.tar.gz chown -R youruser:yourgroup /opt/kserver
That's it! knots is installed under /opt/kserver. You still need to configure it though!
Mac OSX
OS X 10.5 (Leopard) comes with Ruby 1.8. Knots should also work on 10.4 (Tiger) if you install the latest Ruby from http://rubyosx.rubyforge.org. Download the latest VLC from http://videolan.org and install it to /Applications. Download and extract the Knots server to a directory of your choice. You should also install ffmpegX from http://www.ffmpegx.com to /Applications to enable the screenshots support. Then proceed to setup.
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 setup script will ask you various questions about your installation and has reasonable default settings. So if you are unsure, accept the suggested default.
- Server name : enter a custom name for your Knots server
- Select interface to bind to: choose the network interface Knots binds 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 directory where your local VDR Recordings are stored.
- Do you have the program MythTV installed?: Knots can list and view MythTV recordings if you supply the MySQL information.
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'
Advanced Server Configuration
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. 100 directory contents are kept in memory by default. You can force a rescan by using the search.
- vlc: This section configures VLC. You can customize the port_range used by VLC. Keep in mind that you need to forward those ports from your router (or firewall) to the Knots server if you want the Web-frontend to be remotely accessible.
- vdr: You can connect as many VDR's as you wish to Knots. All you need to do is to add another vdr2, vdr3 ... section to your config file 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 change log_level to 2 to generate much more debug output in the logfile.
- media: adjust the streamable Media Container Formats, and the full path to your ffmpeg installation
- transcoding: Knots ships with some transcoding presets (video dimensions, target bitrate, codecs), that should be optimal for your tablet (you can switch the preset on the fly from the client). If you want to use the Web-frontend remotely, you might want to set smaller dimensions in the Flash profile (see example configuration below)
- categories: this section lists your categories. Use those names in the 'cache' section above.
Example Configuration
~/.config/knots/config.yaml for Knots-Server 0.4.2 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
You can also make client specific categories. You can find your clients' ids from the log file after you have connected to the server:
[2009-01-11-15:02:08] Request: /scanner/scan?client_id=a5f225de12c2f4795cef627ae115afad&locale=fi_FI&dir=/ from 192.168.0.101:64940
You can see your client's id in bold above. After you know the id, edit your config like this:
categories: a5f225de12c2f4795cef627ae115afad: TV: - vdr1 Recordings: - /media/recordings/vdr Video: - /media/video default: Video: - /media/video
In above example your client would see the TV, Recordings and Video categories and others would only see the Video category.
Extras
- install Worldtv99
./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.
Shell scripts
Knots can run shell scripts on server. It's not really streaming related, but you can use it as a simple remote to start programs like X.org if you want to use the remote play feature. Just put your scripts to a directory, add it to some category and make sure the scripts have a .sh extension.
External programs
You can also define external programs to be run for certain filetypes. You can for example make Knots extract rar files or use Knots as a frontend to PyKaraoke. Adding this to your config would run PyKaraoke when .cdg file is selected:
external: cdg: python /usr/share/pykaraoke/pycdg.py -w 1920 -h 1080 --hide-mouse @FILE_SPACE_ESCAPED
If you want to terminate the process, just select the file again.
Knots Client
Install
Installing the knots client requires ruby & it's hildon bindings, so the initial installation of knots and it's dependencies takes ~ 3 MB to download and uses ~ 10 MB of space on the device.
'alterego' did a great job on the Ruby for Maemo packages and published a recent snapshot of his work at http://blog.rubyx.co.uk . Since his packages are currently not available in maemo's extras repository, knots can't enter extras either.
For now, you need to add an external repository to enjoy this great piece of rubyness.
one-click-install
Click on the link to install the Knots - Client on your tablet running OS2008 "diablo"
File:Install button.png http://nakkiboso.com/knots/knots.install
Manual Installation
Add Repository:
Catalogue Name: Knots Web address: http://nakkiboso.com/knots/ Distribution: diablo Components: /
Select knots from installable applications, and push the install button.
Or, if you prefer to install knots and its dependencies from a terminal, add the nakkiboso.com repository to your sources.list, and run as root:
apt-get install libhildon1-ruby1.8 libgconf2-ruby1.8 libconic-ruby1.8 ruby1.8 libosso-ruby1.8 libruby1.8 libxml2-ruby1.8 knots
To remove all knots & ruby related packages from your tablet, use apt-get remove with the package names given above
Mplayer for N810 Wimax Edition
Knots uses MPlayer's omapfb video output driver which doesn't work with the N810 Wimax Edition when using the current mplayer build distributed in maemo's extras repository. Until this bug gets fixed in extras, you can install a working MPlayer package with omapfb for the N810 Wimax from http://nakkiboso.com/knots/mplayer_1.0rc1-maemo.29.n8x0_armel.deb
File:Maemo Info icon.png You can use the default mplayer package for 770/N8x0! This bug affects the N810 Wimax Edition only
Client Settings
Menu Functions:- Server Scan: Automatically search and connect to a Knots server in the local LAN
- Manual Connection: Specify the IP and 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: Return to your categories menu
- Switch Transcoding Profile: Use the next predefined transcoding profile
- Switch Theme: Switch theme (no restart required)
- Remote Playback: Play a media file directly on the server
- Check for Updates: Searches for an update from the server and transfers and installs it if found
Client Preferences:
- Language: Set application language (no restart required)
- Language for Subtitles: Set Language for DVD subtitles. Also searches for subtitles from subtitlesource.org with this language
- Cache: Buffer in KB. 128 is a good starting point for a stable wlan
- Local Directories: Knots scans these directories for media in offline mode
- Join split Videos: Automatically join split videos (e.g. 001.vdr & 002.vdr)
- Show Screenshots: Generate random screenshots of your videos. Requires ffmpeg on server.
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.
You can also use Knots as a simple music player too. Just add the file extensions of your music files to the extensions list. Knots wasn't designed for this, but music works like videos, but only with audio.
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 inbulit 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 (Externremux.sh needed) 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.
VDR Streaming Client
Knots can be configured to act as a VDR Streaming Client. VDR is an excellent & widespread DVB PVR Software in the Linux world. If you have a VDR with streamdev-plugin running on the same PC as the knots server (or somewhere in your home LAN ) answer the VDR relevant questions in the setup Script. To configure multiple VDR's open the server's config.yaml and add a vdr2 stanza to the vdr category:
Example configuration for Knots Server connecting to multiple VDR's (VDR 1.6 runs with german charset iso-8859-1)
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 vdr2: timer_interval_before: 0 address: 192.168.1.101 streamdev_port: 3000 svdrp_port: 2001 disable_epg: false timer_interval_after: 0 charset: iso-8859-1 force_charset_conversion: false disable_streamdev: false
- timer interval_before: start timer x min earlier
- timer interval_after: stop timer x min later
- address: IP address of the VDR Server
- streamdev_port: Port used by Streamdev Plugin, as configured in the VDR OSD setup. (Default is 3000)
- svdrp_port: SVDRP is a simple transfer/ communications protocol used by vdr. (Default is 2001)
- charset: set your VDR charset (only VDR development version 1.7 supports UTF-8)
- force_charset_conversion: it seems VDR may still be using iso-8859-1 characters when using utf-8 (a bug?). Use this, if you get xml-parsing errors with utf-8.
- disable_epg: disable the Electronic Program Guide
- disable_streamdev: disable the Live-TV streaming part
The Knots Client enables you to browse the channels of your VDR, start live streaming, browse the EPG and set Recording Timers for VDR. Timer Management (enable, disable or delete Timers) and streaming of VDR Recordings to your Tablet make Knots a must-have for VDR users.
You can also record Live-TV in a 700/N8x0 native resolution, and have it transferred to the tablet automatically with knots. When browsing VDR channels, press the right cursor to add the selected channel to the transcoding list. Switch to the list with the left Cursor and push the play (start) button. You have to manually press the remove (minus) button to stop the recording, as the stream length is unknown. Knots will then transfer the encoded file to tablet.
The VDR Live-TV features (stream Channels & Recordings, browse EPG) can also be used from the Web Frontend. Knots will automatically use the Flash profile to transcode VDR streams to watch them inside the browser (Adobe Flash Plugin and VLC compiled with libmp3lame support needed). If you don't want / have the proprietary flash plugin, choose another transcoding profile from the dropdown box and knots will print out a URL that can be opened with e.g. mplayer on the client computer.
Movie Information
The Knots Client fetches additional Information for a selected Video from the open movie Archive http://themoviedb.org. The Service includes a movie poster, a short Plot Summary and a brief List of Actors, as well as user ratings. TheMovieDB is also used by other media Centers like XBMC, and has a continuously growing database. If your video is not available already, contribute by adding info about it to their wiki.To query TheMovieDB for a title, press the Information button. Knots will display the 'closest' result, similar to googles 'i'm feeling lucky'. You can also browse multiple results if the first was a false hit. To create a custom search query, press the Information button for 2 seconds, and enter your query. Knots tries to clean up the filename as much as possible, but it's impossible to do it perfectly. If the name of the video has several widely used words in it, themoviedb will return results for all movies that have those words in their names. In such case you can press the esc/back hardware key to cancel the list fetching and only display the results fetched before the cancellation.
Web Frontend
Point your desktop's browser to the Knots server address, followed by it's port: http://<yourip>:4212Check 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.
Knots will automatically use the bundled Flash-profile, if it's accessed via the Web-Frontend. You need a decent Browser, like Firefox and adobe's flash plugin installed, to use flash streaming. 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 flash profile in the Example Configuration causes a upstream of 60 k/s.
You can also select a different transcoding-profile in the Web-Frontend. Knots will print out a link to a Playlist that can be opened 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 plan to access the Web-Frontend from remote locations, it might be wise to 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.
- 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
NOTE: You can find the clients id's in the logfile (~/.config/knots/knots.log)
Firewall / Router Configuration
If you want to enable remote access to your knots Server, open & forward the ports 4212 - 4250 from your Router to the IP of the Knots Server. You can adjust the default port range for vlc in the server configuration file ~/.config/knots/config.yaml.
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 how to configure the default firewall shipped with ubuntu (ufw).
Update Knots
Server:
Open a terminal and change to the kserver direcory. Change the /opt/kserver path accordingly, if you installed the Knots-Server somewhere else.
cd /opt/kserver ./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.
Known issues
- Knots uses MPlayer's omapfb video output driver which doesn't work with the n810 Wimax Edition by default. Until this issue is fixed in extras, see Knots#Mplayer_for_N810_Wimax_Edition for a working MPlayer build.
Links
- Knots Homepage: http://nakkiboso.com/knots/
- Ruby for Maemo: http://blog.rubyx.co.uk/
- Mplayer for Maemo: http://mplayer.garage.maemo.org/
- VLC Media Player: http://www.videolan.org/vlc/
- Video Disk Recorder (VDR): http://www.cadsoft.de/vdr/
- VDR streamdev-plugin: http://streamdev.vdr-developer.org/
Contact
Come visit us at #knots at freenode