Pular para o conteúdo principal

Ogg é a parada !!

É sim!
Estava eu fazendo download de algumas músicas novas - já que comprei um HDD novo exclusivo para músicas (deixem-me aproveitar dizer que essa música nova da Britney Spears que está no topo da Billboard é uma bela porcaria); e aproveitava organizar elas quando caiu a ficha: porquê eu continuo usando meus arquivos de música em formato MP3 ???
Não que eu seja xiita por software livre/código aberto nem nada a ponto de não poder usar mp3 (problemas de licença), mas vieram à minha mente algumas coisas que li já ha anos sobre o formato OGG oferecer algumas vantagens.
Bom, vantajoso ou não, eu tinha que arrumar uma forma de converter os até então 150Gb de arquivos mp3 em ogg.
Solução:

#!bin/bash

for file in  `ls *.$1 | cut -d . -f 1`; do
sox -S -V4 $file.$1 $file.ogg
done

Salve como 'converter.sh' ou com o nome que achar mais fofo e execute dentro do diretório que contém os arquivos mp3:

$sh converter.sh mp3

Para os homens (e mulheres) de pouca fé lendo isso, o script apenas lista todos os arquivos .mp3 no diretório atual e converte sequencialmente para .ogg mantendo os mesmos atributos do original (bitrate, etc)
Repare que como estou usando o SOX para converter, é óbvio que você precisa ter o SOX instalado préviamente. A de usar o SOX é que pode-se converter de qualquer formato para qualquer formato.
Humm... na verdade do jeito que tá só dá de qualquer formato para .ogg.
Se modificarmos assim:

#!bin/bash

for file in  `ls *.$1 | cut -d . -f 1`; do
sox -S -V4 $file.$1 $file.$2
done


e executarmos:

$sh converter.sh <formato1> <formato2>

onde formato1 pode ser, por exemplo mp3; e formato2 pode ser, por exemplo, ogg.

Agora sim, o script serve para converter de qualquer formato, para qualquer format !! :)
Podemos fazer ainda melhor tornando o script recursivo, o que seria outra mão na roda para converter as minhas músicas, já que eu tenho tudo organizado por diretórios para os cantores, subdiretórios para albums e aí sim, a música... mas depois eu penso nisso.

Comentários

Postagens mais visitadas deste blog

Learning everything

Today I came across Liz Krane  on Google Plus - the girl that want's to learn everything. She reminded me of a idea for a project I had (that unfortunately never came out of my brain) that basically consists on a study of what is required in order to make Angola a better country. Basic things like education and related project, not tampered statistics generation, etc. If I remember correctly, the idea was to establish a period (maybe 1 year) and break that in parts so I would attack on problem at time so at the end of that period (year) a proper proposal for a better country could be presented. So, of course, like Liz, I don't know everything... no one does. But the beauty of this is exactly to learn and cross reference with other people about a give subject and try to come to practical  conclusions. In the process teach other people. ...Maybe I revive this idea. Along others I had when I was younger :) You can get more details on Ms. Krane project in her page .

Managing your money for free

So... today I took some time to finally decide (at least for the timebeing) between the two major - for me - options for personal financial management: Quicken (paid) and GNUCash (free). GNUCash I have installed and in use for a while and regarding functionality is just great. The problem is just... it is not that good looking. So I gave Quicken a shot . Downloaded a 'trial' version from my favorite usenet repository  and I was ready for the tests. Quicken is nice looking and can generate nice reports - which I like a lot. It has options to plan budgets and other nice little things and can become handy. In fact I was almost opting for Quicken until I realized one little thing missing: it cannot handle transactions with different currencies in the same account; and GNUCash does that like a charm :D. Kudows for the community work. That's it. Free Software 1 x 0 Paid Software :P. And I'm a proud user and supporter of Free Software. Related articles Whats th

Novo Avatar [Parte II]

O primeiro modelo na nova geração de avatar está pronto :D Vamos esperar para ver o feedback .