Sundtek Support Forum

English => Sundtek MediaTV Pro (Europe) => Thema gestartet von: Judgin am Oktober 18, 2011, 09:53:04 Nachmittag

Titel: Alsa? Or how could I capture analog radio/tv
Beitrag von: Judgin am Oktober 18, 2011, 09:53:04 Nachmittag
Hi guys,

could you help me with capturing analog FM radio? As there is no alsa device (arecord -l shows my sound card) I cannot capture sound...It seems to me, that the same problem will be with analog TV, however I didn't try yet.

Regards, Judgin
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Sundtek am Oktober 19, 2011, 01:58:04 Vormittag
quite easy:

Zitat
cat /dev/radio0 | lame > fmradio.mp3

if you do a cat on radio0 it will also output the WAV header, so lame automatically knows which format the input data is.
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Judgin am Oktober 19, 2011, 07:54:56 Vormittag
Thanks, will try this solution) Looks really easy)
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Sundtek am Oktober 19, 2011, 10:12:11 Vormittag
If you do the cat on the dsp device the output will be header less.

Zitat
cat /dev/dspN | aplay --format=S16_LE --rate=48000 -c 2
or
cat /dev/radioN | aplay

where N is revealed by /opt/bin/mediaclient -e
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Judgin am November 03, 2011, 09:14:25 Nachmittag
Hmmm...I've got problems(((

cat /dev/dsp0 | aplay --format=S16_LE --rate=48000 -c 2
aplay: playback:2455: read error

And this also doesn't work...exits after 1-2 secs.
cat /dev/radio0 | aplay
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Sundtek am November 03, 2011, 09:55:06 Nachmittag
The device needs to be unmated in order to deliver Radio.

Zitat
/opt/bin/mediaclient -m RADIO -d /dev/radio0 --mute=off

afterwards you can read radio.

we might change that in future (applications usually do that).

The Alsa approach would be to use snd-aloop, read the audio stream with cat from dsp and aplay it to the corresponding alsa loopback device. We just figured that out this week and need to document the process for this but it's already doable.
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Judgin am November 03, 2011, 10:05:05 Nachmittag
Thanks for a reply.
Currently it works somehow...but, the sound goes from the headphones/speakers. Is it possible to capture stream directly from /dev/dspX or /dev/radioX without playing through speakers? So, to "silently" capture the radio stream.
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Judgin am November 03, 2011, 10:17:26 Nachmittag
and one more question...is it possible to capture video/audio simultaneously from different tuners? I mean whether I can record tv shows from 2 or more tuners? I got green mplayer screen after starting playback from the second tuner(
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Sundtek am November 03, 2011, 10:42:41 Nachmittag
Silent capture is possible, you can capture and playback at the same time by default.

Following line turns off direct audio playback by the driver:
Zitat
/opt/bin/mediaclient -m RADIO -d /dev/radio0 -c internal


did you start tvtime:
Zitat
mplayer tv:// -tv driver=v4l2:device=/dev/videoN

where videoN should be obtained form "/opt/bin/mediaclient -e"

you can also check which devices are used by running "/opt/bin/mediaclient --lc" (list client)
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: Sundtek am Mai 07, 2012, 09:41:44 Vormittag
How to easily capture analogTV:

Zitat
sudo -s
cd /tmp
wget http://sundtek.de/support/buildffmpeg.sh
chmod 777 buildffmpeg.sh
./buildffmpeg.sh

afterwards restart your PC and open tvtime and tune to the channel which you want to capture.
FFMPEG adds direct encoding support to the driver.

Open a console in the background and just run "cat" with the videonode as parameter.

Zitat
cat /dev/video0 > /tmp/test.mpg
Titel: Re:Alsa? Or how could I capture analog radio/tv
Beitrag von: nfgb am Oktober 20, 2018, 04:19:50 Nachmittag
Hi this url: http://sundtek.de/support/buildffmpeg.sh is no longer available. Can you fix it?

Thanks

How to easily capture analogTV:

Zitat
sudo -s
cd /tmp
wget http://sundtek.de/support/buildffmpeg.sh
chmod 777 buildffmpeg.sh
./buildffmpeg.sh

afterwards restart your PC and open tvtime and tune to the channel which you want to capture.
FFMPEG adds direct encoding support to the driver.

Open a console in the background and just run "cat" with the videonode as parameter.

Zitat
cat /dev/video0 > /tmp/test.mpg