ARD Mediathek offline viewing on Ubuntu

Since I am a bit of a sucker for German “Krimis” as well as some their excellent documentaries I like to watch ARD Mediathek IPTV. However there are several problems with this when you live at the opposite side of the world. ARD has a block for any films that are 15+ years outside of 20.00h-6.00h GMT+1. Which makes it pretty much impossible to watch at a reasonable time in Australia. I also like to watch these things on the plane which requires download of the media files.

Install JSON Parser

sudo apt-get install jq

Download script

wget https://github.com/leogaggl/media/raw/master/download_mediathek.sh
chmod +x download_mediathek.sh

Usage

./download_mediathek.sh -f save_as_filename.mp4 -q 3 MEDIATHEK-URL

The -f and -q parameters are optional.
-f filename.mp4 (or full path + filename to save in different directory). Defaults to original filename
-q quality setting from 0 to 3 (where 0 is lowest and 3 highest quality). Defaults to highest quality

Please leave a comment if you find any issues or log an issue on GitHub.

NOTE (2014-07-06): If you are only interested in the Tatort series I suggest you look at this script by Felix Knecht (see comment below)

Getting Foscam IP Cameras to work from Linux (Ubuntu)

As with most hardware manufacturers of hardware Foscam utility software is Windows or Mac only. The actual unit tested with the below is a FI9805E Outdoor POE camera.

Foscam Outdoor Cam

Installation

The installation is relatively painless as the unit is set up to get the IP assignment via DHCP (check your routers DHCP assignment list).

https://IP.ADDRESS.OF.CAM

should get you to the web-admin interface. The default user is ‘admin’ with no (empty) password.

Taking snapshots

http://IP.ADDRESS.OF.CAM:PORT/cgi-bin/CGIProxy.fcgi?cmd=snapPicture&usr=username&pwd=password

I had some issues with the color of the images in daylight (which for an outdoor camera is not really a good thing. A Firmware update (V2.14.1.5) improved this (you can disable the IR LEDs during daylight hours). Thanks for FOSCAM UK support via Twitter I found the download URL as the main site seems to have been down for a while.

Firmware URL: http://foscamuk.co.uk/downloads/

Streaming in H.264 video

The easiest way to get the stream appears to be the RTSP connection (using VLC or any network video player). MXPlayer on Android works very well too.

rtsp://username:password@IP.ADDRESS.OF.CAM:PORT/videoMain
rtsp://username:password@IP.ADDRESS.OF.CAM:PORT/videoSub
rtsp://username:password@IP.ADDRESS.OF.CAM:PORT/audio

Streaming in MPEG mode

The be able to use the MPEG streaming the stream format needs to be set first.

http://IP.ADDRESS.OF.CAM:PORT/cgi-bin/CGIProxy.fcgi?&usr=username&pwd=password&cmd=setSubStreamFormat&format=1
http://IP.ADDRESS.OF.CAM:PORT/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr=username&pwd=password

Resetting back to H264:

http://IP.ADDRESS.OF.CAM:PORT/cgi-bin/CGIProxy.fcgi?&usr=username&pwd=password&cmd=setSubStreamFormat&format=0

Next steps will be to make this work from a headless device with an Amazon S3 storage backend. This Github project https://github.com/phil-lavin/Foscam-FI8908W-Recorder is looking promising.

Watch this space.

Re-index media files on Synology NAS servers

One of the annoying things with Synology NAS servers is the fact that a video file moved to the filesystem does not automatically appear on the DNLA share on client devices. It needs a re-index of the media files.

You can log into the HTML Admin Console and start a re-index, however this will be a full re-index and most likely take ages to complete. A quicker way is to connect to the SSH Console and issue the following command:

synoindex -R video

This will only re-index video files. This can also be used for photos and other media types.

As per documentation here are the other command options.
synoindex -R {all|photo|music|video|thumb} )

Installing libdvdcss on Ubuntu 13.10

With the demise of the Medibuntu repository and libdvdcss not being hosted in the main Ubuntu repos due to licensing issues a new repository is needed from 13.10 upwards. Thanks to the good folks at VideoLAN (makers of the awsome VLC Video Player) there is a ready and updated source available.

wget ftp://ftp.videolan.org/pub/debian/videolan-apt.asc | sudo apt-key add -
echo "deb ftp://ftp.videolan.org/pub/debian/stable ./" | sudo tee /etc/apt/sources.list.d/libdvdcss.list
sudo apt-get update
sudo apt-get install libdvdcss2

Installing OMXPlayer on Raspberry Pi

Since I didn’t have any luck playing videos on the RPi using mplayer I found omxplayer after some search. It has the ability to use the RPi’s GPU thus taking some load of the CPU.


UPDATE 2013-04-01: omxplayer is now included in the Raspbian (Debian Wheezy) repositories and can be simply installed by one line.

sudo apt-get install omxplayer

Check another article on how to install Raspbian.


OMXPlayer binary (.deb) downloads can be found here: http://omxplayer.sconde.net/

Install dependencies

apt-get install libpcre3 fonts-freefont-ttf fbset libpcre3-dev libpcrecpp0 libva-dev libva-x11-1 libva1

Install omxplayer

wget http://omxplayer.sconde.net/builds/omxplayer_0.2.4~git20121205~ec7ac68f_armhf.deb
dpkg -i omxplayer_0.2.4~git20121205~ec7ac68f_armhf.deb

Play video

omxplayer -o hdmi video.mp4

Note: If there is no sound when playing through the HDMI interface make sure your /boot/config.txt file has the following line (and it’s not commented out).

hdmi_drive = 2

OMXPlayer Key bindings

Key Action
1 Increase Speed
2 Decrease Speed
j Previous Audio stream
k Next Audio stream
i Previous Chapter
o Next Chapter
n Previous Subtitle stream
m Next Subtitle stream
s Toggle subtitles
q Exit OMXPlayer
Space or p Pause/Resume
Decrease Volume
+ Increase Volume
Left Seek -30
Right Seek +30
Down Seek -600
Up Seek +600

Saving Video Streams in Ubuntu

Flash Media

rtmpdump

apt-get install rtmpdump
rtmpdump -r "rtmp://domain.tld/video_name.flv" -o video_name.flv

Docs: http://rtmpdump.mplayerhq.hu/rtmpdump.1.html

Windows Media

mimms

apt-get install mimms
mimms mms://domain.tld/video_name.wmv

Docs: http://manpages.ubuntu.com/manpages/precise/man1/mimms.1.html

mplayer

mplayer -dumpstream -dumpfile video_name.wmv mms://domain.tld/video_name.wmv

Installing VideoLAN VLC 2.0 on Ubuntu 11.10

With the release of the final VLC 2.0 player you need to add a back-port (the next version 12.04 will have it included in the main repositories) PPA to Oneiric Ocelot (11.10)

VideoLAN VLC 2.0

sudo add-apt-repository ppa:n-muench/vlc
sudo apt-get update
sudo apt-get install vlc

Thanks to Nate Muench for providing this !

Install Handbrake on Ubuntu

Note: this has been verified to work on 11.04 (Natty), 11.10 (Oneiric) & 12.04 (Precise)

To convert a DVD and make it viewable on your mobile device Handbrake seems to be the most useful tool I have discovered so far. Since it is not part of the default Ubuntu Repositories here is the installation process. The first step is to insure libdvdcss2 is installed

sudo apt-get install libdvdcss2
sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk