Unfortunately, I'm missing the New Orleans Saints vs. Arizona Cardinals NFL playoff game. I'm not a huge NFL fan, but having grown up in Louisiana, I am a Saints fan. And they have had a pretty incredible season.
I scoured the Internet trying to find a live stream, but for various reasons, I couldn't get any of them to work. My mom has a Slingbox setup, and I have gotten that to work under Wine, but I try avoid it whenever possible.
Hence, I hacked this up, which allows me to stream audio over SSH from my MythTV backend at home. I thought I'd document it, in case it's useful to anyone else. Or more likely, to myself some time in the future.
First, I used MythWeb to record the program. While normally I would record this from my HD tuner, for this usage, I want the low-def version, as my bandwidth here in NZ leaves a bit to be desired.
Next, I located the actual path to the file actively being recorded. It was the most recently touched file in my recordings directory. I found it like this:
ls -t /var/lib/mythtv/recordings/*mpg | head -n1Now I just want to extract the audio of this mpg. And my bandwidth is fairly constrained, so I'm going to downsample it from 44KHz to 11KHz too, using ffmpeg:
/var/lib/mythtv/recordings/1002_20100116163100.mpg
tail -f/var/lib/mythtv/recordings/1002_20100116163100.mpg \
| ffmpeg -i - -ar 11025 -f wav /tmp/out.wav
...
Input #0, mpeg, from 'pipe:':
Duration: N/A, start: 3069.045267, bitrate: 6384 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 480x480 [PAR 4:3 DAR 4:3], 6
000 kb/s, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
Output #0, wav, to 'out.wav':
Stream #0.0: Audio: pcm_s16le, 11025 Hz, stereo, s16, 352 kb/s
Stream mapping:
Stream #0.1 -> #0.0
size= 55680kB time=1293.60 bitrate= 352.6kbits/s
Here, I can see the new bitrate is ~350kb/s -> 44KB/s, which is about what I'm getting here in the hotel. So the quality will be a bit lower (more like AM radio), but it shouldn't skip, or pause to buffer.
Now, I just need to get a stream that I can pipe directly into my player. I used sshfs to mount the remote output directory locally
mkdir /tmp/mnt
sshfs remote.example.com:/tmp /tmp/mnt
Finally, I just need to pipe this output to my player, vlc, into its standard in.
cat /tmp/mnt/out.wav | vlc -
And there we have it! Working like a champ. Streaming down-sampled audio from my MythTV back home over SSH, some 15,000 miles away. Who dat!
:-Dustin
You should be able to compress that audio stream to medium quality mp3 or ogg at real-time speeds with most processors from the last 5 years.
ReplyDeleteAlso you actually are decompressing the stream from 384 Kb/s MP2 to 350 Kb/s PCM. If you would have gone with a 22500 Hz , mono, 64 Kb/s CBR MP3 file, you would have similar quality at a lower bit rate.
Awesome, thanks for the advice, Aigars!
ReplyDeleteAny other suggestions, readers?
Does anyone have a similar command that could scale and compress video in real-time?
:-Dustin