FLV to MP4 and FLV to 3GP using ffmpeg

roland's picture

I have a G1 phone and I like watching funny videos online. Here's what I did to covert flv files to mp4, which can be played by my phone.

In my ubuntu server, I installed yasm (from tar ball at http://www.tortall.net/projects/yasm/wiki/Download), x264, ffmpeg using the instructions from http://ubuntuforums.org/showthread.php?t=786095.

The ffmpeg manual is quite nice. http://linux.die.net/man/1/ffmpeg

To convert a file file from FLV to 3GP:

ffmpeg -i input.flv -s qcif -vcodec h263 -r 10 -b 180k -sameq -ab 64k -acodec libfaac -ac 1 -ar 22050 output.3gp

To convert a file from FLV to MP4:

ffmpeg -v 0 -i in.flv -y -acodec libfaac -ar 22050 -ab 64k -r 25 -vb 384000 -f mp4 -vcodec mpeg4 out.mp4

The problem with the G1 is that you have to download the videos first, then play them, you can't stream them. I use the meridian player, which doesn't seem to support streaming, and neither does the video player in the G1.

Request Handling on an MVC framework

roland's picture

It is common practice to use mod_rewrite and delegate one PHP file to handle all requests. The question is how do you tie in the controller/action in the route format?

I have written my own MVC framework, and will share the code after I document it a bit. However, here's a preview of the Request Handler. Below is the pseudocode:

  1. Recursively collect all controllers in app/controllers
  2. Sort controllers by length.
  3. Iterate over controllers and stop once the routes match
  4. Initiate a class object for the requested controller
  5. Call the right method if it exists

So that's easy enough.. below is an example of the code I am using.

 

An interesting lesson from Judge Mathis

roland's picture

Here's a quote taken from the Judge Mathis show aired at 10:00AM 3/24/2009 on WTTV-CW.

There is a disproportionate number of black folks that whup their children and psychologists and sociologists suggest that that's why there's a disproportionate amount of violence in the inner cities. Because, it's a learned behavior.

If you think that you can resolve problems with your children with violence, whipping, then they grow and, subconsciously or otherwise, believe that problems should be solved in a violent manner.

...

Some sociologists have said that during slavery, the slave master whuped the slaves with a belt or a whip, and that legacy continues, so that African Americans continue through generations to whup with a belt.

This is really interesting. I agree that whuping children, makes them more likely to whup their own children, but the slavery connection might be a bit of an overstretch. What makes more sense is that African American being marginalized for so long, and are more likely to suffer stresses. Parents that are very stressful tend to be more violent and children are just in the way.

My parents did not punish me physically after I turned 10, and I grew up with friends that were physically punished by their parents. They were in fact more likely to get in physical altercations. I was usually the one to break the fight. One is just that, one, but still important.

Often when I watch shows such as "Intervention", I get really upset when I consider that the addict in question could be one of my relatives. Often, I would start thinking that they just needed a good beating to fix their brains, but later I realized that it wouldn't fix a thing. The power of the mind outweighs the power of physical violence. To solve an issue one needs to address it eventually even if it is really hard to face it.

The difference between humans and other mammals

roland's picture

The strange thing about humans is that we think we are very different. So here's a collection of similarities and differences between us and mammals:

Yesterday was a very sad day indeed

roland's picture

On March 10, I was driving home from a soccer game and I noticed a cat standing in the divider lane. I stopped, approached, and noticed he was bleeding. He was a tuxedo cat with a white mark on his forehead. One could tell he was a male by the size of head and body.

He was found on 2nd street near the bridge over State Road 37 (or state road 45). Below is the exact location


View Larger Map

I picked up the cat off the road and moved him on the side of the road. Many people stopped but didn't really care too much about the cat, they just wanted to share their stories about cats. Either way, a nice lady who lived by brought a carrier. I called several vets around town: Bloomington Cat Hospital and Combs Veterinary Clinic. They both were unavailable for after hours emergency service, and directed me to a vet in Indianapolis. I used by G1 phone to locate a vet near Ellettsville, IN and I found Arlington Heights Veterinary Hospital who accepted emergency visits.

iPhone Development: Lessons learned

roland's picture

I finally completed an iPhone application. Here are the lessons I leart during the process:

1. The init method in Views is useless.

If you read the programming guides either for the iPhone or Objective c they will tell you that initialization code goes in the init method, which looks like

- (id)init {

    if(self = [super init]) {

         //  Your code goes here

    }

    return self;

}

Growing trends

roland's picture

In this world, the rich get richer, which in return allows them to invest more and get even more richer.

In the web, the popular becomes more pupular which in return allows them to spend more in building more useful tools, which makes them more popular.

In war, the bigger army has less casualties, which allows them to conquer more and pay more to enlist more people, which makes them even bigger.

 

Do you see the snow-ball effect?

UIKit and delegates

roland's picture

It turns out that a delegate is just an object that others can talk to. The following is an extract from the documentation in apple's site as they define what the UIApplication is.

The application object is typically assigned a delegate, an object that the application informs of significant runtime events—for example, application launch, low-memory warnings, and application termination—giving it an opportunity to respond appropriately.

Syndicate content