View Full Version : Video capture card with SPDIF in?


joshpatten
06-11-06, 08:40 PM
Are there any known TV/Video capture cards that have SPDIF input capability and work under linux/MythTv? All card I have seen only have analog inputs.

I have searched far and wide and have come up empty handed. Any input would be greatly appreciated.

junkdomain
07-04-06, 11:51 AM
Try the Hauppauge cards. I believe the WinTV-PVR 150 has an RF/coaxial input, s-video and a composite input.

Neil L
07-04-06, 01:53 PM
Josh,
I'm not sure what you are looking for. S/PDIF is a digital audio format. I don't think you'll find a "video capture" card with that. Now, there are plenty of sound cards with S/PDIF inputs.

super_rouge
01-08-07, 10:29 AM
Josh - excellent question - searching the forum I found this post and would like to restate the question in a similar context.

My Myth setup uses a digital terminal (DCT2524) to my "el cheapo" capture card on my backend - S-Video and RCA stereo line in. Works great - however, I have a sound card that supports SPDIF input as well as output (CMI8738-MC6), and my digital terminal also has SPDIF output. Some programs are broadcast in 5.1 and I'd really like to get that to my myth setup.

Setting up the capture card in mythtv-setup my sound option is of course /dev/dsp. I tried setting to ALSA:default, ALSA:spdif, ALSA:hw:0,2 - the errors I'm getting make me wonder if Mythbackend will even support ALSA or if it only supports the OSS interface (/dev/dsp)?

Anyone ever get SPDIF input to work with mythbackend ?
Thanks.

newlinux
01-08-07, 12:26 PM
I haven't gotten it to work before, but are you sure your spdif input is card 0, device 2 (from ALSA:hw:0,2)? That is probably your spdif output but you may find out by doing:

aplay -l

You can get an idea of your ALSA bindings by looking at the output of

aplay -L

And you may want to confirm that your video card is Card 0 (your sound card probably is)

cat /proc/asound/cards



As I've said, I haven't tried this before, so I can't answer your question about whether or not it can be done, but I'd be interested to know what errors you are getting.

super_rouge
01-08-07, 02:12 PM
Many thanks for your response...

Indeed, device 2 does in fact capture and playback iec958 - while I can't post a url (I don't post a lot so I cannot yet insert URL's in an avsforum post) - if you go to the ALSA wiki, look at the subpage: cmipci - the section on digital I/O clearly points out the second device (hw:0,2) does playback and capture.

Note, SPDIF output works great on the frontend. I just can't get the backend to capture from SPDIF input (only from /dev/dsp)

Note also, to set up the backend to capture from ALSA:spdif rather than /dev/dsp, I had to edit the capturecards table in mysql directly as mythtv-setup keeps trying to change the device back to /dev/dsp.

Running mythbackend with debugging, I see it does not seem to like ALSA. Messages from the backend:

2007-01-08 14:37:01.379 NVR: Error, cannot open DSP 'ALSA:spdif'
open: No such file or directory
2007-01-08 14:37:01.380 NVR: Could not detect audio blocksize

The error is the same with ALSA:hw:0,2 and ALSA:default (set to dmix or hw) - this is why I'm wondering if perhaps only the frontend is ALSA aware? Would be nice to capture a 5.1 stream with the video...

To verify as well:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: CMI8738MC6 [C-Media PCI CMI8738-MC6], device 0: CMI8738-MC6 [C-Media PCI DAC/ADC]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: CMI8738MC6 [C-Media PCI CMI8738-MC6], device 1: CMI8738-MC6 [C-Media PCI 2nd DAC]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: CMI8738MC6 [C-Media PCI CMI8738-MC6], device 2: CMI8738-MC6 [C-Media PCI IEC958]
Subdevices: 1/1
Subdevice #0: subdevice #0


I haven't gotten it to work before, but are you sure your spdif input is card 0, device 2 (from ALSA:hw:0,2)? That is probably your spdif output but you may find out by doing:

aplay -l

You can get an idea of your ALSA bindings by looking at the output of

aplay -L

And you may want to confirm that your video card is Card 0 (your sound card probably is)

cat /proc/asound/cards



As I've said, I haven't tried this before, so I can't answer your question about whether or not it can be done, but I'd be interested to know what errors you are getting.

newlinux
01-08-07, 04:56 PM
My comment was more general since I am not familiar with your sound card. Just wanted to verify. On one of my computers hw:0,1 is the spdif out. I'm pretty sure this is somewhat hardware dependent. For instance, if you had two soundcards, one might be card 0 and the other might be card 1 and on of the digital devices might be hw:1,1. It's not a given that your sound card is even card 1 in all cases.

However aplay -l confirms that you digital port on 0,2.

The :default and :spdif are simply aliases that point to cards and devices. So if they are mapped as you think they are you should see the same errors - at least that makes sense. To see what they are you can do:

aplay -L

I want to make sure I understand your setup. So how many spdif ports do you have? Is it that your sound card spdif has 2 ports, one for in and out? Or that it has just one for both. can you get myth to output from the spdif port you are trying to capture from fine?

Also, are you running frontend on this backend machine at the same time? Perhaps it is having a problem capturing and playback at the same time from the same port (I doubt you are doing this, just checking).

Can you capture spdif input outside of mythtv? If not it may be your ALSA mixer settings.

But it would not surprise me if myth can't do this.

super_rouge
01-08-07, 10:28 PM
Important to note that my ALSA config is default - no special buffering or rate conversions (excepting the default 48000k in dmix-digital). I'm running FC6 - 2869 kernel, latest ALSA and .20 myth. I have tried the .asoundrc on the myth wiki in digitalsound-howto, but everything tends to work fine whether I use the .asoundrc or not - the mixer responds as it should based on the ALSA site. Only exception is that the backend does not appear to like capturing audio from anything except OSS emulation device /dev/dsp.

I have 4 spdif ports - two coaxial and two optical - one set input and one set output. Yes, the mixer provides a 5v option for switching between optical and coax and it does work. The mixer also has an enable IEC958 input option - which also appears to work. My sound quality with arecord for optical input is a separate issue I will try to deal with if I can get mythbackend to accept input from it.

I have multiple frontends, one of them is one the backend. Again though, according to the ALSA wiki, the CMI8738-MC6 is capable of playing iec958 out and capturing iec958 input - so long as the application in question (mythbackend for me) is ALSA aware.

Perhaps I should download the mythbackend source and have a look...
Thanks again for your replies...

...
The :default and :spdif are simply aliases that point to cards and devices. So if they are mapped as you think they are you should see the same errors - at least that makes sense. To see what they are you can do:

aplay -L

I want to make sure I understand your setup. So how many spdif ports do you have? Is it that your sound card spdif has 2 ports, one for in and out? Or that it has just one for both. can you get myth to output from the spdif port you are trying to capture from fine?

Also, are you running frontend on this backend machine at the same time? Perhaps it is having a problem capturing and playback at the same time from the same port (I doubt you are doing this, just checking).

Can you capture spdif input outside of mythtv? If not it may be your ALSA mixer settings.

But it would not surprise me if myth can't do this.

nitrogen
01-08-07, 11:09 PM
My sound quality with arecord for optical input is a separate issue I will try to deal with if I can get mythbackend to accept input from it.

Try raw PCM audio before you try capturing Dolby Digital or MPEG audio. I would recommend getting arecord to record perfectly first, then try recording Dolby Digital (which would require you to make sure that dmix and plug are not used) and converting the ac3-wav to .ac3. Then try setting up myth.

That said, I doubt highly that MythTV has code to detect Dolby Digital audio coming in through a sound card.

super_rouge
01-09-07, 10:24 AM
I was acutally hoping to find out if Myth even supported capturing from IEC958 (DD) first before investing any more time in getting the capture to work perfectly.

While we're on the subject though - I do seem to have a testing problem in that I'm unsure how I might generate a raw PCM stream in the first place - to get my SPDIF in to capture it with arecord? My Digital Terminal is generally producing AC3 through it's digital outs, perhaps I'm missing something?

Regarding mythbackend - I did look at the source - libmythtv has a class called NuppelVideoRecorder (for people like me who don't have a capture card with onboard hardware encoders) - AudioInit only opens "audiodevice" as an OSS device (/dev/dsp). Looking in libmyth - there are a bunch of AudioOutputXXXX classes (alsa, jack, arts, oss, etc...) - but no AudioInput classess. Bummer. Looks like this would be a pretty significant undertaking to incorporate SPDIF capture into MythTV.

Was worth a shot. Maybe I'll inquire on the developers list to see if anyone has ever looked at this...

thanks for the response...

CityK
01-09-07, 02:31 PM
I do seem to have a testing problem in that I'm unsure how I might generate a raw PCM stream in the first place - to get my SPDIF in to capture it with arecord? My Digital Terminal is generally producing AC3 through it's digital outs, perhaps I'm missing something?Instead of using your analog outs on the one computer, just output all sound though the spdif passthrough (use amixer to configure this) and then capture that output on the second computer's digital in using arecord.

nitrogen
01-09-07, 04:46 PM
While we're on the subject though - I do seem to have a testing problem in that I'm unsure how I might generate a raw PCM stream in the first place - to get my SPDIF in to capture it with arecord? My Digital Terminal is generally producing AC3 through it's digital outs, perhaps I'm missing something?

There should be an option in your cable/sat/etc. box to output PCM or RAW audio over the digital ports instead of Dolby Digital. You could also try capturing from another PC as was suggested. You would then simply use arecord -D iec958 -fDAT test.wav (replacing iec958 with whatever alsa calls your SPDIF port, and -fDAT with appropriate sample rate and channel settings). Or, if you have a CD player with digital out, use -fCD.

Regarding mythbackend - I did look at the source - libmythtv has a class called NuppelVideoRecorder (for people like me who don't have a capture card with onboard hardware encoders) - AudioInit only opens "audiodevice" as an OSS device (/dev/dsp). Looking in libmyth - there are a bunch of AudioOutputXXXX classes (alsa, jack, arts, oss, etc...) - but no AudioInput classess. Bummer. Looks like this would be a pretty significant undertaking to incorporate SPDIF capture into MythTV.

Alsa may assign your SPDIF port to another OSS device. I can't recall - did you try /dev/dsp1 or /dev/adsp or similar variations?

Was worth a shot. Maybe I'll inquire on the developers list to see if anyone has ever looked at this...

Let us know what you find out.