Categories
HowTo Linux Raspberry Pi Ubuntu

Unknown encoder ‘libx264’

If you encounter a problem similar to the following, where you’re missing the libx264 codec try this solution.

avconv -r 10 -i image%06d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 timelapse1.mp4

avconv version 0.8.6-6:0.8.6-0ubuntu0.12.10.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:16 with gcc 4.7.2
Input #0, image2, from 'image%06d.jpg':
Duration: 00:02:21.20, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 2592x1944, 10 fps, 10 tbr, 10 tbn, 10 tbc
Unknown encoder 'libx264'

In order to acquire libx264, on Debian based distros (Ubuntu, Mint, Raspbian) install the following package:

 sudo apt-get install libavcodec-extra-53
Categories
Raspberry Pi

Raspberry Pi – Web Server (lighttpd)

piweb

Over the weekend I’ve been playing around with the Raspberry Pi and lighttpd in order to get a little webserver running. lighttpd seemed to be a common choice, thanks to it’s simplicity and lightweightness (*possibly not a real word). There’s a plethora of examples of getting it up and running, which isn’t too difficult, most notably the one over at Penguin Tutor covers most everything. This gets you to the point where you have the webserver with mySql and php set up.

However, for me at least, this was only accessible from localhost, i.e I could only view the webserver on the Pi itself. After a few hours messing around, setting up a static ip on the router and making sure that port 80 was open on the router, and configuring lighttpd.conf, I realised that it was certainly a network issue. On further investigation, I discovered that iptables (the linux kernel firewall) was to blame. In order to get the server viewable from outside localhost, and also globally I needed to allow the port in iptables rules, which I did with the following command (ran on the Pi):

 sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT

Now, this command isn’t set in stone, after a reboot it’ll disappear. In order to save the configuration, once it’s working, just run the following commands:

Save the iptables to firewall.conf and place it in /etc/

 sudo iptables-save > firewall.conf
sudo cp firewall.conf /etc/firewall.conf
sudo rm firewall.conf

Now create a file in /etc/network/if-up.d/ called iptables:

sudo nano /etc/network/if-up.d/iptables

And add this content, this will load the iptables config file you saved earlier on boot:

#!/bin/sh
iptables-restore < /etc/firewall.conf

Save and exit (Ctrl+X then press Y and hit return)

Next, make the file executable:

sudo chmod +x /etc/network/if-up.d/iptables

Now you're done, it should be safe to reboot and the iptables will be loaded.

Categories
Arch Linux Command Line Linux Raspberry Pi Ubuntu

Setting up a static external IP address on a Raspberry Pi (For Free!)

If you’re planning on setting up your raspberry pi as a server or a project that’ll want you to access it from a static external IP address, here’s a really simple and quick way to get that up and running for free.

First off, this guide uses the free service from no-ip (www.no-ip.com), so you’ll want to head over there and register for that. (http://www.no-ip.com/newUser.php)

Done? Ok, great. Next you’ll want to create a new host, this can be found under the “Hosts/Redirects” page (this link should work if you’re logged in: https://www.no-ip.com/members/dns/)

Click “Add a Host”

Enter a name and choose one of the free domains from the drop down box (alternatively you are able to use an existing domain name or sub-domain if you have one.) There are some other settings, if you know what you’re doing go ahead and choose which you prefer but from those who just want to get this set up you can now click “Create Host” and you’re done.

Now, in order for this system to know what your pi’s current address is in order to assign it that domain address you need to install the client on the pi (thankfully, they have a Linux one!).

Download the latest version of their client – http://www.no-ip.com/downloads.php?page=linux

tar -zxvf noip-duc-linux.tar.gz
make
sudo make install

One there, you’ll be promted for your email and password for no-ip.com.
It will then show you have a host registered, just hit enter.
Then it will ask to update the host you made on the site “Do you wish to have host [somedescriptivename.no-ip.org] updated?[N] (y/N)”. Type “Y” then hit enter.
It’ll ask for an update interval, this can be left at 30.
Then it’ll ask if you want to “run something on successful update”, basically this allows a script to run if it gets a connection. Choose N and hit return.

That’s it, you should be done. Just test out the connection via SSH or ping and compare the IPs.