February 26, 2009

simple scripting help for air mozilla

As I'm sure at least some of you know, I'm not a programmer -- not even close. So, when I run into even basic scripting tasks, I have to reach out to a colleague, or in this case my readers, and ask for help.

Here's what I'm doing.

For Air Mozilla streaming broadcasts, I've got a DV camera hooked up to a MacBook Pro via FireWire. The MBP is running Ubuntu 8.10. These are the steps I take to stream video to Air Mozilla.

  1. Connect the camera to the laptop and ensure that they're both powered up.
  2. Open a terminal and run the command sudo chmod 777 /dev/raw1394 which prompts for the root password. (This seems to be necessary for the user to get access to the FireWire device.)
  3. Run the command dvgrab --format raw - | ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout - | tee [EVENT NAME].ogv | oggfwd icecast.mozilla.org 80 [PASSWORD] /[CHANNEL NAME].ogv
  4. ctrl+c to stop it all.

I'd like to simplify this so that others in the building can grab the camera and the laptop and stream without having to know any of this.

First, surely it's possible to permanently change permission on the FireWire device or make it so that it automatically gets changed at boot or login. It seems a pretty odd requirement but I don't know how to make the change stick.

Second, I need a simple script that that a user can just double-click on, be promoted for the "event name" (name of the local file that will be saved) the password, and the "channel name" (the name of the stream), hit enter and be streaming live video.

A somewhat more sophisticated script could ask for a quality and size setting, maybe offering a couple of presets.

An even more awesome version would have a simple little GUI so users didn't even have to see the terminal window.

Anyone out there willing to take a stab at this so we can have more Mozillians streaming more live events?

Posted by asa at 4:24 PM

 

reactions, thoughts, comments, etc.

I am happy to help you with this tomorrow if you want.

I can help with the scripting bits. And fixing it so you don't have to fix the permissions every time.

I'm a little surprised that you're not using the gstreamer version.

Posted by: Christopher Blizzard | February 26, 2009 7:09 PM

Blizzard, the gstreamer workflow isn't any prettier :) It looks something like this:

gst-launch-0.10 dev/raw1394 ! queue ! videorate ! video/x-raw-yuv,framerate=15/1 ! videoscale ! video/x-raw-yuv,width=640,height=480 ! ffmpegcolorspace ! theoraenc quality=9 ! queue ! oggmux name=mux alsasrc ! audio/x-raw-int,rate=22050,channels=1,depth=16 ! queue ! audioconvert ! vorbisenc ! queue ! mux. mux. ! fdsink | oggfwd icecast.mozilla.org 80 [PASSWORD] /[CHANNEL NAME].ogg

Posted by: Asa Dotzler | February 26, 2009 8:22 PM

open /dev/ in Nautilus, check which group raw1394 belongs to, then go to system>administration>users and groups , and add your user to that group. That should save you the chmod step.

Posted by: Jonne | February 27, 2009 12:25 AM

Dunno if you still need help with this, but you can install zenity for graphical dialogs. Make a file like this:

#!/bin/sh
event = zenity --entry --title="Event name" --text="Event name"
password = zenity --entry --title="Password" --text="Password for icecast.mozilla.org"
channel = zenity --entry --title="Channel" --text="Channel for icecast.mozilla.org"

dvgrab --format raw - | ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout - | tee $event.ogv | oggfwd icecast.mozilla.org 80 $password /$channel.ogv

I don't know enough Unix to understand about the /dev/fw1394 thing, but you could prompt for the root password with zenity and do the same thing, perhaps

Posted by: iain | March 18, 2009 12:25 AM










Remember personal info?


















asa2008.jpg