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 :)
3D computer animation, travel, film, photography, technology, health, life, inspiration... and a few extra helpings of enthusiasm. ;)
Tuesday, June 18, 2013
Monday, June 17, 2013
OLPC XO Filmmaker progress: Basic GStreamer audio and GTK app
Onwards!! As you can see I am back to it, working again towards my ultimate aim of a video editing application for the One Laptop Per Child program's "XO" laptops. We all know that naming things in Computer Science is hard, so even though I am still a ways away from getting this app done, I've got a name for it. I want to keep it simple, so I'm going to call it, "XO Filmmaker".
As you saw from yesterday's post, I was crazily working last night till 5:00am to get my Windows 7 machine to be a more effective virtualized host for a Fedora VirtualBox "guest" machine.
Things are now finally quite smooth. The biggest problem as I mentioned in yesterday's post was that I had hardcore run out of (virtual) disk space on the Linux virtual machine, and so I couldn't install anything and stuff was generally going haywire. Getting that sorted last night was SWEET. Also I managed to finally get dual-monitor support working on the Linux machine too, which means I can work :) This is all great. Tonight I fixed an issue with the VirtualBox Guest Additions, so now I can freely copy and paste from my Windows machine to the virtualized Linux machine... this is all kindof magic.
Tonight, the main event was to start learning about GStreamer, and make a test program using GLADE (GTK's wysiwyg user interface editing toolkit, like Qt Designer), connected to callbacks inside of Python to GStreamer objects. SUCCESS!!
I followed the great tutorial here:
http://www.jonobacon.org/2006/08/28/getting-started-with-gstreamer-with-python/
So, why is this cool???
Well...
This is basically the foundation of what I am trying to ultimately do, which is a video editing application for the One Laptop Per Child program. For this application I am trying to write, I am ultimately going to need some GTK widgets, probably created via this GLADE tool, and then have them firing events back to Python code (as I am doing here as well). And in the backend, doing most of the work, will be the GStreamer Python library. This example just plays a tone through the sound card, but that's sortof similar to decoding and playing back video files. GStreamer does handle this, which is great. And ultimately, I want to figure out how to use something called GStreamer Editing Services to combine inputted .OGG video files together into a glorious edited result.
Tonight was awesome, and I'm finally feeling like I've got a stable setup here and some good ground to stand on to now move forwards with the actual app writing. There's still a lot of work ahead of me on this, and I'm going at it alone which is a little crazy given my generally busy work schedule and life in general. I could have put together a team for this but I think it's pretty tractable to get it done myself, I just need to keep chipping away at it. I really believe in this, and I want to make sure to get it done. Even if it does take me longer than I'd hope, I'm gonna keep chipping away at it whenever I can sort out larger blocks of time.
Once I get version 1 of XO Filmmaker out to OLPC, I'll upload it on Github for the Open Source community. At that point, I may try to source some more volunteers to help maintain and add new features going forwards, or at least offer up my services as more of a consultant/code-reviewer/project lead kindof role. If any budding young coders want to try to add some new features, I can offer advice/support/guidance which would be super fun too.
Glad to have made some progress and have some idea of how GStreamer works now. This is all quite exciting :)
As you saw from yesterday's post, I was crazily working last night till 5:00am to get my Windows 7 machine to be a more effective virtualized host for a Fedora VirtualBox "guest" machine.
Things are now finally quite smooth. The biggest problem as I mentioned in yesterday's post was that I had hardcore run out of (virtual) disk space on the Linux virtual machine, and so I couldn't install anything and stuff was generally going haywire. Getting that sorted last night was SWEET. Also I managed to finally get dual-monitor support working on the Linux machine too, which means I can work :) This is all great. Tonight I fixed an issue with the VirtualBox Guest Additions, so now I can freely copy and paste from my Windows machine to the virtualized Linux machine... this is all kindof magic.
Tonight, the main event was to start learning about GStreamer, and make a test program using GLADE (GTK's wysiwyg user interface editing toolkit, like Qt Designer), connected to callbacks inside of Python to GStreamer objects. SUCCESS!!
A GLADE user interface (3 buttons) connected to a Python program, running a GStreamer Pipeline |
http://www.jonobacon.org/2006/08/28/getting-started-with-gstreamer-with-python/
So, why is this cool???
Well...
This is basically the foundation of what I am trying to ultimately do, which is a video editing application for the One Laptop Per Child program. For this application I am trying to write, I am ultimately going to need some GTK widgets, probably created via this GLADE tool, and then have them firing events back to Python code (as I am doing here as well). And in the backend, doing most of the work, will be the GStreamer Python library. This example just plays a tone through the sound card, but that's sortof similar to decoding and playing back video files. GStreamer does handle this, which is great. And ultimately, I want to figure out how to use something called GStreamer Editing Services to combine inputted .OGG video files together into a glorious edited result.
Tonight was awesome, and I'm finally feeling like I've got a stable setup here and some good ground to stand on to now move forwards with the actual app writing. There's still a lot of work ahead of me on this, and I'm going at it alone which is a little crazy given my generally busy work schedule and life in general. I could have put together a team for this but I think it's pretty tractable to get it done myself, I just need to keep chipping away at it. I really believe in this, and I want to make sure to get it done. Even if it does take me longer than I'd hope, I'm gonna keep chipping away at it whenever I can sort out larger blocks of time.
Once I get version 1 of XO Filmmaker out to OLPC, I'll upload it on Github for the Open Source community. At that point, I may try to source some more volunteers to help maintain and add new features going forwards, or at least offer up my services as more of a consultant/code-reviewer/project lead kindof role. If any budding young coders want to try to add some new features, I can offer advice/support/guidance which would be super fun too.
Glad to have made some progress and have some idea of how GStreamer works now. This is all quite exciting :)
Sunday, June 16, 2013
Extending the size of a virtual disk in VirtualBox + resizing Linux LVM partitions
Wow, this was complicated.
As part of the OLPC development I've been doing on a Virtualized Fedora machine running from Windows 7, I figured I'd be smart and let VirtualBox manage my disk size. Seems appropriate. But... I set the initial disk size to 8 Gb or something too small to use for Linux and all the stuff I am doing.
So no worries, I should just need to extend the size of the VirtualBox disk up to 20Gb, right? Well, sortof.
That works, but then the Virtual Linux machine has a bunch of unpartitioned space you need to partition. That's cool, and I managed to do that in an active Linux session open. The problem is, I actually want to increase the size of the main "running" partition -- and you can't do that while a disk is running of course.
Enter something fancy called GParted, a partition manager you can boot into using an iso disk image. Pretty sweet: http://gparted.sourceforge.net/download.php
From here, you can get a fancy partition window and it looks great, but wait a sec, my disk is locked!
Apparently these LVM partitions are "locked" and hard to extend. Weird.
But after reading for an hour or so on various Google sites, I found this one which explained very well how to extend an LVM partition. Instead of extending it, I just need to take my new space (that 12Gb drive /dev/sda3), format it to be LVM2 PV format as well, and then "connect" it to the existing drive (/dev/sda2).
This is a great explanation, from this site: http://www.ibm.com/developerworks/library/l-resizing-partitions-2/
GParted can't connect the drives, so I need to open up a terminal in the booted GParted window, and run something called vgextend. This allows me to take the existing "Volume Group" called "fedora" and extend it out to include the new /dev/sda3 drive as well. Wahoo!!
Now the /dev/sda3 drive is also part of the same mount point as /dev/sda2. Now I should stop getting these annoying drive empty errors on my Virtualized Fedora machine... hmm maybe not quite yet. But looks like I'm close ;)
>>Edit: Ok, I figured it out. That excellent IBM page suggested I install something called system-config-lvm. First, I had to uninstall something big (firefox, and deleted some icons and media files). Then I could install it.
This allowed me to see the logical disk setup. There was 12Gb unused space that I could extend my logical drive into. This program also "extended the file system" into this space as well as just extending the logical drive volume. Whew!!!!!!!!!! What a lot of work :)
And now when I look at the Disks utility, I can see the filesystem has increased from 5Gb to 19Gb. Woot!
Man that was hard and interesting and also it's 4:30am and I'm going to sleep. Back to the OLPC software development another day. But for now, it was nice to get the system functioning again, and learn a little more about Linux filesystem management (more than I ever thought I'd want or need to know) at the same time :)
As part of the OLPC development I've been doing on a Virtualized Fedora machine running from Windows 7, I figured I'd be smart and let VirtualBox manage my disk size. Seems appropriate. But... I set the initial disk size to 8 Gb or something too small to use for Linux and all the stuff I am doing.
So no worries, I should just need to extend the size of the VirtualBox disk up to 20Gb, right? Well, sortof.
That works, but then the Virtual Linux machine has a bunch of unpartitioned space you need to partition. That's cool, and I managed to do that in an active Linux session open. The problem is, I actually want to increase the size of the main "running" partition -- and you can't do that while a disk is running of course.
Enter something fancy called GParted, a partition manager you can boot into using an iso disk image. Pretty sweet: http://gparted.sourceforge.net/download.php
From here, you can get a fancy partition window and it looks great, but wait a sec, my disk is locked!
Darn you, LVM partitions |
But after reading for an hour or so on various Google sites, I found this one which explained very well how to extend an LVM partition. Instead of extending it, I just need to take my new space (that 12Gb drive /dev/sda3), format it to be LVM2 PV format as well, and then "connect" it to the existing drive (/dev/sda2).
This is a great explanation, from this site: http://www.ibm.com/developerworks/library/l-resizing-partitions-2/
LVM is a disk allocation technique that supplements or replaces traditional partitions. In an LVM configuration, one or more partitions, or occasionally entire disks, are assigned as physical volumes in a volume group, which in turn is broken down into logical volumes. File systems are then created on logical volumes, which are treated much like partitions in a conventional configuration. This approach to disk allocation adds complexity, but the benefit is flexibility. An LVM configuration makes it possible to combine disk space from several small disks into one big logical volume. More important for the topic of partition resizing, logical volumes can be created, deleted, and resized much like files on a file system; you needn't be concerned with partition start points, only with their absolute size.Strangely, I actually get what's happening after this explanation. I just need to "connect" these 2 drives together, after formatting the unallocated space into LVM2 PV format to match my existing 100% full /dev/sda2 drive.
GParted can't connect the drives, so I need to open up a terminal in the booted GParted window, and run something called vgextend. This allows me to take the existing "Volume Group" called "fedora" and extend it out to include the new /dev/sda3 drive as well. Wahoo!!
Wahoo! |
>>Edit: Ok, I figured it out. That excellent IBM page suggested I install something called system-config-lvm. First, I had to uninstall something big (firefox, and deleted some icons and media files). Then I could install it.
This allowed me to see the logical disk setup. There was 12Gb unused space that I could extend my logical drive into. This program also "extended the file system" into this space as well as just extending the logical drive volume. Whew!!!!!!!!!! What a lot of work :)
First, extend the logical volume into the remaining space. |
Ahh, that looks better! Now the root area is much larger, and actually has some space! |
And now when I look at the Disks utility, I can see the filesystem has increased from 5Gb to 19Gb. Woot!
Back in business |
Tuesday, June 11, 2013
Apple: that was slick
Wow, awesome ad campaign, Apple. http://www.apple.com/designed-by-apple/
Trademark inspiration. Really exciting stuff.
And the keynote was pretty awesome today too. The new iOS 7 design is pretty slick, and it's cool to see they've "modernized" a bit (eg animated backgrounds etc) but staying true to the roots of what iOS means and should "feel like" as they say. Very cool stuff. Excited to try it out.
That Mac Pro looks insanely badass too. I gotta see some 4K desktop screens for myself!!
Trademark inspiration. Really exciting stuff.
And the keynote was pretty awesome today too. The new iOS 7 design is pretty slick, and it's cool to see they've "modernized" a bit (eg animated backgrounds etc) but staying true to the roots of what iOS means and should "feel like" as they say. Very cool stuff. Excited to try it out.
That Mac Pro looks insanely badass too. I gotta see some 4K desktop screens for myself!!
Sunday, June 09, 2013
There Was Magic - Kickstarter film
My brilliant former colleague from Pixar, Afonso Salcedo, is working on a new film and it's on Kickstarter right now. It's a documentary which looks back at a major benefit thrown by Hollywood and the Fashion industry to support people living with AIDS. Looks like a fascinating subject and I'm sure Afonso will tell the story with heart and passion.
Check out his hard work here, and fund via Kickstarter or pass along to friends: