Studio Sedition
  Studio Sedition:

ffmpeg on vexxhost

I'm currently working on a video conversion project on a vexxhost server using ffmpeg. I was using this article as a guideline for conversion on the vexxhost server, but apparently the ffmpeg_movie class does not exist... after some digging I found a solution.

First, download the getid3 package in order to access all of the properties you'll need from your uploaded videos. It may not be a pretty as using the ffmpeg_movie class, but if you don't have the option and you're hung up on using a class, you can always write your own.

require_once('getid3/getid3.php');
$getID3 = new getID3();
$fileinfo = $getID3->analyze('path/to/originalfile');
getid3_lib::CopyTagsToComments($fileinfo);
if(!empty($fileinfo['video']['resolution_x'])) echo '

Video width: '.$fileinfo['video']['resolution_x'].'

';
if(!empty($fileinfo['video']['resolution_y'])) echo '

Video height: '.$fileinfo['video']['resolution_y'].'

';
exec("/usr/local/bin/ffmpeg -i 'path/to/originalfile' -ar 22050 -ab 32 -f flv -s ". $fileinfo['video']['resolution_x'] ."x". $fileinfo['video']['resolution_y'] ." 'path/to/convertedfile'");

Labels: , ,

Query String to Object

One thing that has always bothered me about PHP is referencing associative arrays for queries, sessions, etc. Here's an example of a quick fix using type casting to make your development a little more object oriented.

$query = (object)$_GET;

Now, instead of referencing: $_GET['property']
We can use: $query->property

Note: This only works in PHP5 and above.

Labels:

ActionScript Tips

The Five ActionScript Tips in Five Days blog series for Peachpit is now complete. You can always find these blog posts, along with other articles at www.studiosedition.com/articles or you can subscribe to the Studio Sedition article feed. The blog series is an example of what can be found in my latest book The ActionScript 3.0 Migration Guide, The: Making the Move from ActionScript 2.0.

Labels: , ,

Label Statements

This week I join the Peachpit Commons Blog with five ActionScript tips to help make your transition from ActionScript 2 to ActionScript 3 a little less painful.

First up, Label Staments.

Labels: ,

videoPlayer, a reserved word?

I have been going crazy trying to determine why I could not add an FLVPlayback component to my AS2 application without creating an infinite loop. Apparently, I had a movie clip that contained the FLVPlayback I was attempting to add, which was named videoPlayer in the library. I'm happy I can rest now, but it leaves me wondering, is videoPlayer a reserved word?

Labels: ,

FileReference to download server-side file

I was asked today how to download a server-side file through the FileReference object. The issue was that the server-side file was executing before downloading. The FileReference object uses http, rather than ftp, to download files, so any server-side script will execute before being downloaded. You either need to zip it and use the zip as a download or use an intermediate server-side file to write and return a server-side file for download.

Labels: , , ,

Casting: String to Boolean

Convert the string value of a number to a Boolean with AS:

Boolean(Number("0"))

Labels: , ,

Apple Mighty Mouse

It's been a year now that I have been using Apples Mighty Mouse and overall I love it, I must say that it is the best mouse I have ever used, but every once in a while the scroll ball will only scroll in one direction. I've been super aggravated the past few days because I have not been able to scroll up. While this may not seem like a big deal, it is something I have become so accustomed to that I really can't work well without it, in this day and age who can be bothered with scroll bars.

At last, I found the solution and it is so simple I can't believe that I didn't figure it out sooner. If you press hard on the scroll ball and scroll it in all directions it will eventually start working. It only took me about 10 seconds to get mine working again! I'm assuming the ball just gets backed up with dust, etc and it simply needs to be broken loose.

Labels: ,