Quest of writing automated video encoder

Introduction (aka rant)

I have a Samsung P3 MP4 player. It’s a mini sized hardware can support FLAC and OGG. Have top grades in places like AnythingButIPod.com

It can watch videos too. So, of course I want to put my anime in it.

Limitations

But, it cannot support MKV, more then 640x480 resolution, codec at very limited parameters. It could only support ASP, Xvid, It does support AVC, but at Level 0.

Everywhere is MKV now. But there are oh so many hardware that have not supported yet. Mine is in the majority too.

I have to go through a lot of programs, mkvCleaver or mkvtoolnix to extract ASS Subtitles, run though a filter to burn it into the video stream, finally re-encode to mp4 container.

Come to think of it, thanks to this bastard hardware, I learnt all about AVC, ASP, Xvid, Profile levels, ASS, MKV & MP4 containers, and everything else.

Limited funding

I have a MacBook Pro 2008, which is Core2Duo processor. My home has a Yorkfield desktop, but it’s solely for my dad.

Being capable of programming and writing scripts, my hacker instinct of mine couldn’t resist hacking up a script to handle batches of mkv.

Current oh-so-laborious method that works

On Mac:

  1. MkvCleaver (windows only, use emulator), to extract subtitles
  2. avidemux with ASS Subtitle filter, resize, encode to AVC (it’s going to be re-encoded anyway, yes is this so wrong)
  3. Handbrake to re-encode to mp4.

Why re-encode?

For some curse reason, Handbrake FFMPEG encoder works on my bastard hardware. avidemux did not.

avidemux’s MPEG4 ASP avcoder, XviD, nor AVC works. It would turn out blocky. I really don’t know why.

I even downloaded both trunks and compare how they called libavcodec and what parameters did Handbrake uses and try to use it on avidemux, but I still could not find the right tweak in avidemux. Argh.

Of Avidemux running in Windows XP 64-bit

As I said earlier, I have a Yorkfield processor desktop used only by my family which is faster?

But, Avidemux often crashes in this OS. Why there is so many obstacles for me just to have a automated encoding script?

Scripted batch file

( 23rd October 2010 ) So, today I have spent the whole day to write a ‘small’ program, that generate batch files to be execute the encoders of my laborious-method at one go.

so far, the frequent crashes is stopping it to get it to work wonderfully.

to be continued..