Archive for the ‘Computers & Tech’ Category

iPhone’s “Code Signing”: Is there any limit for the ridiculous ?

Sunday, March 9th, 2008

Some hours ago i was pointed to an interesting post about the new “code signing” features that Apple is going to implement for the iPhone software developers, and honestly, I am speechless…
There was a time when i used to believe that there was a good reason for Apple to be so closed in some aspects: To keep the user experience as clean and smooth as possible.
That could explain several behaviors in the iTunes Music Store, in the iPod and of course in the whole Mac platform, but after reading several times this great article at Rogue Amoeba’s blog, just one thing comes to my mind… “is there any limit ?”.

I still can’t believe the fact that it is just NOT possible to load an application inside an iPhone unless it’s blessed (read: digitally signed) by Apple, and yes, you read it right, not even for testing purposes, which means that if you want to start writing some code for the iPhone, you have to a) buy a $99 testing certificate, and b) buy an extra iPhone compatible with that extra certificate.
But the story continues….

Apple seems to have a list of things that they are not going to bless, like for example Porn, or “Bandwidth Hog” applications, and there is also the “unforeseen” category, which translated to plain English means “anything that we don’t like at all or we consider bad for our business model”.

I happen to believe that protecting the user experience as much as you can is a good thing, and that is mainly the reason because Mac OS is more enjoyable than any other OS out there, no discussion there, but when a company starts telling me what I am allowed to run (or not) on a device that i OWN, I think that something is really wrong. In my particular case, I don’t own an iPhone (and not even planning to own one, mostly because I use Nextel, and I wouldn’t change it for anything), for the contrary i own a Motorola headset, and i can load any application on it, or even write my own if I feel like.

No matter how much I love Apple and their products, I think that freedom of choice is one of the most valuable things that our society must protect, and while I read a lot of forum / blog posts by the so called “Apple fanboys” saying things like “if you don’t like it, don’t buy it” I just don’t want to believe what could happen if a company with this way of thinking becomes the market leader.

I have yet to see the evolution of this whole thing, but right now this just makes me re-think if some other eternally blamed companies are really sooooo evil after all…

5 things that apple could / should consider for iTunes 8

Sunday, January 13th, 2008

This is just a brief and humble list of things that i would like Apple to consider for iTunes 8 in order to improve the application. If im lucky enough, at least item 1 on this list will become true, and that, would make me and several other people really happy :).

iTunes Icon

  1. Support for HE-AAC Plus V2 Audio:
    This is one of the most modern audio codecs out there, with supporters going from 3GPP to Nero, you can get really good stereo audio quality and channel separation at bitrates as low as 48kbps, which is great for radio streams and podcasts.
    The following is a head by head comparison between an audio file encoded to MP3 with the LAME encoder at 192kbps at maximum quality, and the same file encoded with the 3GPP aacPlus encoder at 48kbps. 

    MP3 audio sample encoded at 192kbps, total file size: 2.56 MB.

    [vidipress height=”20″ width=”450″ mode=”http” filename=”″ /]

    aacPlus v2 audio sample encoded at 48kbps, total file size: 0.66 MB.

    [vidipress height=”20″ width=”450″ mode=”http” filename=”” fs=”no” /]

  2. (more…)

Welcome (back) to the HTML tables age!…

Saturday, January 12th, 2008

Microsoft Outlook 2007 IconOffice 2007 is a great suite of productivity applications, Microsoft Word has been for years my word processing application of choice, same goes for Microsoft Excel when it comes to spreadsheets, and… until some days ago, Microsoft Outlook (not Outlook Express) has been my email application of choice.
Not anymore.
Some days ago i was hired to design and code a series of newsletters for an Argentinian magazine, and even the fact that email marketing / newsletter design is not my main job, i decided to do it because, after all, it is just (x)HTML and CSS, so it should be pretty simple I though… well, i was really, but really wrong. (more…)

Encoding high quality h.264 / aacPlus v2 media for web streaming with Flash 9, version 2.

Tuesday, January 1st, 2008

Update Notice

This post has been updated with a newer and improved script and instructions, please visit the new one HERE.

It was some months ago when I wrote a tutorial about how to encode good quality h.264 video with aacPlus audio in order to use the great capabilities of the new flash player version 9.0.115 (that in case you missed it, now can play h264 video and aacPlus v2 audio).
Due to some personal convictions for my prior tutorial, i decided to use FFMPEG, and while it does the job pretty well, it has some limitations (specially in the video scaling / resizing area). So in my particular case, I had to use several php / bash scripts in order to feed the encoders with the proper resizing data, etcetera.
Well, let me introduce you to the 2nd version of my h.264 / aacPlus v2 tutorial.

This time I used Mencoder, an amazing tool that comes with the mPlayer package, and i also created what i think is a really nice bash script to make the process almost 100% smooth and simple.

These are the things you will need:


Be aware of fake / counterfeit Sony “In Ear” headphones on eBay and similar places!

Sunday, December 23rd, 2007

Hi there, im writing this for anybody interested in how to identify fake copies of an incredibly good product like the Sony MDR-EX90 in-ear headphones.
The real thing is an amazing product that can easily compete with much more expensive offers like the JBL Reference 220 or the Etimotycs ER-6, but sadly, a lot of people is being scammed and is getting just a cheapo “made in tajikistan” imitation.

Here are some tips in order to avoid being scammed.

1) If it is too good to be true, then most chances are that it is not true:
Avoid cheap offers, the cheaper price you can find these headphones is around $60 or so, anything below that price line is for sure a ripoff.

2) Sony puts a lot of effort in packaging and branding of their products, you wont receive a Sony product in a cheap box, never EVER. If the packaging looks poor, the user manual is just a little piece of paper and there are no Sony rebates / offers inside the box, then again, most probably you were scammed.

3) The real headphones come packaged with the following accesories:

  • 3 Pairs of silicon earbuds in different sizes (Small, Medium and Large)
  • A good quality leather bag to store the headphones when you are not using them
  • A proper user manual and warranty card
  • A good quality box and overall packaging

Identifying fake SONY MDR-EX90 in-ear HeadphonesNow, an image is better than a thousand words, i took the time to create a really simple to understand image showing the main ways to identify counterfeit MDR-EX90’s, click on it to see it fullscreen.

Record your favorite radio shows and generate a podcast with the episodes.

Tuesday, October 9th, 2007

Podcast as shown by iTunes 7Ok, this is something that i had in mind since some time ago but i didn’t had the time to actually do it. But now i finished it.
The situation is like this, there is a radio show that i love, but the problem is that this radio show starts at 12 AM and finishes at 2 AM, and usually, I’m doing any other thing at that time in the night.
So, i decided to create some simple script to record the audio in one of my servers (by using the Radio station internet broadcast).

For all this to work, you will need the following things:

  1. PHP 5.1.6 or newer
  2. MPlayer
  3. the GPAC utilitles
  4. the Nero Digital AAC Encoder

The idea for the bash script to record the audio stream is based on a nice tutorial by Phil Salkie, but honestly, i think i improved it a lot, specially because it uses a FIFO as temporary storage, and because it compresses the audio to a more recent audio format like HE-AAC.

Basically, the following bash script will record any audio stream of your choice and will convert it to a HE-AAC file inside an m4a container compatible with any audio player out there AND iTunes / iPod of course ;)

After the audio file is done, the second script will generate a podcast feed (RSS) compatible with iTunes or any podcast client out there, like for example Juice.

Here is the script to capture the radio show and convert it to a M4A file (AAC Plus inside an MP4 container).

SUM2=`echo $SUM | md5sum | cut -c 1-8`

DATE=`date +%F`  # Save the date as YYYY-MM-DD
FILE=/home/plusmedia/public_html/media/$DATE---$SUM2.mp4  # WHERE TO SAVE THE STREAM ?
STREAM=mms://  # The URL of the stream to save.
FIFO=/tmp/stream.wav  # We create a FIFO as intermediate storage for the encoding.
ARTWORK=/home/plusmedia/public_html/lvst.jpg  # Path to some artwork file for iTunes, can be JPG or PNG.
DURATION=122m # How many minutes should we record ?

