Convert video to 3GP format.

Now I expected this to be hard. Or at least take a lot of fiddling to get right. However, it seems to be quite easy. This site has all the goodness. It requires three steps. Now assume we have a file called movie.mpeg and we want to convert it to movie.3GP. The steps required would be

mencoder movie.mpeg -nosound -ovc lavc \
-lavcopts vcodec=mpeg4 \
-vop expand=176:144,scale=176:-2 \
-o movie.avi -ofps 12

This will extract the video, scale it and reduce the frame rate. Now we need to extract the sound.

mplayer -vo null -ao pcm -af \
resample=8000,volume=+4db:sc movie.mpeg

An output file called audiodump.wav will be created that has the audio that we require. Finally we need to combine these two files together.

ffmpeg -i movie.avi -i audiodump.wav \
-b 48 -ac 1 -ab 12 -map 0.0 -map 1.0 movie.3GP

And that is that. I suppose I should add this to the HantsLUG wiki. Next I need to bundle this lot up into a script so I can then forget all about how this works 🙂

Create and Play 3gp files in Ubuntu

OK, so I have a nice new Video phone. I want to be able to play, edit and create the videos. The format that the Sony Ericsson phone uses is 3gp. It turns out that ffmpeg can handle these, but no sound with the version that comes with ubuntu. Here is how I went about fixing this. Please remember that a lot of of this was discovered by Google, and not really my own work.

The first thing to do is make sure that universe and multiverse are available. I used these ones.

Now we need to get the software that we want. The following commands should do that for us.

sudo apt-get build-dep ffmpeg
sudo apt-get install liblame-dev libfaad2-dev \
libfaac-dev libxvidcore4-dev checkinstall fakeroot
apt-get source ffmpeg
cd ffmpeg-0.cvs20050918
less libavcodec/amr.c

You now need to read the instructions in that source file. I decided to use the floating point versions of both, so I executed the following commands.

mkdir libavcodec/amr_float
cd libavcodec/amr_float
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip
unzip 26104-510.zip
unzip 26104-510_ANSI_C_source_code.zip
mkdir ../amrwb_float
cd ../amrwb_float
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip
unzip 26204-510.zip
unzip 26204-510_ANSI-C_source_code.zip
cd ../../

Now we need to make sure that all the correct bits get built. This is done by editing the rules file as follows.
Add the following lines to debian/rules, under the other confflags lines:

confflags += --enable-mp3lame --enable-faad
confflags += --enable-faac --enable-xvid
confflags += --enable-amr_nb --enable-amr_wb

We only really need the last line, but while we are at it, we may as well add the other ones as well. Continuing in the terminal:

fakeroot debian/rules binary
sudo checkinstall

When running the final command, most of the default options can be accepted. However, it may be worth changing the name to ffmpeg and setting the version to something that will keep it from getting overwritten on an update. Alternatively just set the package on hold once it is installed.

That will do for now. Later I will have a play, and come up with some recipes. The main thing that I would like to be able to do is convert from the phone to a format that plays on the computer. Then I would like to come up with some good settings for converting a saved DVBT stream for viewing on the phone.

I thought that I should admit I got most of my help from here.

Sony Ericsson K800i

Just got myself a new phone. This is the first phone that I have bought myself, and not a scrounged second hand unit. Best bit about it so far is that I can access the files on it from withing Linux. I just plugged it in and I could see a new PHONE icon on the Ubuntu desktop. Now all I need is to work out if it is possible to convert to and from the 3gp video format.

WordPress Revolution

My first blog was built using some php code that I had developed myself. It worked, but only just. Once I looked at wordpress, that seemed to be popular with others, I decided that there was not a lot of point re-inventing the wheel. I have now decided to use wordpress for myself

I will hopefully get round to integrating the style with my main site, but in the meantime, I will make do with the default

Now that it will easier for me to look after, I will try to blog more.

Novatech uses Ubuntu!

While flicking through the July copy of the Novatech catalogue, something about the screen image of one of their machines caught my eye. As I looked, I thought it was strange to have a terminal window with a transparent background on a Windows machine. Then I realised it was strange to see any sort of terminal window on a Windows machine. Finally I noticed that it was in fact an Ubuntu desktop that I was looking at.

Just thought that I would share that with you all!

sudo vs su

Some time ago, there was a discussion on the Hantslug mailing list about the relative merits of Sudo verses su. At the time I was using Debian, and had not configured Sudo, so was therefore a su user.

Since then, I have installed Ubuntu 6.06. Ubuntu, for those that don’t know, does not setup a root password by default, and Sudo is the recommended method of gaining root privileges.

Having played with it for a little while, I an now converted. I like the idea of using Sudo to allow the execution of one off commands as root. I will still use su if I am going to do lots of work as root, but as Ubuntu is pretty well sorted out of the box, I don’t need to do that much.

Ubuntu

With the recent release of what has been touted as the best Ubuntu yet, I decided to give it a go. I will give it a fair go. It will require I learn to use tools I don’t normally use, but I do like to try the defaults before I start tacking it apart. I will have to learn to use gnome, evolution, rhythmbox etc.

I have already made it over the first hurdle and got my usb dvb adaptor working. As for the rest, only time will tell….

Modules Madness

Ok, I am about to rant a little. I hate modules! Or maybe it is just the modules on my machine.

I recently installed Debian Unstable onto my machine. I used the stock 2.6 kernel, and the only thing I needed to do to get my USB TV adaptor to work was to copy the firmware file to the correct location.

That got me up and running with xine. Now, today I wanted to use dvbstream to record the GP. It failed. I remembered reading on Hugo’s website (www.carfax.org.uk) about adding an option to one of the dvb modules that stopped it from being automatically unloaded, or something. I found the details quite easily, but then I need to find exactly where to stick this information. It was by now about five minutes to go before the start of the GP.

It would appear that Debian is in the process of upgrading how modules are configured as there seems to be two places holding configuration files. Frankly, I don’t care how they are handled, as long as it works. With minutes to go, I was not in the mood to learn. Naturally, with sods law in motion, the first place I tried failed to work. I finally managed to get it to work by adding a file called dvb in /etc/modprobe.d. The file contained the single line

options dvb_core dvb_shutdown_timeout=0

I hope I remember this for the next time I re-install!

Multisite Gallery

I had installed Gallery v2 on my Debian testing server. It works very well. Now I had a problem where I wanted to have some images available publicly, while the majority I wanted to keep for viewing on my internal network only. I know that Gallery has permissions, but I decided that a multisite install would do what I wanted.

I started with Gallery installed from the default Debian testing package. This is a standard single instance installation. On the Gallery website there is some information on setting up a multisite installation. The main thing to remember is to make sure that the database and directories for the new instance are created beforehand. Then it is a simple matter of selecting the multisite option during the install. The install is initiated by going to

http://sitename/gallery2/install

The only additional thing I had to do was make a copy of the Apache config file for gallery in

/etc/apache2/conf.d

I then repeated the operation to make a private gallery.

Once the private gallery was completed, I needed to move the contents of the original gallery yo it. This section was missing from the gallery documentation mentioned above, so I had to wing it on my own. Using phpmyadmin I created a backup of the original gallery database. Then I imported that into the new private gallery database. All the actual albums are then copied from the file system to the new albums location. I would not try this if there were any pictures already in the destination gallery.

I now have two picture galleries that are totally independent, and I can easily secure one from being publicly viewable. If you want to test that claim then the public gallery is here and the private one is here.