rip mms streams

If there’s something around with the mms protocol, you can simply dump it with mplayer:

mplayer mms://blabla.at/foobar.wmv -dumpstream -dumpfile foobar.wmv

extract subtitles from mkv

Appearantly, the Samsung LCD does not like mkv containers which contain subtitles as seperated track. But it can read .srt files, so let’s try to extract them 🙂

$ mkvmerge -i movie.x264.mkv
File 'movie.x264.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: subtitles (S_TEXT/UTF8)
Track ID 3: subtitles (S_TEXT/UTF8)
Track ID 4: audio (A_AC3)
$ mkvextract tracks movie.x264.mkv 2:sub1.srt 3:sub2.srt

And then name the .srt the same as .mkv

$ mv sub1.srt movie.x264.srt

It works 🙂

minidlna – listening ports for iptables

While installing minidlna onto a media server, using the dual band draft-n wireless nic it came up to iptables over there.
First thing is to adapt related state from eth0 to ra0, or everythin else will fail.

Afterwards make sure that you’ll open tcp/udp 8200 for minidlna’s listening port. And next to that make sure that udp 1900 is open too, otherwise UPnP clients will not discover the presence of the DLNA server.

draft n at 5ghz band on debian

My last post was about draft n dual band with normal channel (6) and frequency (2,437 Ghz) but for what it’s worth – dual band needs media being transported through the second frequency band (first one is for clients only, but the streaming box for the tv will be the other one).

On Debian Lenny, make sure you’ll have the latest kernel installed, then sort some prerequisites:

$ sudo apt-get install wireless-tools wpasupplicant

in order to use all wireless extensions. Then apply the same routine for ralink’s driver – change wpasupplicant support in os/linux/config.mk, type make and make install as root but then do not reboot yet.

# vim /etc/Wireless/RT2860STA/RT2860STA.dat

and change channel to 36 (5.18 Ghz)

Channel=36

Afterwards, same procedure as usual – define the ra0 interface.

# vim /etc/network/interfaces
auto ra0
iface ra0 inet dhcp
        wpa-psk fjskjfsjfskl
        wpa-ssid öfsdkföjsdkdf

Reboot and then check with ifconfig. If it did not work out, try the following steps.

If you are not sure about the frequency and channel, scan for it (therefore we needed wireless-tools):

# iwlist ra0 scan
ra0       Scan completed :
          Cell 01 - Address: XX:XX:XX:XX:XX:XX
                    Protocol:802.11a/n
                    ESSID:"xxxxxx"
                    Mode:Managed
                    Frequency:5.18 GHz (Channel 36)
                    Quality:100/100  Signal level:-49 dBm  Noise level:-92 dBm
                    Encryption key:on
                    Bit Rates:300 Mb/s

Check back in your RT2860STA.dat if it’s correct and if not change and reboot then.

To check on your actual frequency, do this:

# iwconfig ra0
ra0       Ralink STA  ESSID:"xxxxxxx"  Nickname:"RT2860STA"
          Mode:Managed  Frequency=5.18 GHz  Access Point: XX:XX:XX:XX:XX:XX
          Bit Rate=270 Mb/s
          RTS thr:off   Fragment thr:off
          Encryption key:xxxxxxxx
          Link Quality=100/100  Signal level:-50 dBm  Noise level:-43 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

That’s all – traffic between the 2 frequency bands is routed through the draft-n wireless router and our wireless cloud is ready to work 🙂

linksys wireless-n dual band working driver on debian

Finally I got the rt2860 driver working with draft-n and dual band. The original kernel module coming through firmware-ralink in debian sid is ralink 2.2.0.0 (rather current than ubuntu which ships 1.8.0.0) but it has debugging output enabled which throws a message every second into the syslog. Furthermore the driver only supports 54 MBit/s out-of-the-box. But why bying drat-n and dualb band then? Yep right, I needed to search for other solutions.

One of them was to just create /etc/Wireless/RT2860STA/RT2860STA.dat with the file from the ralink rt2860 source. Well, tried that but the debianized staging driver did not recognize it. The things mentioned in debian wiki to just set desired rate values through iwconfig also did not work – iwconfig from wireless-tools simply does not have the privileges adding ioctl to the driver.

