Posts Tagged ‘linux’
Okay, this guide will take you through ripping the contents of a regular DVD movie to an xvid-encoded avi file step by step using Linux command line tools only. I’ll concentrate on Ubuntu and Fedora but it should be easy on other distros too. Before we start, this article hinges on the use of libdvdcss. Depending on your country and Linux distribution, this may be easy or difficult. Google your distro name and “libdvdcss” if you can’t get hold of it.
For Fedora, you’ll need to get the libdvdcss package from a different repo than the standard ones. Add it with: -
rpm -Uvh http://rpm.livna.org/livna-release.rpm
yum install libdvdcss
If that doesn’t work, you can download the RPM file directly here. You can install the RPM manually with: -
rpm -ivh libdvdcss2-1.2.9-1.i386.rpm
For Ubuntu, you can install the libdvdcss package with: -
sudo apt-get install libdvdread4 && sudo /usr/share/doc/libdvdread4/install-css.sh
You’ll need some other tools too. Under Ubuntu, install with: -
sudo apt-get install vobcopy ffmpeg libxvidcore4 lame
Under Fedora, this is slightly different with: -
yum install vbocopy ffmpeg xvidcore lame
Next, create a mount point directory for your DVD files. I’m using /mnt/dvdrom but you can choose anything, anywhere although if you’re not root (as in Ubuntu), you might need to prefixing “sudo” to this.
mkdir /mnt/dvdrom
After you’ve done this, insert the DVD movie you want to burn and mount the DVD-ROM drive. For this example, I’m using the DVD of David Carradine’s 1976 classic “Carquake” also known as “Cannonball”. Man, I love me some of those old muscle cars. Anyway, I digress – but choose a DVD you want to backup :-)
Depending on your distribution, this may be one of the following devices under /dev. On modern distributions this is usually /dev/sr0, so the following will work.
mount /dev/sr0 /mnt/dvdrom
Again, under Ubuntu you might need to use “sudo” for this. Some older Linux distros have /dev/cdrom or a symlink from /dev/cdrom to /dev/sr0. It may even be auto-mounted under /media.
Anyway, one way or another you have your DVD mounted under /mnt/dvdrom. Now you need to use “vobcopy” to copy the VOB chapter files. Create a directory to hold these files. Make sure it’s on a partition with at least 10GB on it as this process can be heavy on file space. I’m using “/home/myuser/tmp” for this. Make sure you’re inside the directory. I’m using /home/myuser/tmp so the following will work: -
cd ~/tmp
Once you’re inside your chosen work directory, run the following command assuming your DVD movie is mounted on /mnt/dvdrom.
vobcopy -m -i /mnt/dvdrom -F 5 -v
This will mirror (-m) the contents of the DVD to your current directory from your chosen mount point. This process can take a long time. So go do something else for a while and come back. Also if you’re worried about your session dying or you want to push this process to the background, you can use: -
nohup vobcopy -m -i /mnt/dvdrom -F 5 -v > output.txt &
…which will to the same thing in the background but write it’s output to output.txt. Check the date/time on the last modifed column with a “ls -lah” on that directory or do a “ps -elf | grep vobcopy” to see if it’s still running. You can check the progress of the output with “tail -f output.txt” to see the percentage done updated in real time.
Once this is done, change to the new subdirectory VIDEO_TS – this is the directory structure of the DVD. If you do an “ls -lah” on that directory, you’ll see the VOB files listed. Mine for the rip of “Carquake” looks like this: -
total 1.2G
drwxr-xr-x 2 root root 4.0K Mar 25 02:11 .
drwxr-xr-x 3 root root 4.0K Mar 23 20:03 ..
-rw-r--r-- 1 root root 12K Mar 23 20:03 VIDEO_TS.BUP
-rw-r--r-- 1 root root 12K Mar 23 20:03 VIDEO_TS.IFO
-rw-r--r-- 1 root root 14K Mar 23 20:03 VIDEO_TS.VOB
-rw-r--r-- 1 root root 50K Mar 23 20:03 VTS_01_0.BUP
-rw-r--r-- 1 root root 50K Mar 23 20:03 VTS_01_0.IFO
-rw-r--r-- 1 root root 4.0K Mar 23 20:03 VTS_01_0.VOB
-rw-r--r-- 1 root root 283M Mar 24 03:29 VTS_01_1.VOB
-rw-r--r-- 1 root root 314M Mar 24 10:24 VTS_01_2.VOB
-rw-r--r-- 1 root root 252M Mar 24 17:45 VTS_01_3.VOB
-rw-r--r-- 1 root root 287M Mar 25 00:52 VTS_01_4.VOB
-rw-r--r-- 1 root root 64M Mar 25 02:11 VTS_01_5.VOB
Looking at this, we can surmise that the film itself is probably on the files VTS_01_1.VOB – VTS_01_5.VOB. So the next thing you’ll want to do is to convert these multiple VOB files into one. This is easily done with: -
ffmpeg -i concat:"VTS_01_1.VOB|VTS_01_2.VOB|VTS_01_3.VOB|VTS_01_4.VOB|VTS_01_5.VOB" -c copy concat.vob
This will give you one file called CONCAT.VOB. Now we need to convert the VOB file to our Xvid AVI file. Do this with: -
ffmpeg -i concat.vob -f avi -vcodec libxvid -acodec libmp3lame -qscale 3 output.avi
This should give you a file called “output.avi” which has xvid video encoding and mp3 audio encoding. Consider your DVD ripped :-)
Update 28/03/2013: If you have a DVD with dual audio, for example English and Japanese or something, you can choose to extract one for the audio in your xvid avi. Check out the -map switch to ffmpeg here. Using the -map option, you can choose to extract one of the specific audio tracks to embed in the xvid avi file.
As in my previous post, this uses ffmpeg to convert MKV container video files to standard xvid video/mp3 audio. As before, make sure you have all the required packages under Ubuntu to convert the video – let’s call it my-video.mkv this time.
sudo apt-get install ffmpeg lame x264 libxvidcore4
Once that’s done, the command to do a perfect conversion (no loss of quality) is: -
ffmpeg -i my-video.mkv -f avi -c:v libxvid -b:v 4000k -c:a libmp3lame -b:a 320k my-video.avi
This concludes my little duology of video format conversions :-) All hail Xvid!
Most video on the Internet used to be encoded as xvid video. Nowadays, with HD television and new standards of encoding and compression, most video files you find on the Internet are now encoded as x264. Problem is, my media server streams to my Xbox, which not only doesn’t do on-the-fly transcoding but doesn’t recognise x264 MP4 files as valid for the Xbox internal video player. Also, some stuff just isn’t available on xvid anymore so you’ve got x264 encoded video or nothing.
I’ve been trying to find the magic bullet of parameters that would allow me to convert x264 video to xvid using ffmpeg and Linux and I’ve finally got a command that appears to do the trick.
First, make sure you have all the required packages under Ubuntu to convert the video – let’s call it my-video.mp4.
sudo apt-get install ffmpeg lame x264 libxvidcore4
Once that’s done, the command to do a perfect conversion is: -
ffmpeg -i my-video.mp4 -vcodec libxvid -sameq -acodec libmp3lame -ab 128k -ac 2 my-video.avi
That’s it – short and sweet but I’ve found it very useful :-)
Note: If you want to do the same thing on Fedora the packages you need to install are the same aside from the xvid package which is xvidcore rather than libxvidcore4.
Popular Unity3D powered simulation game, Kerbal Space Program gets a Linux port with the latest release, 0.19. Since Unity3D (not to be confused with Unity, Canonical’s desktop manager for Ubuntu) got a Linux export option back with version 4.0, it’s only been a matter of time until developers released Linux versions for their Unity3D powered software.
Kerbal Space Program is a space simulation game where you have to help the cute little inhabitants of Kerbin get into space. Currently, there are no fixed objectives as the game is going the Minecraft route of releasing beta software with continuous updates for paying customers.
It’s very much like Microsoft’s Space Simulator program from the early nineties with added construction of your own spaceships, rovers, space stations and landers. New features are being added all the time and if you ever wanted to know about thrust to weight ratios or orbital dynamics in order to help your little Kerbals into space, head on over to the official site to try the demo or to buy your copy (around £15 in the UK). Windows, Mac and Ubuntu Linux officially supported but it shouldn’t take much to run on other Linux distributions. If you want to know more there is an active subreddit for KSP or you can check out the wiki.
The official site is getting hit hard right now as returning and new users all try to download/buy the update at once so be patient if you can’t get in immediately :-)
Happy launching, Linux users!
With the sad (and annoying) news that Google Reader is to be shut down on July 1st 2013, I had the dismal job of finding a replacement. Then I thought, why not just host my own RSS aggregator service? At least that way, I’m not at the whims of some corporation shutting down the services I use. So here, I’m going to show you how to set up tt-rss using Fedora Linux, Apache MySQL and PHP. This will allow you to import your Google Reader data into tt-rss’s MySQL database and display as a web application on your web server. There’s even an Android app to go with your installation to replace the Google Reader app. Hooray!
Okay, so I’m going to be using Apache, MySQL and PHP under Fedora Linux for this. If you already have Apache, MySQL and PHP installed, skip to the next section. If not, keep reading.
I’ll assume you’re on your Fedora Linux box as the root user for this. To install a basic Apache web server under Fedora with PHP and the libraries tt-rss will need, run the following: -
yum install apache mysql mysql-client php php-xml
Once all that is installed, start up your Apache installation with: -
service httpd start
In order to see web pages, you’ll also need to make sure your firewall is open on port 80. Fedora uses iptables as it’s firewall so let’s open a port for the web: -
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
If you’re planning on using an SSL certificate for HTTPS secure connections, you’ll need both commands. If not, you’ll just need the first one that opens port 80. For this (or any) web server to be useful you’ll also need to open the port(s) on your router’s firewall too. Check that your server is listening on the right port with: -
netstat -l | grep http
…which should give you back one or both ports listening as below: -
tcp6 0 0 [::]:http [::]:* LISTEN tcp6 0 0 [::]:https [::]:* LISTEN
Check that you can reach your server’s ip address (ifconfig will tell you this) by opening a browser and pointing it to “http//your_ip_address”. If all is well, you now have Apache installed and running. To make sure that PHP is installed and working with Apache, create a test PHP page with the following: -
vi /var/www/html/test.php
and put in the following: -
< ?php
phpinfo();
?>
Browse to “http://your_ip_address/test.php” and check that you get the PHP diagnostics page up. If so, you’re ready to install tt-rss. But first, you need to export your Google Reader subscriptions while you still can! If you just want to set up tt-rss without importing from Google Reader, skip this step.
Log in to your Google Reader account here and go to Settings > Reader-Settings -> Import/Export. Click on “Download your data through Takeout” and then click on “Create Archive” which will allow you to download the zip file. Unzip it to a directory on your local hard drive.
Next you need to download tt-rss from the official website. As of the time of writing the current version is 1.7.2. I usually go to where I want it installed first, so: -
cd /var/www/html
..as this is the default location for your web pages, and run: -
wget https://github.com/gothfox/Tiny-Tiny-RSS/archive/1.7.2.tar.gz
If you don’t have wget installed under Fedora, install it with: -
yum install wget
Unpack the archive with: -
gunzip 1.7.2.tar.gz
tar -xf 1.7.2.tar
You should now have a subdirectory called tt-rss or similar. Change to that directory now.
Previously, you installed MySQL and now we need to set up a database under MySQL for tt-rss to store it’s information. If you already have MySQL installed, skip this step.
Start MySQL with: -
service mysql start
If you’ve not used MySQL before, it’ll prompt you to change the root user’s password. Do that now with: -
mysqladmin -u root password NEWPASSWORD
…where “NEWPASSWORD” is the password you want to use. Login to MySQL with: -
mysql -uroot -p
and enter your password. Next we need to set up a user for tt-rss for security’s sake. Run the following SQL: -
GRANT ALL PRIVILEGES ON ttrss.* TO 'rss'@'127.0.0.1' IDENTIFIED BY 'somepassword';
This will add a new MySQL user called “rss” which has complete access to all tables in the “ttrss” database. Their password is “somepassword”. Next, flush the tables with: -
FLUSH ALL PRIVILEGES
Next, we need to create the ttrss database. Do this with: -
CREATE DATABASE ttrss;
and then “exit” out of MySQL.
Try logging into your MySQL account with: -
mysql -urss -psomepassword
…noting the lack of spaces between the -u and -p for username and password respectively.If you can login and see your ttrss database by running: -
SHOW DATABASES;
…you are ready to go. Exit out of MySQL again and change to the schema directory under Apache where you installed tt-rss, usually something like: -
cd /var/www/html/tt-rss/schema
Next we need to import the database tables for MySQL for the tt-rss web application using the provided MySQL scheme SQL file.
mysql -urss -psomepassword ttrss < ttrss_schema_mysql.sql
This should import the tables to your previously created database using the MySQL user "rss" we just set up.
Once this is done, back up a directory level with: -
cd ..
Next we need to copy the default configuration file to something tt-rss can use, so run the following: -
cp config.php-dist config.php
Next, edit the file with vi and change the following directives to your settings: -
define('DB_TYPE', "mysql");
define('DB_HOST', "127.0.0.1");
define('DB_USER', "rss");
define('DB_NAME', "ttrss");
define('DB_PASS', "somepassword");
define('SELF_URL_PATH', "http://your_ip_address/tt-rss/");
Save this file and then try to browse to the URL defined in SELF_URL_PATH. You should be prompted to either unlock the permissions on certain directories or to login. The default username and password is “admin” with “password”. Remember to change them!
Before logging in, we need to choose a method of updating our feeds that we’ll import from the Google Takeout zip file we downloaded. There are two basic ways, via a daemon or via a cron job. The daemon way is recommended and can be done with: -
nohup php /var/www/html/tt-rss/update.php -daemon > /var/log/tt-rss.log &
Here, I’m running the process as a background process as the daemon doesn’t detach from the terminal. It’s recommended not to run this as the root user for security. Otherwise you can add a cron task for the current user with: -
crontab -e
and add the following entry: -
*/30 * * * * cd /var/www/html/tt-rss && /usr/bin/php /var/www/html/tt-rss/update.php -feeds >/dev/null 2>&1
Either way, your feeds will update every 30 minutes.
Okay, so now we need to import the Google Reader data. Login with the default username and password as outlined above. Once you’re logged in, click on Actions in the top right of the screen and then Preferences. Click on the Feeds tab and open the OPML button on the lower part of the screen. Choose the “subscriptions.xml” file you unzipped from the Google Takeout zip file – it’s under the “Reader” sub-directory.
Once you’ve imported your feeds from Google Reader you can now log in to your own server and read your RSS new like normal! Personally, I read a lot of Google Reader stuff on my Android phone, so let’s install the Android app next.
Click here to download and install the Android app for tt-rss. It’s a 7 day trial but the full version is only like £1.72. There are free versions available which you can find if you search the Play store for “ttrss” but I found them buggy. This works a charm.
Once installed, go to the Tiny Tiny RSS app and go to Settings and enter the following information: -
Login: your_tt-rss login - defaults to "admin". Password: defaults to "password" Tiny Tiny RSS URL: http://your_ip_address/tt-rss/
If you’re using HTTPS/SSL you’ll need to check the following if you’re using a self-signed SSL certificate.
Accept Any Certificate: Check No Hostname Verification: Check
The app also has the ability to authenticate Apache Basic Authentication, which if you’re feeling paranoid can be set up here. Back out of this menu and refresh and your Google Reader feeds should start displaying.
Congrats, you now have the exact same Google Reader functionality from your own server :-) Take that Google!
I wonder what they’re going to replace Google Reader with? Something within Google Plus would be my bet.
Update 16/05/2013: You may get a 500 Internal Error under apache when you first start. The two most common reasons for this are your MySQL database is corrupted so delete and reimport your feeds or you don’t have the mbstrings PHP module. If you’re not using a version of PHP that you compiled yourself, you need to download the php-mbstring package. Under CentOS/Fedora, that is “yum install php-mbstring”.
NetFlix clients are on pretty much every device now from Windows to Xbox to PS3 to Android. All except Linux! There is a new Chromebook version (ChromeOS is technically Linux) which uses HTML5 which made certain Linux folks sit up but sadly it uses some sort of hadrware DRM thing on Chromebooks which isn’t available in a regular Linux PC. Until Netflix wants to make this magic native on Linux we’re stuck.
Until that time, you’ll have to resort to a bit of hackery using Firefox and the Windows API layer for Linux, WINE. Luckily for you, somebody has taken the time to bundle up the hack into a nice easily-installable desktop app for Ubuntu. Thanks to NixiePixel for the PPA information :-)
Okay, so NetFlix doesn’t have a Linux native client. On Windows, it uses Microsoft’s Silverlight Web platform to do the devil’s work and decrypt the content from NetFlix. Some Linux users have a problem with DRM in general but since the content is so easily available for free elsewhere on the Internet, I’ll throw NetFlix a bone and pay for some content. I’m not getting political on the use of DRM. Support the companies you like and vote with your wallet for those you don’t *cough EA*. Anyway, Linux doesn’t currently have an alternative to Silverlight which will do the DRM work for us so this NetFlix bundle includes WINE and Mozilla’s Firefox to simulate the use of Silverlight.
I’m using Ubuntu for this as it’s my regular desktop Linux distro. If you’re using Fedora or something like that, there is a version of this bundle elsewhere on the Internet. If you’re desperate for it, leave a comment and I’ll post it.
Okay, so you’ll need to add a new Ubuntu PPA for this. Open a terminal and type: -
sudo apt-add-repository ppa:ehoover/compholio
Update your repository cache with: -
sudo apt-get update
…and then install the NetFlix bundle with: -
sudo apt-get install netflix-desktop
Done! Search for NetFlix in the dash and add it to your Unity launcher or whatever. Once it starts, WINE will install some Firefox plugins and you’re good to go. Restart the NetFlix app, login and enjoy!
Update 15/04/2013: If you get a prompt asking for a Silverlight update, you can do the following: -
sudo apt-get update
sudo apt-get upgrade netflix-desktop
rm -rf ~/.wine-browser
That should fix the issue.
I’m not usually one for posting links as posts but this is a good one. Basically it allows you to learn Linux via a browser although a VirtualBox disk image is also available (and recommended).
There will be some major outages in January/February as I’m moving Node Towers to a new attic :-) Stay tuned on the Node’s Google+ page for updates. Once all this is done, more articles will happen. Merry Christmas!
