Custom Search

Friday, August 17, 2007

Multimedia on OpenBSD

Been a while since a posting. Been trying to learn how to
rip and burn dvds. When the content is equal or smaller
than single-layer size, 4.7GB, it's been a breeze, using
dvdbackup. But, a marjority of dvd content is larger than
that. In that case, I've mostly used streamanalyze, lsdvd
and tcprobe to look into the dvd structure; streamdvd and
dvdauthor to rip and then restructure the content to be
burned. For burning, I've been using growisofs. There have
been instances where nothing worked for me. I could rip the
dvd but not just the one title with just its chapters and
audio, so I never even got to the point where I could shrink
it to fit on a single-layer. Streamdvd choked on the dvd's
structure, sometimes dumping its core.

I've had good luck with radio programs. I love to listen
to several that come on late at night, but if I have to get
up early, that's out. So, I have a small program I call from
a cronjob in a script with the url of the program. It takes
an integer after it for the number of minutes it should run
mplayer, streaming in the audio and dumping it to mp3. Here's
the code for it. Just compile it with gcc. Name the outfile
whatever you want.

------------------

#include
#include
#include
#include
#include
#include

extern char *__progname;

/* This program self destructs after a specified time */
int main(int argc, char **argv) {

int ret;
long minutes;
struct timeval t, t2;
pid_t child;
if (argc < 3) {
printf("Usage: %s \n",
__progname);
exit(128);
/* NOT REACHED */
}


if ( (child = fork()) != 0) {
/* I am the parent process */
minutes = strtol(argv[1], NULL, 10);
sleep(60 * minutes);


/* I am done! */
kill(child, SIGINT);
exit(0);

} else {
/* I am the child */
execv("/usr/local/bin/mplayer", argv + 1);

exit(0);
}
}

------------------

Here's an example script to call from a cron job
to record your radio program, assuming you named
the compiled output of the above code to streamdump.
And, make sure it's in your path, like mine is ~/
or somewhere like /usr/local/bin.

------------------

#!/bin/sh
#
# script called from a cronjob to save an audiocast
~/streamdump 120 -dumpstream mms://adressofstream \
-dumpfile /data/xxx/mp3/show/`date +"%Y%m%d"`xxx.mp3
#

Streamdump runs mplayer 120 minutes, dumps the stream
into the dumpfile switch which saves the output to a
directory in mp3 format. the `date +"%Y%m%d"` adds the
date on the frontend of xxx.mp3 to make your shows
easier to keep track of. In the url, it may be something
other than mms like http or whatever. You'll have to find
that out from where you're streaming from.

------------------

That's it from the coast for right now. Have to get
started trying a different print setup on my bsd boxes.
I've always been lazy before, being setup to just print
text via a network shared printer on my windows box.
Anything graphic I did directly from the windows box.
I have a Deskjet 722C printer. It was part of a short-
lived series of printers HP put out. The only driver
I've ever had that works with it has been:

HP-DeskJet_722C-pnm2ppa.ppd

Got that from linuxprinting.org a long while back.
Here's what my /etc/printcap has looked like up until
now:

# $OpenBSD: printcap,v 1.4 2003/03/28 21:32:30 jmc Exp $
lp|windows line printer:\
:rp=HPDeskJet:\
:rm=dancer:\
:af=/etc/foomatic/HP-DeskJet_722C-pnm2ppa.ppd:\
:if=/usr/local/bin/foomatic-rip:\
:sd=/var/spool/output:\
:mx#0:\
:sh

But, I can't print from firefox or the gimp like this.
So, I'm going to try installing apsfilter and see how
it goes. I once read an old nix hand's opinion of bsd
printing, describing it as a convoluted zen-like
experience. ;) That's pretty much been my experience!

powered by performancing firefox

Labels: