HOWTO: Right Click-Convert videos to Ipod / Smartphone format Quickly and Easily

Found a little script that will convert videos to IPod video format (i.e. mp4 with xvid and aac encoding) utilising ffmpeg and ruby. The nice thing about this is that it will preserve the original aspect ratio and add black bars depending, so videos look like they should do (well aside from being in QVGA 320x240 resolution!). Some smartphones (such as the Nokia N95) are also able to display this format =)

The script can be found here

For a little HOWTO:

Open up synaptic and ensure that you have ffmpeg and ruby installed/
apt-get install ruby ffmpeg liblame-dev libxvidcore4-dev libx264-dev libfaac-dev libfaad2-dev
sudo apt-get build-dep ffmpeg
Download the script:

Code:

wget http://thomer.com/howtos/mp4ize
Make it so you can run it:

Code:

chmod +x mp4ize
Move it so it's system-wide:

Code:

sudo mv mp4ize /usr/local/bin
Now, if you want to convert a video, just open up a terminal and type mp4ize [videoname] and it will make an IPod mp4 version in the same folder. Enterprising Nautilus Actions users may want to add a right click menu version for this by adding /usr/local/bin/mp4ize as a path and %M as a parameter.

If everything goes well, your output will look like this:
root@ion:/extra/movies/Life.Support.DVDRip.XviD-BeStDivX/Sample# ls
bestdivx-lifes-sample.avi
root@ion:/extra/movies/Life.Support.DVDRip.XviD-BeStDivX/Sample# mp4ize bestdivx-lifes-sample.avi
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --prefix=/usr --libdir=${prefix}/lib --shlibdir=${prefix}/lib --incdir=${prefix}/include/ffmpeg --enable-shared --enable-mp3lame --enable-gpl --enable-faad --mandir=${prefix}/share/man --enable-vorbis --enable-pthreads --enable-faac --enable-xvid --enable-dts --enable-amr_nb --enable-amr_wb --enable-pp --enable-libogg --enable-libgsm --enable-x264 --enable-a52 --extra-cflags=-Wall -g -fPIC -DPIC
libavutil version: 49.0.0
libavcodec version: 51.11.0
libavformat version: 50.5.0
built on Nov 3 2006 21:14:27, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, avi, from 'bestdivx-lifes-sample.avi':
Duration: 00:01:00.0, start: 0.000000, bitrate: 1071 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 576x320, 23.98 fps(r)
Stream #0.1: Audio: mp3, 48000 Hz, stereo, 160 kb/s
Must supply at least one output file
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --prefix=/usr --libdir=${prefix}/lib --shlibdir=${prefix}/lib --incdir=${prefix}/include/ffmpeg --enable-shared --enable-mp3lame --enable-gpl --enable-faad --mandir=${prefix}/share/man --enable-vorbis --enable-pthreads --enable-faac --enable-xvid --enable-dts --enable-amr_nb --enable-amr_wb --enable-pp --enable-libogg --enable-libgsm --enable-x264 --enable-a52 --extra-cflags=-Wall -g -fPIC -DPIC
libavutil version: 49.0.0
libavcodec version: 51.11.0
libavformat version: 50.5.0
built on Nov 3 2006 21:14:27, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, avi, from 'bestdivx-lifes-sample.avi':
Duration: 00:01:00.0, start: 0.000000, bitrate: 1071 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 576x320, 23.98 fps(r)
Stream #0.1: Audio: mp3, 48000 Hz, stereo, 160 kb/s
Output #0, mp4, to 'bestdivx-lifes-sample.mp4':
Stream #0.0: Video: xvid, yuv420p, 320x240, q=3-5, 400 kb/s, 23.98 fps(c)
Stream #0.1: Audio: aac, 48000 Hz, stereo, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 1439 q=3.0 Lsize= 3734kB time=59.9 bitrate= 510.6kbits/s
video:2763kB audio:936kB global headers:0kB muxing overhead 0.928542%
root@ion:/extra/movies/Life.Support.DVDRip.XviD-BeStDivX/Sample# ls
bestdivx-lifes-sample.avi bestdivx-lifes-sample.mp4
root@ion:/extra/movies/Life.Support.DVDRip.XviD-BeStDivX/Sample#

Comments (31)

Loading... Logging you in...
  • Logged in as
Well done, I tried many other script and this works, thank you very much indeed.
Same here ..
u may need to do this:
sudo apt-get install liblame-dev libxvidcore4-dev libx264-dev libfaac-dev libfaad2-dev
sudo apt-get build-dep ffmpeg
ok you first need to enable universe/multiverse repositories and then apt-get update
You can install the codecs you need with the following commands:
sudo apt-get install gstreamer0.8-plugins
sudo apt-get install gstreamer0.8-lame
sudo apt-get install gstreamer0.8-ffmpeg
sudo apt-get install w32codecs
sudo apt-get install libdivx4linux
sudo apt-get install lame
sudo apt-get install sox
sudo apt-get install ffmpeg
sudo apt-get install mjpegtools
sudo apt-get install vorbis-tools
gst-register-0.8
Enabling Multimedia in Feisty (HOW-TO)
Video/audio codec, flash, mp3, dvd playback, and win32 Codec install for Feisty Fawn for beginners. If your a new user, copy and paste commands into the terminal, should be relatively easy from that point forward.