AUTHOR="Some Author"
ALBUM="Some Radio Show"
TITLE="Some Radio Program - $DATE" 

# We use mplayer to capture the stream to a wav file being stored into a FIFO.
mkfifo $FIFO
/usr/bin/mplayer $STREAM -af resample=44100:0:2,volume=0:1,pan=1:0.5:0.5,comp -ao pcm:file="$FIFO" -vo null -vc dummy < /dev/null 2>&1 >/dev/null & pA=$!

# Encoding the fifo to AAC with the Nero Digital Encoder for Linux.
/usr/bin/neroAacEnc -br 24000 -he -if $FIFO -of $FILE & pB=$!

sleep $DURATION  # wait for the show to be over

kill $pA # end the mplayer process
sleep 2s # IMPORTANT! wait a while for the Nero encoder to finish and close the opened files.

/usr/bin/MP4Box -add "$FILE#audio" -itags cover="$ARTWORK":artist="$AUTHOR":comment="$DATE":album_artist="$AUTHOR" -lang english -new "${FILE%.*}.m4a"
sleep 1s
echo "Generating Podcast Item..."
# We have a new episode recorded, so it is time to call the podcast generation script to update the RSS feed.

echo "Deleting FIFO and temporary files..."
rm $FIFO -f
rm $FILE -f

echo "done!"

And this is the PHP script to generate the “iTunes Compliant” podcast feed:

setIndent = true;
    $xmlObject->startElement ('rss'); //
    $xmlObject->writeAttribute( 'xmlns:itunes', '');
    $xmlObject->writeAttribute( 'version', '2.0');
	$xmlObject->startElement ('channel');
	$xmlObject->writeElement ('title', $title);
	$xmlObject->writeElement ('link', $link);
	$xmlObject->writeElement ('language', $language);
	$xmlObject->writeElement ('copyright', $copyright);
	$xmlObject->writeElement ('itunes:subtitle', $itunesSubtitle);
	$xmlObject->writeElement ('itunes:author', $itunesAuthor);
	$xmlObject->writeElement ('itunes:summary', $itunesSummary);
	$xmlObject->writeElement ('itunes:explicit', $itunesExplicit);
	$xmlObject->writeElement ('description', $description);
		$xmlObject->startElement ('itunes:owner');
		$xmlObject->writeElement ('itunes:name', $ownerName);
		$xmlObject->writeElement ('itunes:email', $ownerEmail);
	$xmlObject->startElement ('itunes:image');
		$xmlObject->writeAttribute ('href', $baseURL.$image);
		$xmlObject->startElement ('itunes:category');
		$xmlObject->writeAttribute ('text', $mainCategory);
			$xmlObject->startElement ('itunes:category');
			$xmlObject->writeAttribute ('text', $childCategory);
	$files = scandir($mediaDIR);
	$sortedFiles = array();
	foreach ($files as $filePath) {
		$fileItem = array( 	'modified'  => filemtime($mediaDIR.$filePath),
							'path'		=> $filePath
		array_push ($sortedFiles, $fileItem);
	usort($sortedFiles, "cmp");
	foreach ($sortedFiles as $value) {
		$extension = substr($value['path'], strrpos($value['path'], "."));
		if ($extension == $fileExtension) {
			$nameParts = explode("---", parseFileName($value['path']));
			$xmlObject->startElement ('item');
			$dateComponent = strtotime($nameParts[0]);
			$xmlObject->writeElement ('title', $itemTitle.strftime('%A, %B %d, %Y', $dateComponent));
			$xmlObject->writeElement ('itunes:author', $itunesAuthor);
			$xmlObject->writeElement ('itunes:subtitle', $itunesSubtitle);
			$xmlObject->writeElement ('itunes:image', $baseURL.$image);
			$xmlObject->writeElement ('pubDate', date('r', $dateComponent));
			$xmlObject->startElement ('enclosure');
				$xmlObject->writeAttribute( 'url', $baseURL.$mediaURL.$value['path']);
				$xmlObject->writeAttribute( 'length', filesize($mediaDIR.$value['path']));
				$xmlObject->writeAttribute( 'type', 'audio/x-m4a');
			$xmlObject->endElement(); //
			$xmlObject->writeElement ('guid', $baseURL.$mediaURL.$value['path']);
			$xmlObject->endElement(); //
	$xmlObject->endElement(); //
    $xmlObject->endElement(); // 

// 	Write XML data to file...
    writeXmlFile($xmlObject->outputMemory(true), $XML);    

function writeXmlFile($contents, $file) {
	$fh = fopen($file, 'w') or die("can't open file");
	fwrite($fh, $contents);

function parseFileName($fileName) {
	$input = explode(".",$fileName);
	$noExt = $input[0];
	return $noExt;

// Custom array ordering function for usort
// orders by REVERSE order (Biggest timestamp goes FIRST).
function cmp($a, $b)
    return strcmp($b["modified"], $a["modified"]);

The PHP script will scan a given directory for files with the extension “m4a” (or any other extension configured in the $fileExtension variable), it will order the files by their created date (in reverse order) and will generate a file called “podcast.xml” that you can access with iTunes on mac or PC, or you could use any other podcast client like Juice.

You should for example call the bash script “recorder” and call the php script “podcast”, then chmod +x both files to make them executables, and then just run the bash script by typing:


Obviously, the idea behind all this is that you should create a crontab entry to run the process automatically, in my case, it runs everyday at 12:00 AM and i did set the duration variable to 121 minutes (2 hours and a bit).
All the rest should be smooth and automatic if you configured correctly the initialization variables in both scripts.

Serverside video resizing script for ffmpeg or Mencoder

Monday, October 1st, 2007

Some days ago, while working on a project that involves the re-encoding of a lot of videos coming from several sources, aspect ratios, resolutions, etc, i found myself in the situation where i needed to “standarize” somehow all the videos to a prefixed size in order to place them on a fixed space in a web page.
While most linux tools like ffmpeg or mencoder include native functions to scale or resize the video, they don’t care about the aspect ratios or about the fact that most video encoders expect mod16 values for the height and width values.
So my situation was like this:

I needed to make all the videos 480 pixels high, and scale the width proportionally.

That being said, i came up with this PHP script that i call from inside a bash script:

$cmdWidth = 'midentify '.$argv[1];
$finalHeight = $argv[2];
exec($cmdWidth, $output);

foreach ($output as $value) {
    if (strstr($value, "ID_VIDEO_WIDTH")) {
		$width = parseResult($value);
    if (strstr($value, "ID_VIDEO_HEIGHT")) {
    	$height = parseResult($value);
$frameSize = $width / $height;
$finalWidth = $finalHeight * $frameSize;
echo getMod16(round($finalWidth)) . "x" . getMod16(round($finalHeight)) . "\n";
function parseResult($line) {
	$v1 = explode("=",$line);
	$v20 = $v1[1];
	return $v20;
function getMod16($number){
	while (fmod($number, 16) != 0) {
		$number ++;
	return $number;

This script assumes that you have the “midentify” utility (wich comes with mplayer) installed in your path, and expects 2 arguments, being argument 1 the movie you want to resize and argument 2 the actual height you want to reach.
That being said, suppose you have a movie that is 848 pixels width and 480 pixels high and you want to re-scale it so it fits inside a 400 pixels high space, you would call the script like this:

./resizer mymovie.avi 400

The script will output this:


You can use later this value as an input parameter for ffmpeg for example.

Before somebody asks, the reason because i used PHP instead of BASH, is simply because bash does not supports floats.

HE-AAC Plus encoder for Mac (Universal Binary)

Sunday, September 30th, 2007

This post is outdated, for a more up to date version of both the binary encoder and the sources, please visit this new post.

I needed a native solution to encode HE-AAC Plus audio on a Mac, but there is not any native solution so far right now, so i compiled the reference encoder (enhAacPlusEnc) published by the 3GPP group.
I also created an xCode project to make it easy to manage future builds.
This is an “Universal Binary” build, meaning that it will work on both, Intel based and PowerPC based Macs.

You can download the universal binary encoder by clicking here, and you can download the xcode project by clicking here.

Keep in mind that i had to make some minor modifications in order to make it compile as Universal Binary, so you wil find some minor diferences when comparing with the original source code released by the 3GPP group.

If you have any question, leave a comment here.

Illacrimo WordPress theme: validated and fixed.

Wednesday, September 26th, 2007

As you maybe noticed, i am using the excellent Illacrimo theme for wordpress on this blog because, basically, i was lazy to code and design my own theme, but most importantly, because i just loved this one.

In any case, there were some minor problems about this really wonderful theme:

  1. It was not Valid XHTML
  2. It was not Valid CSS
  3. There were some minor discrepancies around different browsers (specially in the search box)

So i just fixed the whole HTML and CSS code to be 100% valid, and i also corrected the minor CSS related problems in regards to the search box.
I also did some other minor modifications regarding the line and letter spacing on the fonts to make it “easier to the eyes”.

Please note that this theme includes MY OWN ADSENSE code on it. In order to remove or replace the adsense block with your own, you MUST edit the files single.php and sidebar.php and replace the adsense block with your own. I added adsense directly inside the template to avoid the use of an extra plugin.

Also, in order to create the “info” box (like this one) or the “quote” box, you need to use a span with “info” or “quote” as the class name:
<span class=\"info\">the text for the info box goes here</span>

If you want, you can download the “fixed” version by clicking here.

What the hell is going on with TV Tuner card manufacturers ?

Monday, September 10th, 2007

OK, so i live in Argentina, and our TV Standard is PAL-N. Actually, there are just 3 countries using this standard:

  • Argentina
  • Uruguay
  • Paraguay

Some months ago, i decided to build an HTPC with a relatively old computer that i had laying around here, so the obvious buy was a TV Tuner Card that was also compatible with Windows Media Center.

After several hours of searchs at different manufacturers’ sites, i concluded that the best one to buy was the ATI eHome Wonder, mainly because it was cheap (around U$S 40 at ebay) and because it had a hardware MPEG-2 encoder (that means that when you record a tv program to your hard disk, the processor inside your computer is virtually “free” to do anything else).

So great, around 10 days later, my brand new TV Tuner card arrived, and it worked great, except for the fact that it doesn’t supports PAL-N, in other words, the tuner is hardware locked at the NTSC/M norm, mainly used in USA and Japan.

I was really dissapointed about this, not because of the lack of support for PAL-N, but because of the lack of correct and accurate specifications in almost all the manufacturers websites. In most cases, they claim “WorldWide standards support”, but what they fail to tell you is that they are talking about the LINE or S-Video inputs, but not about the TV Tuner itself.

So what is the deal here ?… pretty simple, 90% of TV Tuner cards out there use really old “tuners” in order to get the RF signal (that’s what comes from the antenna or from your cable provider), and those tuners are usually locked specifically to a prefixed norm (usually NTSC & PAL-B).

Thanks god, after some more search (and after trying several other tuner cards), i found the answer to my prayers: There are new manufacturers that are using silicon based tuners on their boards instead of the old “steel box”, those silicon based tuners dont have any limitation when it comes to the standards they can tune, on top of that, they are amazingly small and the image quality and input sensibility is just better.

Actually, i found the guys at MSI, AdsTech and AverMedia using those silicon based tuners for their new cards, and most probably all those cards are compatible with almost any standard out there, no matter where you are.

So what did I bought finally ?

I found an AverMedia AverTV Purity 3D MCE 500 for a really low price at eBay (brand new).

(Please note the lack of information about the supported standards at their page)

This is actually a pretty high end card, it comes with dual tuners (you can watch one channel while you record a 2nd one), it also comes with Hardware MPEG-2 encoding, it uses a silicon based tuner so it is worldwide standards compatible, and it is compatible with Windows Media Center 2005 and Windows XP (i have found that it is also compatible with Linux and some Linux media centers, but i didnt test that myself yet).

So yeah, if you want to watch TV at your computer or you want to build an HTPC and you live in a country where NTSC or PAL-B are not the TV standards, this is probably the best buy you can make.