tonybaldwin | blog

non compos mentis

Posts Tagged ‘ogg

Oggify – convert all your wav and mp3 to ogg

with one comment

A script to convert .mp3 files to .ogg

Requires mpg123 and oggenc, uses perl rename, but I can make one with the old rename (rename.ul now in ubuntu and debian).

Why should we use ogg?

cd into the dir fullo tunes, and:


#!/bin/bash

# convert mp3 and wav to ogg
# tony baldwin http://www.BaldwinSoftware.com
# cleaning up file names

echo cleaning file names...

rename 's/ /_/g' *
rename y/A-Z/a-z/ *
rename 's/_-_/-/g' *
rename 's/\,//g' *

# converting all mp3 files to wav,
#so there will be nothing but wavs

echo Converting mp3 to wav...

for i in $(ls -1 *.mp3)
do
n=$i
mpg123 -w "$n.wav" "$n"
done

# and, now, converting those wav files to ogg

echo Converting .wav to .ogg

for i in *.wav
do
oggenc $i
done

# Clean up, clean up, everybody everywhere
# Clean up, clean up, everybody do your share...

# cleaning some file names
# removing ".mp3" from $filename.mp3.ogg
# for result of $filename.ogg

rename 's/.mp3//g' *.ogg

# removing all those big, fat wav files.

rm -f *.wav
rm -f *.mp3

Cleaning up after ourselves...

echo -e "Your files are ready, friend.\nHappy listening!"

exit

# This program was written by tony baldwin - tony @ baldwinsoftware.com
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

wiki page for this script.

I have a version with a little gui-ness with zenity, if anyone wants it. (i.e. with a graphical user interface)

./tony

Written by tonybaldwin

February 22, 2011 at 11:25 am

Oggify – convert all your wma, wav and mp3 to ogg

with one comment

A script to convert .mp3 files to .ogg

Requires mpg123 and oggenc, uses perl rename, but I can make one with the old rename (rename.ul now in ubuntu and debian).

Why should we use ogg?

cd into the dir fullo tunes, and:

#!/bin/bash

# convert mp3 and wav to ogg
# tony baldwin  http://www.BaldwinSoftware.com
# cleaning up file names

echo cleaning file names...

rename 's/ /_/g' *
rename y/A-Z/a-z/ *
rename 's/_-_/-/g' *
rename 's/\,//g' *

# converting all mp3 files to wav,
#so there will be nothing but wavs

echo Converting mp3 to wav...

for i in $(ls -1 *.mp3)
do
n=$i
mpg123 -w "$n.wav" "$n"
done

# and, now, converting those wav files to ogg

echo Converting .wav to .ogg

for i in *.wav
do
oggenc $i
done


# Clean up, clean up, everybody everywhere
# Clean up, clean up, everybody do your share...

# cleaning some file names
# removing ".mp3" from $filename.mp3.ogg
# for result of $filename.ogg

rename 's/.mp3//g' *.ogg

# removing all those big, fat wav files.

rm -f *.wav
rm -f *.mp3

Cleaning up after ourselves...

echo -e "Your files are ready, friend.\nHappy listening!"

exit

# This program was written by tony baldwin - tony @ baldwinsoftware.com
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

wiki page for this script.

I have a version with a little gui-ness with zenity, if anyone wants it. (i.e. with a graphical user interface)

./tony


UPDATE: 2011.02.24

I wrote a separate script for those darned .wma files. Requires FFMpeg:

#!/bin/bash

# tony baldwin http://www.BaldwinSoftware.com
# cleaning up file names

echo cleaning file names...

rename 's/ /_/g' *
rename y/A-Z/a-z/ *
rename 's/_-_/-/g' *
rename 's/\,//g' *

echo convert wma files to ogg

for i in *.wma;
do ffmpeg -i $i -acodec libvorbis -aq 100 $i.ogg;
if [ -f $i.ogg ]; then
rename 's/.wma//g' $i.ogg
rm $i
fi
ls *.ogg
echo 'all done'
done

Written by tonybaldwin

February 22, 2011 at 11:25 am

A Layman's Thoughts on Freedom of Information and Open File Formats

with 6 comments

(a work in progress / originally penned in 2008, reposted here from mylivejournal)

Had the inventor of writing, if you will, demanded his rights in terms of the use of such a system, of course, anyone that wrote anything would owe him for use of this “intellectual property”. Thus, he would have a right to demand his fee for the conveyance of any information, of any nature, in a written form. This would mean, he would have control over any written communication. He would be able to control what information could be conveyed in writing, who could have access to that information, and, of course, he could
demand payment for any and every time information of any nature was conveyed in this fashion.

Let me just clarify that by being a bit more precise, while summing up the entire situation in general:
He would have control over the conveyance of any information in written form.
He would control information.

Anyone with such power, of course, would have immense, if not complete control over public opinion and knowledge. I think we can agree that such control centralized in the hands of one person would be A BAD THING. This individual could control religious thought, philosophy, the dissemination of scientific knowledge, etc., ad infinitum.

