Introducing Mr Cut
Sunday, July 1, 2007 12:23 - GNOME
Imagine the scene, it is Friday afternoon at the radio, an animator picks up the recording of last night emission to prepare a new broadcast, but oops, the recording didn't stop and has been running for almost a day. Usual tools won't cut it (pun intended), playing with Audacity and Jokosher doesn't yield any positive results (but a disk full), dd helps to reduce it to three hours but even that file is too large for our old computers to load.
And so I get back home early in the evening with the following mission: broadcasting that emission on Monday morning. I quickly write a GStreamer pipeline, testing the seeks with audio output:
# prepare pipeline # ... filesrc location=".." ! oggdemux ! vorbisdec ! audioconvert ! alsasink' # when it get in state PAUSED, seek to start, note the end, and play ev = gst.event_new_seek(1.0, gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH | gst.SEEK_FLAG_ACCURATE, gst.SEEK_TYPE_SET, start, gst.SEEK_TYPE_SET, end) pipeline.set_state(gst.STATE_PLAYING) pipeline.send_event(ev)
And it works fine, I am listening to the right part of the file, and it stops at the right moment. I replace the alsasink by reencoding elements, writing to a new file:
... ! vorbisenc ! oggmux ! filesink location="..."
And it produces the original file, in all its length, aargh.
It is still Friday early evening, it is 20h06 and I look at gnonlin and the audioconcat.py example. Looks easy enough. Done. My code is then a quite ugly copy and paste but it is 20h13 and the emission is correctly cut. Hooray for GStreamer (and file timestamps since I didn't get my eyes on a clock that evening). Let's get out.
night goes on
It is now Saturday morning, I decide to replace the command line interface by a little GUI. I code that up but have to go, from Spain we got GStreamer but we also got the Cyclonudista! let's show how fragile we are on our bicycle in the city with all those cars by cycling naked. Quite a success.
And then it is now Sunday morning and I finish remaining parts of the interface, add a progress bar and such niceties, find a name and call it done. Here is Mr Cut:
(published as bzr branch on http://www.0d.be/bzr/mrcut/ (but the code is currently horrible))
(update at 15:36: rewrote using remuxer.py, pointed and written by Andy Wingo, thanks)
Last Modification: Tuesday, December 25, 2007 21:18
Comments on this entry have been closed.