Encoding videos for Nokia 770 with GStreamer

Recently I have been traveling a lot. I use to sleep during train/plane/bus travels, but it is not always possible. Also recently I began to watch some TV shows that some friends of mine recommended to me:

  • Alias, by my friend Javi, AKA “Mini Kaster”
  • Desperate Housewives, by my frien Migue, AKA “qu3s0s”
  • Lost, by my friend Andreu, AKA “Aldeart”

So in my travels, when not sleeping it great to watch some of these tv show on my Nokia 770. I was using some scripts based on mplayer or ffmpeg to transcode them to a suitable format for the nokia, but as I wanted to use GStreamer I hacked some bits:

It is an small gst-python application, but if you want to use it, you need some more bits:

  • As nokia770 currently only supports avi, 3gp, mpeg and rm cointainers, you would need the upcoming port of avimuxer to gstreamer-0.10. The patch is for bug #332031, however you current n770 player only wants to demux avis containig “DIVX” fourcc on the avi header. When using mencoder, ffmpeg or transcode there are some hacks to force this fourcc (-ffourcc DIVX for mencoder, -vtag DIVX for ffmpeg or using avifix -F DIVX for transcode). So I added this hack too to this upcoming avimuxer. here is the combined patch against gst-plugins HEAD
  • Also there is a bug on gstreamer videoscale that doesn’t allow you to specify only one of height/witdh and get the other one generated to maintaing pixel-aspect-ratio: bug #338991. However I need to hack again the patch to get it working and also for maintainig both height and witdh being multiple of 16. Of course these size adjustements could be calculated on the transcoder application, but I wanted to use only a simple decodebin without worrying at all of the input file. So here is the combined patch against gst-plugins-base HEAD

Finally here is the python script:gnome-nokia770-encode.py. The UI is HORRIBLE, I just cooked it in some minutes, and the idea is that someone wanting to play with pygtk improve it. Here are some ideas:

  • Make a decent visual design
  • Use gnome-python thumbnail factory to get the thumbnail of the video
  • Add support for command-line options so it could be also a non-interactive script

Send patches!!!.
Many thanks to Thomas, Tim-Philipp Mueller and the other guys on #gstreamer for helping with my dumb questions about gst 🙂

Update:I forgot to mention that also another patch is needed for making the transcode. It fixes a videorate bug which creates an infinite loop when changing fps: bug #339013

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *