How to Stream Movies to your iPhone or iPad

I have just found a way to successfully stream movies (avi, mkv, mp4, etc) to my iPhone. It’s via an app called AirPlayer.

First, set up a media server on your home network (for example, PS3 Media Server, like what I have explained in my previous post, “How To Share Media Between PlayStation 3 and Linux”). Then, just access your movies through the AirPlayer app. Everything just works, without much setting or config changes.

How to Queue Torrents in Transmission

Currently there’s no queue features in Transmission. Luckily we can improvise this with the help of transmission-remote, a command based client for transmission, and along with some Linux bash scripting.

Below I have created a simple bash script:

1. Install transmission remote:
sudo apt-get install transmission-cli

2. Copy the script below, and save as my_script_name.sh , (or whatever name you prefer, but note the .sh extension).

#!/bin/sh
 
# *************
# Configuration
REMOTE="/usr/bin/transmission-remote"
USERNAME="my_username"
PASSWORD="my_password"
MAXDOWN="max_number_of_torrent_to_download"
MAXACTIVE="max_active_torrent"
CONFIG="/my_location_to_transmission_config_file/settings.json"
TRANSOPTS="127.0.0.1:my_port_number"
 
# *************
# Set-up variables
CMD="$REMOTE $TRANSOPTS --auth $USERNAME:$PASSWORD"
LOGCMD="/usr/bin/logger -t transmission-queue "
MAXRATIO=$(cat $CONFIG | grep \"ratio-limit\":)
MAXRATIO=${MAXRATIO#*\"ratio-limit\": }
MAXRATIO=${MAXRATIO%*, }
 
# *************
# deal with downloads
DOWNACTIVE="$($CMD -l | tail --lines=+2 | grep -v 100% | grep -v Sum | grep -v Stopped | grep -v Verifying | grep -v Will\ Verify | wc -l)"
if [ $MAXDOWN -lt $DOWNACTIVE ]; then
    DOWNTOSTOP="$($CMD -l | tail --lines=+2 | grep -v 100% | grep -v Sum | grep -v Stopped | grep -v Verifying | grep -v Will\ Verify | tail -n $(expr $DOWNACTIVE - $MAXDOWN) | awk '{ print $1; }')"
    for ID in $DOWNTOSTOP; do
        NAME="$($CMD --torrent $ID --info | grep Name:)"
        $LOGCMD "< << $ID: ${NAME#*Name: }"
        $CMD --torrent $ID --stop >> /dev/null 2>&1
    done
else
    [ $(expr $MAXDOWN - $DOWNACTIVE) -gt 0 ] && (
    DOWNINACTIVE="$($CMD -l | tail --lines=+2 | grep -v 100% | grep Stopped | wc -l)"
    [ $DOWNINACTIVE -gt 0 ] && (
        DOWNTOSTART="$($CMD -l | tail --lines=+2 | grep -v 100% | grep Stopped | head -n $(expr $MAXDOWN - $DOWNACTIVE) | awk '{ print $1; }')"
        for ID in $DOWNTOSTART; do
            NAME="$($CMD --torrent $ID --info | grep Name:)"
            $LOGCMD ">>> $ID: ${NAME#*Name: }"
            $CMD --torrent $ID --start >> /dev/null 2>&1
        done
        )
    )
fi
# Then deal with total active
ACTIVE="$($CMD -l | tail --lines=+2 | grep -v Sum | grep -v Stopped | grep -v Verifying | grep -v Will\ Verify | wc -l)"
if [ $MAXACTIVE -lt $ACTIVE ]; then
    TOSTOP="$($CMD -l | tail --lines=+2 | grep 100% | grep -v Stopped | grep -v Verifying | grep -v Will\ Verify | tail -n $(expr $ACTIVE - $MAXACTIVE) | awk '{ print $1; }')"
    for ID in $TOSTOP; do
        NAME="$($CMD --torrent $ID --info | grep Name:)"
        $LOGCMD "< << $ID: ${NAME#*Name: }"
        $CMD --torrent $ID --stop >> /dev/null 2>&1
    done
else
    [ $(expr $MAXACTIVE - $ACTIVE) -gt 0 ] && (
    SEEDINACTIVE="$($CMD -l | tail --lines=+2 | grep 100% | grep Stopped | awk -v ratio=$MAXRATIO '{ if (strtonum(substr($0,52,4)) < ratio) print $0 ;}' | wc -l)"
    [ $SEEDINACTIVE -gt 0 ] && (
        TOSTART="$($CMD -l | tail --lines=+2 | grep 100% | grep Stopped | awk -v ratio=$MAXRATIO '{ if (strtonum(substr($0,52,4)) < ratio) print $0 ;}' | head -n $(expr $MAXACTIVE - $ACTIVE) | awk '{ print $1; }')"
        for ID in $TOSTART; do
            NAME="$($CMD --torrent $ID --info | grep Name:)"
            $LOGCMD ">>> $ID: ${NAME#*Name: }"
            $CMD --torrent $ID --start >> /dev/null 2>&1
        done
        )
    )
fi

Save the script on any location you prefer.

3. Create a cron job to run the script. Open the entry to crontab:
crontab -e

4. Let say you want to run the script 5 minutes, the entry on your cron job should be as below:
*/5 * * * * sh /location_to_my_script/my_script_name.sh

Script courtesy of www.4geeksfromnet.com

How To Share Media Between PlayStation 3 and Linux

A while ago I have posted on How To Share Media Between XBOX 360 and Linux. It also can be as easy with PlayStation 3 and Linux, with PS3 Media Server. Below are the steps that diablo 2 items suggests which can let you achieve that.

Install necessary codex or media player:
sudo apt-get install vlc ffmpeg mencoder mplayer

Install Sun Java:
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

Download PS3 Media Server. Then extract the downloaded tar to any location:
tar xzf pms-generic-linux-unix-1.20.412.tgz

Go to the folder that you have just extracted:
cd pms-linux-1.20.412/

Run the PS3 Media Server simply by:
./PMS.sh
Command above will open the PlayStation 3 Media Server user interface.

Movie Subtitles on Ubuntu 10.10
The yesgamers is the d2 store points out that the subtitle broke for Ubuntu 10.10. This is due to Mplayer needs to know the location of a TrueType Font to show movie subtitles. Command below will fix it:
sudo apt-get install ttf-bitstream-vera

ln -sv /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf ~/.mplayer/subfont.ttf

Disable ASS/SSA subtitles:
1. Go to PS3 Media Server user interface. Go to “Transcoding Settings” tab.
2. Uncheck ASS/SSA subtitles checkbox.

Playing 1080p Video in Ubuntu Without Lag

I have not-so-bad specs for my laptop:
– Dell XPS M1530
– Intel Code 2 Duo CPU 2.40GHz
– 4GB RAM
– Running Ubuntu Karmic Koala 9.10

I have no problem running 720p .mkv HD video files. No lagging, no dropped frames whatsover. However, when running 1080p .mkv files, especially those big sizes full-HD Blue Ray medias, I have:
– Lagging,
– Dropped frames,
– 100% CPU utilizations.

It doesn’t matter if I’m using VLC, or Totem Movie Player, it will always have those problem above. From what I’ve read, this is probably due to FFMpeg codecs for H.264 decoding.

However, I have a solution, found from http://ubuntuforums.org/showthread.php?t=1037625

Below are the steps:
1. Install mplayer:
sudo apt-get install mplayer-nogui

2. Run your 1080p .mkv files with it:
mplayer -vo vdpau -vc ffh264vdpau /path/to/the/mkv/file

Now the HD movies playing in my Ubuntu laptop are smooth as it can be.
Try it out. Cheers.

How to Check for Open Ports in Ubuntu

There are various ways to view for open ports on your local Ubuntu/Linux machine. However, I particularly prefer two methods/command below, since it is simple, and without any third-party application.

Open your command prompt, and type:
netstat -an | grep "LISTEN "

Or, another method:
sudo netstat --tcp --udp --listening --program

It will list all ports that your machine are listening to. The latter method will even shows the program name associated to it.

Enjoy.