Now, consider even if Gutenburg had patented and copyrighted the printing press, and all printing of any matter would, again, be his to control.  Or perhaps, say one person controlled all rights to the use of paper (papyrus), when it was invented, and, thus, could control any use thereof and any matter that was printed or written on paper, etc. Control over any such process or media would put untold power in the hands of the individual possessing such power.
I think we can agree that such control centralized in one person (or one company) would be A BAD THING.

Freedom of information, freedom of expression and freedom to learn are, and I believe this is a widely enough held notion that nobody will argue the contrary, ESSENTIAL freedoms. Freedoms necessary to the advance of the human species, of knowledge, of culture and scientific progress.

This is why we need to have open standards for document formats, and why proprietary document formats are to be avoided.  This is why we should not allow specific software vendors to control the dispersion of information by allowing their proprietary document formats to become standard to any industry. Allowing them such control allows them control over that industry. They will have the ability to stifle choice of software use and will have control over the publication of knowledge.

In today’s digital, information age, if one individual or one company has control of the file formats in which information may be shared, or if one company or individual controls all software capable of accessing information in said formats, that individual or company has control of all information. Such a company could extort whatever price they wish for your use of their product and file formats. Such a company could refuse you license to use their product and their file formats if they disagree with or dislike the information you wish to share, even.

This is pretty well the case when speaking of the current situation in reference to various industries where certain proprietary software vendors have cornered the market, often by untoward means and with inferior products, and stifled the people’s right to choice. This is why you spend $300 on Microsoft Windows, and $500 on Microsoft Office, and have to pay again for them to fix these inferior software products when they fail on you. This is why translators are almost unanimously being forced to use SDL’s Trados and Tag Editor. I assume the situation is similar on other industries (graphics/publishing, etc.) Choice is stifled when a vendor controls a market.

This is why document formats such as:

  • Microsoft’s .doc, .wmp or OOXML,
  • SDL’s .ttx,
  • Thomson’s mp3,
  • Adobe .pdf

and other proprietary formats, specific to one software vendor, are harmful, and to be not only avoided, but completely eschewed in favor of open document formats created according to open standards, such as .odf, .tmx, .xliff, .xml, .html, .djvu and .ogg .

Understand, I am in no way advocating an end to intellectual property rights. Certainly, those who create works of art, software, literature, music, etc., have a right to their creations.
What I am advocating is free access to information and the means of manipulating and conveying information.

What are open standards?
From Free Software Foundation, Europe:

Definition

An Open Standard refers to a format or protocol that is

  1. subject to full public assessment and use without constraints in a manner equally available to all parties;
  2. without any components or extensions that have dependencies on formats or protocols that do not meet the definition of an Open Standard themselves;
  3. free from legal or technical clauses that limit its utilisation by any party or in any business model;
  4. managed and further developed independently of any single vendor in a process open to the equal participation of competitors and third parties;
  5. available in multiple complete implementations by competing vendors, or as a complete implementation equally available to all parties.

Relevant links:

tony

  1. click here for a copy of this article in the free/open document format .djvu
  2. click here for a copy of this article in open document text format .odt

Written by tonybaldwin

February 18, 2010 at 2:22 am

Oggify (improved)

with one comment

Aside from any argument over which audio file format is best (I like FOSS, thus ogg), I reworked my oggify script, attempting to implement what I learned from comments at

Oggify (improved)

Written by tonybaldwin

September 4, 2008 at 11:56 pm

Oggify… converting all your wav and mp3 to ogg

leave a comment »

I have too many wav and mp3 files, really.
I mean wav files are BIG.
And mp3 files suck, and are a proprietary format.
So, I wanted to convert ALL of my tunes to ogg-vorbis format,
a lossless open source audio file format.

So, I wrote this:

#!/bin/bash

# convert mp3 and wav to ogg
# copyright tonytraductor / http://www.BaldwinSoftware.com
# released under the terms of the Gnu Public License v.2 or later.
# no promises…if it breaks something, call your mom…

echo “Oggify, at your service.”

# removing spaces in names or
## mp3s

echo “Removing spaces in names…”

for i in $(ls -1 *.mp3)
do
rename \ _ *.mp3
done

## and wavs

for i in $(ls -1 *.wav)
do
rename \ _ *.wav
done

echo “Converting mp3 files to wav…”

# converting all mp3 files to wav,
#so there will be nothing but wavs

for i in $(ls -1 *.mp3)
do
n=$i
mpg123 -w “$n.wav” “$n”
done

# stripping the .mp3 extension from filename.mp3.wav

for i in $(ls -1 *.wav)
do
rename .mp3. . *.wav
done

# clean up as we go

rm -f *.mp3

# and, now, converting those wav files to ogg

echo “Converting wav to ogg…”

for i in *.wav
do
oggenc $i
done

# more clean up

echo “Removing mp3 and wav files…”

# removing all those big, fat wav files.

rm -f *.wav

echo “Your oggs are all fresh and toasty and ready to enjoy, friend.”
echo “Happy listening!”

exit

I had written a gui version, too, with zenity, but, bah…
Who needs a gui?

Written by tonybaldwin

September 1, 2008 at 6:23 pm