But iwlist wlan0 scan always showed that there is my draft-n dual band wlan router available. So, another solution was needed. Reading the ubuntu wiki just collects on what to do when installing the driver source from ralink against the actual kernel. The only problem stays there – after booting into a new kernel the wireless driver module needs to be compiled and installed too.

But in fact it’s the most suitable solution right now, because no more syslog debug spam and more wireless rates 🙂

Here we go:

Download the actual source for rt2860 – 2.3.0.0 currently. Copy the tar.bz to /usr/src and then

$ tar xvjf 2010_01_29_RT2860_Linux_STA_v2.3.0.0.tar.bz2
$ cd 2010_01_29_RT2860_Linux_STA_v2.3.0.0
$ vim os/linux/config.mk

Change the 2 wpa supplicant entries to ‘y’

$ sudo make
$ sudo make install

This will install the kernel module and also the RT2860STA.dat with the right settings.

Next step – wlan0 changes into ra0, so fire up vim again.

$ sudo vim /etc/network/interfaces

Then reboot the system. ra0 will go up and now has full speed enabled – the debug stuff remains, but this comes through the firmware then.

Check the speed with

$ sudo iwconfig ar0
$ sudo iwlist ar0 scan

And just to remember the steps after booting into a new kernel:

Linux phoenix 2.6.33-2.slh.5-sidux-686 #1 SMP PREEMPT Sat Apr 10 23:29:25 UTC 2010 i686 GNU/Linux
ifdown ra0; cd /usr/src/2010_01_29_RT2860_Linux_STA_v2.3.0.0; make; make install; ifup ra0

minidlna automatic startup

Within the CVS repository of minidlna, there’s an init script found within linux/ – which can be easily applied getting minidlna started at boot time.

# vim /etc/init.d/minidlna

The init script is modified regarding LSB headers required on Debian for automatic startup levels etc.

#!/bin/sh

# chkconfig: 345 99 10
# description: Startup/shutdown script for MiniDLNA daemon
### BEGIN INIT INFO
# Provides: minidlna
# Required-Start:
# Required-Stop:
# Default-Start:  3 4 5
# Default-Stop: 0 1 6
# Short-Description: start/stop MiniDLNA daemon
# Description: Startup/shutdown script for MiniDLNA daemon
### END INIT INFO
#
# $Id: minidlna.init.d.script,v 1.2 2009/07/02 00:33:15 jmaggard Exp $
# MiniUPnP project
# author: Thomas Bernard
# website: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/

MINIDLNA=/usr/sbin/minidlna
ARGS='-f /etc/minidlna.conf'

test -f $MINIDLNA || exit 0

. /lib/lsb/init-functions

case "$1" in
start)  log_daemon_msg "Starting minidlna" "minidlna"
        start-stop-daemon --start --quiet --pidfile /var/run/minidlna.pid --startas $MINIDLNA -- $ARGS $LSBNAMES
        log_end_msg $?
        ;;
stop)   log_daemon_msg "Stopping minidlna" "minidlna"
        start-stop-daemon --stop --quiet --pidfile /var/run/minidlna.pid
        log_end_msg $?
        ;;
restart|reload|force-reload)
        log_daemon_msg "Restarting minidlna" "minidlna"
        start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/minidlna.pid
        start-stop-daemon --start --quiet --pidfile /var/run/minidlna.pid --startas $MINIDLNA -- $ARGS $LSBNAMES
        log_end_msg $?
        ;;
*)      log_action_msg "Usage: /etc/init.d/minidlna {start|stop|restart|reload|force-reload}"
        exit 2
        ;;
esac
exit 0

Make it executable and add to automatic startup (ignore the warning).

# chmod +x /etc/init.d/minidlna
# update-rc.d minidlna defaults

You can also start|stop|restart minidlna this way 🙂

# /etc/init.d/minidlna
Usage: /etc/init.d/minidlna {start|stop|restart|reload|force-reload}.