Autor Thema: Alsa? Or how could I capture analog radio/tv  (Gelesen 24572 mal)

Judgin

  • Newbie
  • *
  • Beiträge: 5
    • Profil anzeigen
Alsa? Or how could I capture analog radio/tv
« 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

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8607
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #1 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.
Failure is a good thing! I'll fix it

Judgin

  • Newbie
  • *
  • Beiträge: 5
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #2 am: Oktober 19, 2011, 07:54:56 Vormittag »
Thanks, will try this solution) Looks really easy)

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8607
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #3 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
Failure is a good thing! I'll fix it

Judgin

  • Newbie
  • *
  • Beiträge: 5
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #4 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

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8607
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #5 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.
Failure is a good thing! I'll fix it

Judgin

  • Newbie
  • *
  • Beiträge: 5
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #6 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.

Judgin

  • Newbie
  • *
  • Beiträge: 5
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #7 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(

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8607
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #8 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)
« Letzte Änderung: November 03, 2011, 10:46:28 Nachmittag von Sundtek »
Failure is a good thing! I'll fix it

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8607
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #9 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
Failure is a good thing! I'll fix it

nfgb

  • Newbie
  • *
  • Beiträge: 4
    • Profil anzeigen
Re:Alsa? Or how could I capture analog radio/tv
« Antwort #10 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