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:

/captures/mrcut.png

(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

Neat!

You might want to compare to the remuxer in the python examples. I wrote about it here, at the end: http://wingolog.org/archives/2006/05/26/tape-ate-the-player

Comment by Andy Wingo on July 1, 2007 13:14

Thanks for the note Andy; if only I had seen the remuxer before..., it is almost what I needed, I'll probably rewrite my code to be based on it.

Comment by Frédéric Péters on July 1, 2007 14:18

These little apps are really very USEFUL to normal people that don't know gstreamer commandline, I think they should be put in some visible place like gnomefiles.org or packaged for distros because, for example, in windows you find a lot of these small-useful-utilities but not in linux.

Comment by gnome fan on July 1, 2007 14:37

You could try and see if marlin can deal with it...the version in gnome svn obviously. it'll probably require a lot of disk space tho

Comment by iain on July 2, 2007 0:38

"These little apps are really very USEFUL to normal people that don't know gstreamer commandline, I think they should be put in some visible place like gnomefiles.org or packaged for distros because, for example, in windows you find a lot of these small-useful-utilities but not in linux."

I agree. I wonder if someone can make a video-cut version of this too and get it into the Debian repositories.

Comment by J on July 2, 2007 1:51

Any chance to also post it at www.GtkFiles.org ?

Comment by Anonymous on July 2, 2007 4:03

:-( /bzr/mrcut is empty now.

Comment by Denis on August 24, 2007 11:12

Not empty, bzr repositories just appear that way; I enabled webserve so it show there is something in it...

Comment by Frédéric Péters on August 24, 2007 11:41

Comments on this entry have been closed.