Resurrecting old Maaate code
Have you ever been haunted by an old open source package that you wrote once, published, and then forgot about?
The BSD community has just reminded me of the MPEG audio analysis toolkit Maaate that I wrote at CSIRO when I first came to Australia and that was then published through the CSIRO Mathematical and Information Sciences division.
The BSD guys were going to remove it from their repositories, because since I left CSIRO more than 2 years ago, CSIRO has taken down the project pages and the code, so there were no active project pages available any longer. I’m glad they contacted me before they did so.
Since it is an open source project, I have now resurrected the old pages at Sourceforge. They are available from http://maaate.sourceforge.net/. I have re-instated the relevant weg pages and documentation and updated all the links. I discovered that we did some cool things then and that it may indeed be worth preservation for the future. I expect Sourceforge is up to the task.
Thanks very much, BSD community and welcome back, MPEG Maaate!
FOMS submission deadline extended
The Foundations of Open Media Software workshop has just extended its deadline for submission of registrations requests with travel sponsorship.
FOMS addresses hot topics - such as the new <video> and <audio> tags in HTML5, the uptake and development of open video codecs like Ogg Theora, BBC’s Dirac and SUN’s OMS codec and their native support in Firefox, open audio & media frameworks and players such as gstreamer, ffmpeg, vlc or xine, or the standardisation of audio APIs across platforms. Further topics are listed in the CFP.
In previous years, FOMS has stimulated heated technical discussions and amazing new developments in open media software, such as the creation of libsydneyaudio, the uptake of liboggplay, the creation of Xiph ROE, or the creation of the new Ogg CELT codec.
Video proceedings of last years’ workshops are here. There are also community goals that were set in 2008 and 2007 and provide ongoing challenges.
You should definitely attend, if you are an open media software hacker. This is a chance to get to know others in the community personally and clear up those long-standing issues that need a face-to-face to get solved. Also, it’s a great social event not to be missed. As a bonus, you can spend the week after FOMS at LCA, the world-famous Australian Linux hackers conference, and deepen your relationships in the community. Come and join in the fun in January 2009, Summer in Hobart, Tasmania.
Date & Time selection plugins for Rails
I just tried comparing the different date & time selection plugins that are available for Rails and because the wiki page at rubyonrails.org is dated and I cannot edit it, I decided to write this brief blog post to save you the 20 min it took me to locate the currently available plugins and their demos:
- CalendarDateSelect plugin (20k JS): demo - has different colours, small, time selection
- Unobtrusive JavaScript date-picker plugin (80k JS): demo - keyboard control, flexible date selection, i18n
- Datetime Toolbooks engine (85k JS): demo - uses engines plugin, not very pretty, nice built-in drop-down menus, introduces date grammar
- DHTML Calendar plugin (76k JS): demo - flexible parameters to make it popup or selectable
So now you can compare and pick the one that suits you best. Enjoy!
UPDATE: John just told me that there is a list of other plugins at the bottom of the CalendarDateSelect plugin page - doh!
W3C Video in the Web activity
The W3C has just released a set of proposed charters for a new W3C Video in the Web activity with a request for feedback.
The following working groups are proposed:
- Timed Text Working Group
- Media Fragments Working Group
- Media Annotations Working Group
Two further ones under investigation are:
- Codecs and containers
- Best practices for video and audio content
It is worth checking out the site and the three different working groups they are planning to create. Sure - the codec discussion is a big one. But it’s not as big as some of the other activities as to new functionality for video on the Web.
to_bool rails plugin
In our rail application we do a lot of string conversions to other data types, including Boolean. Unfortunately, ruby does not provide a conversion method to_bool (which I find rather strange, to be honest).
Based a blog post by Chris Roos in October 2006, we developed a rails plugin that enables the “to_bool” conversion.
“to_bool” works on the strings “true” and “false” and any capitalisation of these, and on numbers, as well as on nil. Other strings raise an ArgumentError.
Examples are as follows:
'true'.to_bool #-> true
'TrUe'.to_bool #-> true
true.to_bool #-> true
1.to_bool #-> true
5.to_bool #-> true
-9.to_bool #-> true
nil.to_bool #-> false
'false'.to_bool #-> false
'FaLsE'.to_bool #-> false
false.to_bool #-> false
0.to_bool #-> false
You can find the plugin here as a tarball. To install it, simply decompress the to_bool directory into your vendor/plugins directory.
Google Developer Day in Sydney
Today’s Google Developer day in Sydney was quite impressive. There were about 500 developers (and other random folks) there, curious to learn more about the services Google offers. With three parallel breakout rooms for the talks / code labs, there was plenty to choose from.
The introduction was well done, providing a quick overview of all the services and APIs that were the topic of the day - enough to understand what they are and tempt you to attend the in-depth talks.
I attended the Google App Engine talk first - not because I am a fan of python, but because I have an AppEngine account and my son Ben codes in python. I’d really like to play with AppEngine and get Ben to develop something useful (and me to learn some more python on the side). The talk gave a great introduction, which really enthused me. They build this little shout-out app on the fly and published it within the first 10 min. Now, I am collecting ideas for Ben to code up - if you have a neat little one, leave me a note.
I then went on to attend the YouTube talk. It was touted as a 201 presentation, but in the end just provided a cursory overview of the YouTube API. It was a good overview, but since we’ve been working with the API for a long time at Vquence, there was nothing new for me.
At the end of the talk, a developer requested YouTube to provide an API to access the new annotation feature. Since that is still in beta, they will be waiting to harden the technology for a bit before introducing the API. I suggested to them to look at CMML as the XML API. I explained that it would hold any annotation at any time point in any language. The on-screen placement is not currently covered by a tag in CMML, but could be added to the meta tags of the clips. I also suggested that if they found anything to improve on CMML, it would be possible since it’s not a finalized standard. I really hope they will check it out.
After lunch, I attended the two sessions about OpenSocial. I was considering using it for the new Vquence metrics site to do the widget layout. I quickly understood that this is not about layouts, but really about social applications. It would be cool if Ben would think up a social application that he could implement in python and OpenSocial and host in AppEngine. Something that him and his friends could share, maybe? Any ideas for an 11-year-old who learnt python on the OLPC?
At the end of the day, I was curious to learn a bit about Android before having to head home. But I only had a few minutes and the speaker had a slow start (repeating his slides from the introduction session) such that I quickly decided to leave and rather make sure I was at after school care on time!
Overall a worthwhile day - I met some friends, made some contacts, got to ask some questions, and had an awesome lunch with fresh sushi, hmmm. Google really knows how to spoil their developers!
Rails Authorization Plugin
The Rails authorization plugin is a really nice way of providing role management and restrict access to specific features. It also works nicely with the RESTful authentication plugin which manages user login and authentication.
However, there is a serious lack of documentation of how to use this plugin - the README.txt inside the plugin and the source code is the best I have found. I also learnt some from the slides for the Railsconf 2006 on “Metaprogramming Writertopia”. This blog entry is collecting what I have learnt and also freely copies some text from the different sources.
Assuming you have installed the authorization plugin, you need to extend your models with the plugin. In particular the User model and the model(s) that you would like to use multiple user roles for.
class User < ActiveRecord::Base
# Authorization plugin
acts_as_authorized_user
...
end
class Account < ActiveRecord::Base
# Authorization plugin
acts_as_authorizable
...
end
The acts_as_authorized_user part of the plugin creates the following methods for the User model:
- has_role? role_name [, authorizable_obj]: finds out if a user has a certain role (for a certain object)
- has_role role_name [, authorizable_obj]: creates the role if non-existant, and assigns the role to the user (for a certain object)
- has_no_role role_name [, authorizable_obj]: remove role from user (for a certain object), and the role if not in use any longer
As some background information, the plugin creates 2 tables - one for the roles (name, authorizable_type, authorizable_id, timestamps), and one that maps roles to users roles_users (user_id, role_id, timestamps). The authorizable_type and authorizable_id map the role to the authorizable_obj.
The acts_as_authorizable part of the plugin creates the following methods for the Account model:
- accepts_role? role_name, user: finds out if the user has the role on the model
- accepts_role role_name, user: sets the user to have the role on the model
- accepts_no_role role_name, user: removes the user from having the role on the model
In the code, you can now use the following methods to create roles for users and accounts. Assuming we have a user ‘u’ and an account ‘a’, we can do one of the following to create the role ‘admin’:
- u.has_role ‘admin’, a
- a.accepts_role ‘admin’, u
- u.is_admin_for a
- u.is_admin (gives user the role ‘admin’, not tied to a class or object)
To check on roles, you can use the following:
- u.has_role ‘admin’, a: return true/false if the user has the role ‘admin’ on the account
- u.is_admin? a: return true/false if the user has the role ‘admin’ on the account
- u.is_admin_of? a: return true/false if the user has the role ‘admin’ on the account
- u.has_role ‘admin’: return true/false if the user has the role ‘admin’ on anything
- u.is_admin?: return true/false if the user has the role ‘admin’ on anything
- u.is_admin_of_what Account: returns array of objects for which this user is a ‘admin’ (only ‘Account’ type)
- u.is_admin_of_what: returns array of objects for which this user is a ‘admin’ (any type)
- a.accepts_role? ‘admin’, u: return true/false if the account has the user with the role ‘admin’
- a.has_admin(s)?: return true/false if the account has users with the role ‘admin’
- a.has_admin(s): returns array of users which have role ‘admin’ on the account
There are more dynamically generated methods and they are created through the method_missing hook. There is a whole domain-specific language behind this creation of methods. Just about everything that sounds like proper English will work.
An interesting twist is that roles can also be set on model classes: u.has_role 'admin', Account. So, roles can be set on one of the following three scopes:
- entire application (no class or object specified)
- model class
- an instance of a model (i.e., a model object)
In your controller, you can now use two methods to check authorization at the class, instance, or instance method level: permit and permit?. permit and permit? take an authorization expression and a hash of options that typically includes any objects that need to be queried:
def index
if current_user.permit? 'site_admin'
# show all accounts
@account = Account.find(:all)
else
@account = current_user.is_admin_for_what(Account)
end
end
class AccountController < ApplicationController
permit "site_admin and admin", :except => public_page
…
def secret_info
permit “site_admin” do
render :text => “The Answer = 42″
end
end
end
The difference between permit and permit? is redirection.
permit is a declarative statement and redirects by default. It can also be used as a class or an instance method, gating the access to an entire controller in a before_filter fashion. permit? is only an instance method, that can be used within expressions. It does not redirect by default. You will find more information on the boolean expression of the permit or permit? methods here.
Google summer of code
If you’re a student and keen to get more open media technology to the Web, apply for a Google summer of code project with Xiph. There are also a few Annodex-style projects in the mix, which bring annotations and metadata to Ogg.
Your interest could be with javascript, ruby, php, XML, or C no matter - you will find a project at Xiph to suit your favorite programming language.
Of the list of proposed projects, my personal favorite is OggPusher - a browser plugin for transcoding video to Theora. Imagine an online service for transcoding video to Ogg Theora without having to worry about having all the libraries installed.
You also have the chance to propose your own project to the Xiph/Annodex guys - you just need to find somebody who is willing to mentor you, so hop on irc channel #xiph at freenode.net and start discussing.
Incidentally, Google is providing a financial reward for successful conclusion of a project - but don’t let that be your only motivation. If you’re not in it with your passion, don’t do a GSoC project. This is about interacting with an open source community whose goals you can identify with. Become involved!
Metavidwiki gone public
The revolution is here and now! If you thought you’ve seen it all with video web technology, think again.
Michael Dale and Aphid (Abram Stern) have published a plugin for Mediawiki called Metavidwiki which is simply breathtaking.
It provides all of the following features:
- wiki-style timed annotations including links to other resources
- a cool navigation interface for video to annotated clips
- plain text search for keywords in the annotations
- search result display of video segments related to the keywords with inline video playback
- semantic search using speaker and other structured information
- embedding of full video or select clips out of videos into e.g. blogs
- web authoring of mashups of select clips from diverse videos
- embedding of these mashups (represented as xspf playlists)
- works with Miro through providing media RSS feeds
Try it out and be amazed! It should work in any browser - provide feedback to Michael if you discover any issues.
All of Metavidwiki is built using open standards, open APIs, and open source software. This give us a taste of how far we can take open media technology and how much of a difference it will make to Web Video in comparison to today’s mostly proprietary and non-interoperable Web video applications.
The open source software that Metavidwiki uses is very diverse. It builds on Wikipedia’s Mediawiki, the Xiph Ogg Theora and Vorbis codecs, a standard LAMP stack and AJAX, the Annodex apache server extension mod_annodex, and is capable of providing the annotations as CMML, ROE, or RSS. Client-side it uses the capabilities of your specific Web browser: should you run the latest Firefox with Ogg Theora/Vorbis support compiled in, it will make use of this special capability. Should you have a vlc browser plugin installed, it will make use of that to decode Ogg Theora/Vorbis. The fallback is the java cortado player for Ogg Theora/Vorbis.
Now just imagine for a minute the type of applications that we will be able to build with open video APIs and interchangable video annotation formats, as well as direct addressing of temporal and spatial fragments of media across sites. Finally, video and audio will be able to become a key part in the picture of a semantic Web that Tim Berners-Lee is painting - a picture of open and machine-readable information about any and all information on the Web. We certainly live in exciting times!!!
Editing the Skeleton and CMML standards
In the last few weeks, I’ve created an Internet-Draft (I-D - a draft specification of an IETF RFC) for the Ogg Skeleton meta track, and updated the CMML I-D to include a new element called “caption” (CMML DTD). All of this is work that should have been done a long time ago, but I only got the motivation for it through the WHATWG work on HTML5 which will take Ogg Theora and Ogg Vorbis as baseline codecs. Since liboggplay is the key open source library that implements this baseline codec support, and liboggplay supports Annodex, it seems plausible that Annodex (which adds essentially Skeleton + CMML) will be available in Web browsers of the future. So, now is the time to fix up the few open issues that remain and cast the specifications into readable I-Ds.
If you haven’t seen the great functionality that will be available with liboggplay, you should check out the liboggplay javascript API. I’ve seen Shane make a demo web page through which you can toy with the javascript API, but haven’t got the link available right now.