Tuesday, June 18, 2013

OLPC XO Filmmaker: Well, I can playback files, sortof

Spent just a couple hours tonight fiddling with GStreamer and GNonLin, their non-linear editing addition.

After a bunch of fiddling and googling like crazy, I managed to find a couple of examples that I could fiddle with further to playback my OGG video files that I recorded using the built-in camera on the OLPC laptop.

The one example I have is playing back my video, which is great. I can't remember now, but I think I got that to play the audio along with it.

The other example I have is playing back 2 splices of 2 different videos (YES!!!!!!), cut together at different start and end points (YESSSSSSSS). But it doesn't have any audio attached, and I'm not sure how the heck to do that. But one thing at a time :)

Obviously I will need to re-write this code and add UI elements etc, but it's good to have some examples to work from because the Documentation for GNonLin is G-Non-Existent (ha). Seriously though, the documentation is epically lacking, and I'm hoping my code can end up being a good example that people can refer to online once it's done.

Tonight I found another great example from the awesome jonobacon, this was a good first start: http://www.jonobacon.org/2006/12/27/using-gnonlin-with-gstreamer-and-python/
His explanations were great, but for the life of me I couldn't get this to playback any audio on my machine Not sure why. I tried a few different filetypes (.OGG, .MP3, etc) but couldn't get any audio playback to work.

After working with this though, I found some cool examples of video playback here:
http://lists.freedesktop.org/archives/gstreamer-devel/2010-September/028407.html
After not-much fiddling, I managed to get a stream which plays back 2 SEPARATE VIDEOS, "cut" together at a supplied start and end time. Fantastic. So that's exactly the sort of thing I want, and ultimately then to save this file (I guess, "encode" it) back to disk. I of course also need to figure out how to get the supplied audio tracks to come along for the ride.

The "scrubbing" in this video works but only across one clip - it freaks out after the first one and then crashes. It's great to have some examples, cause man, the docs for this puppy are hard to come by. I am looking forward to more fiddling with this and getting something together that works... and then pimpin' out the UI some more so it looks easy to use. The main goal here (and the reason I am not just porting the excellent and already-existing PiTiVi Gnome video editor to OLPC) is that this needs to be usable by young kids - that's the audience of OLPC. So the workflow needs to be hyper-intuitive and as simple as possible. As little English wording as possible too because the more internationalized I can be from the start, the less I need to hope that people around the world write translation modules for me.

But first, the technology. Python rocks and I know it super well, but this GStreamer and GNonLin API is "hella verbose" and I'm sure glad for guys like jonobacon who is helping to make it easier to get over the initial learning curve. Once I see a few more examples and fiddle some more, I think I'll start making more progress. But it sure was cool tonight to see 2 clips merged together in one playback window. That I envision would be a "video project" that kids would compile together from existing clips (a.l.a. a very simplified version of iMovie). To save that to a file then, I think I just need to somehow attach an "encoder" to the end of the GStreamer pipeline.

Onwards!
Mike :)

No comments:

Post a Comment