Aquivo do autor: Gustavo Felisberto

Convert video to iPhone/iPod Touch using ffmpeg

If you search for this topic you will find some examples of using ffmpeg to convert movies to a format that will work with the iPhone. I am a Linux user so I did not had much usage for this because there is no iTunes in linux 🙂 Until I needed to stream videos to the iPhone. Right now I’m using wowza for the actual streaming that involves creating a special playlist that will tell the iPhone how to get the file from the server. But that is another story.

So the actual ffmpeg command I’m using is:

ffmpeg -threads 2 -i INPUT_FILE -r 20  -vcodec libx264 -s 320x240 -flags +loop \
-cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 24  -bt 256k -refs 1 -coder 0 \ 
-me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250  \
-keyint_min 25 -level 30 -qmin 10 -qmax 51 -trellis 2 -sc_threshold 40 \
-i_qfactor 0.71 -acodec libfaac  -ab 128k -ar 48000 -ac 2 OUTPUT_FILE

So what does all this mean? I am no ffmpeg expert but I’ll try to give an explanation. If you can fill the gaps please post a reply.

  • -threads 2 Number of threads ffmpeg will use. This should be the number of cores in your system
  • -i INPUT_FILE The path to the file you want to convert
  • -r 20 The frame rate of the converted file. This should be the same as the input file. A lower value means a smaller file
  • -vcodec libx264 Codec of the output file. This means that output will be a H264 Mpeg4 file
  • -s 320×240 Resolution of the output. Should not exceed the input file. In any case remember that iPhone resolution is: 480×320
  • -acodec libfaac -ab 128k -ar 48000 -ac 2 Audio format. AAC audio with 128kbits bitrate, with 48000Hz sample rate and 2 channels. Lower values will give smaller files and less quality.

If you know what the others do anf how do they affect the quality/size please post.

Dia da Criança

Laura:

Hoje é dia da criança. Um dia criado para que nós os grandes nos lembremos dos mais pequeninos. Como se fosse preciso um dia! Deveria ser nossa preocupação todos os dias os mais pequenos de entre nós. São vocês o futuro do mundo.

Hoje quando passei no teu berço dormias. Estava ali a ver-te há uns segundos quando abriste os olhos e olhaste para mim. Não sei se foi só a fominha a apertar ou se te estavas a sentir observada. Sorri para ti e tu devolveste o sorriso. Obrigado filha.

Bom dia Laurinha. Bom dia meu doce. Bom dia meu amor.

Oracle buys SUN

Oracle bought Sun.

The question in most of the Free Software advocates right now is what will happen to Suns Free Software products:
1- MySQL
2- OpenOffice
3- Netbeans
4- ……

Although MySQL seems the first candidate to die I guess this is one of the products with the best chance to survive*. Databases is the core business for Oracle so they will probably keep the product and in time make it more Oracle friendly. So that users that develop for MySQL can easily migrate to Oracle when requirements increase.
Right now Oracle has the Oracle Express Edition but installation is sometimes complex and the limitations to the CPU/Memory/Disk Space make some developers run away. PostgreSQL is very good, but does not have the momentum. So MySQL is not a brand that any company wants to kill.

* – The Free Software products always have a chance to survive if the “Mother Company” kills them. The community can always pick the product and develop it. That is one of the base ideas that made Stallman create the concept. But it is always easier for a product to survive if there is a cash flow of some sort.

OSX Dependency walker

It is not as nice as Windows “depends” but does the job:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env ruby
 
paths = [ARGV[0]]
libs = { ARGV[0] => 1 }
 
while paths.size > 0 do
    path = paths.pop
    lines = `otool -L '#{path}'`.split("\n")[2..-1]
    new_libs = lines.collect do |line|
    line =~ /\s+(.*)\s+\(.*\)\s*/
    $1
    end
    new_libs.each do |lib|
        if libs[lib] then
            libs[lib] += 1
        else
            libs[lib] = 1
            paths < < lib
        end
    end
end
 
puts libs.keys.sort.join("\n")

Credit for finding this at idevappsgoes to Armindo

Vmware keyboard issues

I’m running Windows XP inside vmware. The host machine is running Linux (Ubuntu jaunty). I was having issues with the keyboard where the arrow keys would not work, or would do the wrong thing (down key would open the start menu).

I found a solution that involved editing ~/.vmware/config and add a line like:
xkeymap.nokeycodeMap = true
But this would not work properly as Vmware would think I had a Japanese keyboard and some keys would not work.

I found another solution and this one seems to be working fine. Instead of the previous code add this to your ~/.vmware/config:

xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.106 = 0x135 # KP_Divide
xkeymap.keycode.104 = 0x11c # KP_Enter
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.78 = 0x46 # Scroll_Lock
xkeymap.keycode.127 = 0x100 # Pause
xkeymap.keycode.133 = 0x15b # Meta_L
xkeymap.keycode.134 = 0x15c # Meta_R
xkeymap.keycode.135 = 0x15d # Menu

New Life

Laura:
Chegaste no dia 21 a este mundo. Não tenho palavras para descrever o que senti quando te vi e peguei pela primeira vez, mas consigo dizer que foi a melhor sensação do mundo.

Raquel:
Chegou a nossa filha….. Chegou a nossa filha…..

A todos os leitores:
Estou aqui a olhar para o écran e não sei o que escrever. Nada me parece correcto. Tudo me parece demasiado pequeno ao pé desta sensação forte cá dentro que me faz o cérebro parar. Digam só uma coisa a este pai babádo…. Não é a bebé mais bonita que já viram?

dsc_0510-800

iPhone MMS

An application that sends and receives MMS messages is now available for you’re iPhone. There is no need to have a Jailbroken iPhone as the application is available from Apple Store. Right now the application only works for clients of Vodafone Portugal. More info is available at the producers web site.

A video that shows the application working is also available:

Telephone Regular Expressions

Designing a regular expression to find phone numbers is some string are not trivial. The rules of what is a valid number are strange, and the phone itself can be present with any number of artifacts, like spaces, dashes and parentheses.

This last morning I have been trying to design a good regular expression but I’m still a bit far. So far I managed to do:
(\(?[\s]*(00|\+){1,1}[\d]{1,4}[\s]*\)?)?([\s]*|-)(-|[\s])?(\(?[\d]\)?([\s]*|\.|-)){7,15}

But it sill misses things like: +351 (21) 1111111

iPhone to thunderbird+lightning

Apple should add thunderbird+lightning support to at least iTunes on Windows. Not every windows user has Outlook installed.

Right now almost all options to do this include some extra softwares (jailbroken iPhone) or thunderbird plugins and Google accounts. And I may not want my data in Google.
If you do not mind having data in Google read on. Right now I just want to sync Calendar events.

As I need to have data synced I’ll post my findings were. So stay tunned.
[UPDATE 2009-02-10]
All this syncing is dangerous. The iPhone will delete all contacts and/or calendar events on the phone when adding a external sync.

Two solutions so far for Contacts and Calendar:

1- Get your company to install Exchange or one of the Free Software alternatives. And then just add the account on the iPhone and search for info on how to get Lightning to get the data from there.

[New Update 2009-02-15 15:17] There is no need to use the Nuevasync Service
2- This is the one I use. It involves having a Google Calendar account and Sync the iPhone and Lightning there. In the iPhone follow the instructions in the Google Mobile Sync page. To have Lightning use the calendar just add a new Calendar of type CalDAV and in the url put: https://www.google.com/calendar/dav/YOUREACCOUNT@gmail.com/events .

There is no “Sync now” and events will be propagated auto-magically. In my case if I have calendar open on the iPhone and add events in Lightning they propagate in 3 to 5 seconds.

Susto

Ontem à noite a Laura resolveu pregar um susto a mim e à mãe. A dois meses da data prevista de chegada ela achou que já estava presa à demasiado tempo e que a hora de nascer tinha chegado.
A Raquel está neste momento na Maternidade Dr Daniel de Matos e parece já estar controlada a situação. Mas agora terá de repousar para que não haja mais sustos.

Laura: Tem calma filha e espera mais um pouco.

[UPDATE 17:45]: Parece que já está tudo mais calmo. A Raquel deve voltar para casa amanhã, mas terá de ficar por casa até a Laura nascer.

Sometimes the Music Industry goes nuts

A few weeks ago I talked about a new MTV service that would let us see all the videos in MTVs archive. Right now if I try to play the video it tells me that I cannot play it outside the United States.
A few minutes ago I was on last.fm trying to play some videos and the ones that were presented being hosted on youtube gave the same type of error as MTV.

This is just STUPID!!!!! If I’m not in the right country I cannot listen to the music? What can possibly be the reasoning?

Music Meme

A funny music meme

Go ask Alice
When she’s ten feet tall

in White Rabbit by the Jefferson Airplane

Rules for this Meme:

  • Search for the lyrics for the song that you are listening now.
  • If music is purely instrumental use the last music with lyrics
  • Copy the 5th and 6th verses
  • Post the text of the verses in your journal along with these instructions.
  • Don’t dig for your favorite music or the cool alternative musics: use the one you are listening to now.

Book Meme

Book Meme Floating around, so mine is:

Save the file and reboot the system for the settings to take effect.

in Asterisk, The Future of Telephony

The Rules for this meme are:

  • Grab the nearest book.
  • Open it to page 56.
  • Find the fifth sentence.
  • Post the text of the sentence in your journal along with these instructions.
  • Don’t dig for your favorite book, the cool book, or the intellectual one: pick the CLOSEST.

A Wiki for Gentoo

A long long time ago I voiced about the need for a wiki in the Gentoo project. In those days Gentoo-Wiki was starting up.
For some reason or other people inside the project felt that having the users producing documentation was a bad idea. For some other reasons that I never understood the gentoo-wiki.com becamed a banned issue, and Gentoo developers were advised not to mention, and not to link to him. I wrote an extensive article about Gentoo on the Efika board that got some raised eyebrows because it was written on the Wiki.

Now Gentoo Wiki has been down for a few days. And according to the backup page it does not seem a fix is going to happen soon.

If we had taken this project under an umbrella a long time ago our users would not be missing on this very important resource.