Howto capture and record anything going to your soundcard with linux+jack+oss2jack
Moving from primarily print to radio journalism I’ve been relearning how to tell stories. I’ve also been forced to add some computer skills to my toolbox.
Some time back I was working on a piece where I wanted to use a sound clip from a movie. This turned out to be a lot harder than I thought. I knew that some rerouting in qjackctl must be the right way to get it done, but I couldn’t get any of the video players to output to jackd. I realized that the development snapshots of mplayer had jack support so I tried to compile that but gut stuck in dependency hell and gave up.
What I ended up doing was dumping the entire audio from the movie to a wav-file using something like
mplayer -ao:pcm:file=/tmp/dump.wav -vo null movie.avi
The tricky part was then to locate the right audio clips, having no video to guide me. Not a lot of fun.
I wanted to be able to rewind, forward, skip parts and then only record a ten second scene. I planned on using two sound cards the next time around. One for playback and the other for capture. That would lead to a degradation of audio quality but so what I figured.
Now it turns out that there is a way of doing it without jack support in mplayer (or whatever other application you want to capture), it’s called oss2jack. This little gem lets any OSS-capable audio application output and input from jack, which just about 100% of all the apps out there.
oss2jack is not in Ubuntu or Debian yet but if your running Ubuntu Feisty you can get it by adding this line to your /etc/apt/sources.list
deb http://neogate.homelinux.org/debian/ feisty sound
Google around for other distros or build it from source.
You should use qjackctl to start the jack server and manage all your connections. Start oss2jack after you’ve started jack and a new entry, oss-dsp, will appear in qjackctl. This is the virtual oss device that you’ll be using for mplayer playback. Just start mplayer or better yet gmplayer with -ao oss to get mplayer to use the virtual oss device.
Now in qjackctl connect the output ports of the oss-dsp to the input ports of the ardour (or whatever application you’re using for recording) track you want to record to and disconnect from the alsa_pcm playback ports.
Thats it!
Oh, almost forgot the obligatory screenshot:

0 Responses to “TotalRecorder on steroids.”
Leave a Reply