For mp3, etc.
Open up Add/Remove programs from your Application bar.

Go to Sound&Video and Find and Check all of the packages below (easily done by searching for gstreamer)

* "GStreamer ffmpeg video plugin"
* "GStreamer extra plugins"
* "GStreamer plugins for aac, xvid, mpeg2, faad"
* "GStreamer plugins for mms, wavpack, quicktime, musepack"

Then go to Other subsection of Add/Remove and find

* "Ubuntu restricted extras"

For Flash support

While under the "Other" section enable

* "Macromedia Flash plugin"

For DVD Playback and Win32 Codecs

Edit the file /etc/apt/sources.list using either of the following commands in a terminal:
Code:

$gksudo gedit /etc/apt/sources.list

to open it in the GUI text editor

or

Code:

$sudo vim /etc/apt/sources.list

to open it in the Vim command line text editor

Add the following lines to add the Medibuntu repository to the file:

Quote:
## Medibuntu - Ubuntu 7.04 "feisty fawn"
## Please report any bug on <a href="https://launchpad.net/products/medibuntu/+bugs
deb ">https://launchpad.net/products/medibuntu/+bugs
deb http://medibuntu.sos-sts.com/repo/ feisty free non-free
deb-src http://medibuntu.sos-sts.com/repo/ feisty free non-free
Import the gpg key for the Medibuntu repository to ensure that the packages are installed without warnings/errors regarding trust:
To do this, run the following command from the terminal:

Code:

wget -q http://medibuntu.sos-sts.com/repo/medibuntu-key.g...-O- | sudo apt-key add -

Now update the local list of packages to get the list of packages from the newly added Medibuntu repository:

In a terminal execute the following command:

Code:

sudo apt-get update

Now you can install libdvdcss2 and w32codecs using the following command:
Code:

sudo apt-get install libdvdcss2 w32codecs
Josh, after that, try and reboot.. the problem is the xvid codec for some reason
ok, try grabbing Automatix, and installing all the codecs from that application, once installed it will be in applications->system tools
http://www.getautomatix.com/wiki/index.php?title=...
http://ubuntuforums.org/showthread.php?p=3274348 looks to be where this originated from. Ill try there.
After I do the apt-get commands (installing sourcecode), is there a way to delete any now-unneeded files (while keeping the ability to do Right Click-Convert videos to Ipod, of course)?
OP wrote: "Enterprising Nautilus Actions users may want to add a right click menu version for this by adding /usr/local/bin/mp4ize as a path and %M as a parameter."

How exactly do we do that?
1 reply · active 883 weeks ago
Thanks Christian, worked for me!
(Really nice tool btw.)

so long,
cheers!
hi and thks to every one 4 ur help help but i have a problem, when i send a mp4 video 2 my ipod i can see it but without any sound. pls if some body can help i will be very greatfull.... thnks
Hi there, I'm having an issue that seems to be unique. libfaad2 won't install, which is a first problem, and second, when i try without it (I seem to have libfaad) it says that it can't find the parameters of the file, which then means that it can't convert the file. I can give you the output of an attempt if you'd like.

Thanks, I hope,
Greg
nice! Simple and elegant
alikebabay's avatar

alikebabay · 853 weeks ago

when i try to convert avi file this is what mp4ize gives me. I have followed all the instructions. My os is ubuntu 8.04, sony vaio fz21m
/usr/local/bin/mp4ize:68: warning: regexp has `]' without escape
Couldn't figure out aspect ratio.
This is very, very good. I've checked out a few other options, most of which required a serious amount of hacking. This? Brilliantly easy (for me, that is).

Thank you very much. Great work!
I've just installed this on intrepid. Several packages have been replaced but in each case an alternative was suggested by apt. Just follow the suggestions and it works fine. Thanks very much.
Hey, this works! thanks to the script author, and the good man that put it here....
Anyone know what's wrong with mine? I did the whole process and it worked (I think) when I type "mp4ize" it says "WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s", anyone know what I did wrong? :(
i am encountering the same problem as Chris. any suggestions how to fix this? thx
hmm..tried this it was fine until the end part,
i pasted in my video name and it said permission denied!
XP
izzie: you need to give it permissions - open up a terminal, and type in the following:

chmod +x [drag mp4ize script onto the terminal and the path should show up here]

Then try running the script again :)
I have the same problem, cannot find aspect ratio.
Any fix?
2 replies · active 841 weeks ago
I am trying to convert .avi files from TPB...
Running Interpred...
i also got "Couldn't figure out aspect ratio."

anyone know how i can fix this?

Post a new comment

Comments by

Clicky Web Analytics