All Posts

Playing video with effects using OpenGL on Android

The trick to playing video with effects on Android is to use OpenGL for actual frame display and then use (API 11+) SurfaceTexture class to render video as a texture on screen. See GitHub for full app demo. The process has two steps: 1. Initialize OpenGL Context to render on a SurfaceTexture Since there is no SurfaceTexture equivalent of GLSurfaceView we have to initialize an OpenGL context manually. In bottom example we initialize OpenGL ES 2.0 context with disabled depth buffer prepared for 2D video rendering. We also define abstract draw metod to be extended with our drawing logic.

Solr slovenian lemmatizer updated with easier installation

I’ve just uploaded 1.1 update for Lemmagen lemmatizer for Solr, which is now a pure Java .JAR library and does not require installation of any additional files on your server. New version also updates package name and configuration attribute to be more consistent.

Lemmagen slovenian lemmatizer available for python

In last days I’ve managed to finish my wrestling with Pythons awful packaging systems and have managed to publish Lemmagen lemmatizer to Python Pypi repository. To install it just run pip install Lemmagen inside your favorite Python/virtualenv environment. Note that installation requires a working C++ compiler for your platform. Then to use it, instantiate Lemmatizer class and call lemmatize() on it. By default the lemmatizer is instantiated with slovenian dictionary, others are avaiable via dictionary keyword argument to the constructor.

Simple article summarization

I’ve been spending my time hacking on my slovenian news parser called news-bus buddy (source on Bitbucket. Since the “recent news” page looked a little empty with only news titles, I needed an algorithm to get summary of an article from database.

Slovene lemmatization in Solr

Apache Solr is a popular full-text search engine with RESTful interface, which makes it perfect search engine with most type of web sites. However, the quality of search results is dependent on language filters, with a good lemmatizer being the most essential. That’s why I’ve created a Solr module, which uses JSIs LemmaGen lemmatizer for Solr index building and search queries. The source to the lemmatizer and module is available on Bitbucket slovene_lemmatizer repository.

Streaming live WebM video with FFmpeg

Streaming WebM to display in browser with HTML5 is currently quite problematic - none of the well-known streaming servers support WebM at the moment. Current popular options are either Java-based stream-m and experimental 2.4-beta release of Icecast. Lesser known option is to use FFmpegs FFserver to stream WebM video. For this to work you need a decently current FFmpeg release (this article was written using stable 1.0 release) compiled with libvpx and ffserver support. New builds for FFmpeg are available for Windows and Linux, however ffserver is available only on Linux.

Speeding up your Android emulator

Pretty much any Android developer has the same complaint: the emulator is slow to start and slower to run, making app testing very annoying. In last Android Development Tools iterations Google implemented several ways to speed up the emulator to make it usable.

Converting UTC struct_time to datetime in Python

Getting from a Python struct_time object holding time in UTC to datetime object with timezone information isn’t as trivial as it should be.

Must-have libraries in modern Android developer toolbox

Android is a platform that for better or for worse runs on wide variety of devices and causes a lot of “fragmentation” complaints by less experienced developers. And while the screen/resolution issues can be decently solved by having a competent designer (see: web development), version fragmentation poses a more significant problem - only 7.1% of all Android devices run 4.x versions, while the rest are suck on older Androids with little hope for update. Android version distribution Ice Cream sandwich (and Honeycomb before it) brought significant improvements to the Android API, which significantly ease cross-device development and thanks to efforts of several developers a large part of those changes were backported in form of libraries for Android 2.x. The most headache-easing libraries for Android development I’ve found so far are:

H.264 web video encoding tutorial with FFmpeg

Web is full of articles about encoding videos with FFmpeg, however most of them are obsolete and use old non-working FFmpeg parameters. So here’s my guide for encoding web videos using recent FFMpeg versions for Flash and HTML5.