Difference between revisions of "MythTV Hardware- Hauppauge USB Live-2"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
 
The Hauppauge USB Live-2 is a USB 2.0 capture device without a TV tuner.  It has both composite and S-video inputs.  It also has stereo audio inputs.  It has never been fully supported in Linux, however, new kernels have some degree of support.  The chipset in the device has been revised at least twice.  Success with the device may depend on which encoder chip is present.
 
The Hauppauge USB Live-2 is a USB 2.0 capture device without a TV tuner.  It has both composite and S-video inputs.  It also has stereo audio inputs.  It has never been fully supported in Linux, however, new kernels have some degree of support.  The chipset in the device has been revised at least twice.  Success with the device may depend on which encoder chip is present.
  
== driver and system recognition ==
+
=== driver and system recognition ===
  
 
The driver will be loaded by the kernel during boot.  When the system is up, use the command lsusb to see the device.
 
The driver will be loaded by the kernel during boot.  When the system is up, use the command lsusb to see the device.
Line 24: Line 24:
 
You may observe no video, green video, or flickering partial video in your video player.  USB ports may become inactive.  If you have a USB mouse connected to the system you may lose use of the mouse as the USB ports will become non-functional until reboot.  Again, disabling SuperSpeed or USB 3.0 in BIOS will often serve as a workaround.
 
You may observe no video, green video, or flickering partial video in your video player.  USB ports may become inactive.  If you have a USB mouse connected to the system you may lose use of the mouse as the USB ports will become non-functional until reboot.  Again, disabling SuperSpeed or USB 3.0 in BIOS will often serve as a workaround.
  
== testing video input ==
+
=== testing video input ===
  
Once in Xfce you can test to see if you are able to receive video from a composite source via the USB Live-2.  For basic testing purposes mplayer serves well.  You will want to make sure that the driver loaded by using lsusb as described earlier.  A device should have been created in /dev as /dev/video0 or if you have other capture cards it could be /dev/video1 or higher.  Confirm which video device belongs to your USB Live 2.  For our example we will assume /dev/video0
+
Once in Xfce you can test to see if you are able to receive video from a composite source via the USB Live-2.  For basic testing purposes [[mplayer]] serves well.  You will want to make sure that the driver loaded by using lsusb as described earlier.  A device should have been created in /dev as /dev/video0 or if you have other capture cards it could be /dev/video1 or higher.  Confirm which video device belongs to your USB Live 2.  For our example we will assume /dev/video0
  
 
From the command prompt in a console window type the following:
 
From the command prompt in a console window type the following:
 
  mplayer tv:// -tv driver=v4l2:device=/dev/video0:norm=NTSC:width=720
 
  mplayer tv:// -tv driver=v4l2:device=/dev/video0:norm=NTSC:width=720
  
mplayer will complain that there is no TV Tuner (because of the -tv switch) however this will not prevent video from being displayed.  Specifying width= can be substituted with a width you prefer based on your resolution.  You should now see video from your source.  
+
[[mplayer]] will complain that there is no TV Tuner (because of the -tv switch) however this will not prevent video from being displayed.  Specifying width= can be substituted with a width you prefer based on your resolution.  You should now see video from your source.  
  
 
Please note that the indicator lights on the USB Live 2 device will not illuminate nor will they blink during testing.
 
Please note that the indicator lights on the USB Live 2 device will not illuminate nor will they blink during testing.
Line 44: Line 44:
 
I guess if the dev lives in Europe he is going to assume everyone uses PAL.
 
I guess if the dev lives in Europe he is going to assume everyone uses PAL.
  
== testing audio input ==
+
=== testing audio input ===
  
 
Install PulseAudio Volume Control.   
 
Install PulseAudio Volume Control.   
Line 74: Line 74:
 
Now it is with picture and sound.   
 
Now it is with picture and sound.   
  
== more testing with mplayer ==
+
=== more testing with mplayer ===
  
Note: If you see a green picture with flickering lines at the top, then mplayer is attempting to play an NTSC video as PAL.  Again, the dopey kernel driver assumes PAL unless you specify NTSC.  You can see the problem in dmesg:
+
Note: If you see a green picture with flickering lines at the top, then [[mplayer]] is attempting to play an NTSC video as PAL.  Again, the dopey kernel driver assumes PAL unless you specify NTSC.  You can see the problem in dmesg:
  
 
  cx231xx #0: do_mode_ctrl_overrides PAL
 
  cx231xx #0: do_mode_ctrl_overrides PAL
Line 97: Line 97:
 
  sudo apt-get install gnome-mplayer
 
  sudo apt-get install gnome-mplayer
  
If you have the ~/.mplayer/config configured for mplayer it will be used by gnome-mplayer also.  You will need to do this because gnome-mplayer won't accept the -tv switch from the command line and will also try to default to PAL.  Now launch gnome-mplayer:
+
If you have the ~/.mplayer/config configured for [[mplayer]] it will be used by gnome-mplayer also.  You will need to do this because gnome-mplayer won't accept the -tv switch from the command line and will also try to default to PAL.  Now launch gnome-mplayer:
 
  gnome-mplayer tv://
 
  gnome-mplayer tv://
  
Line 104: Line 104:
 
Now you can use gnome-mplayer gui frontend for mplayer as well as mplayer command line to get video and sound from the Hauppauge USB Live-2.  See also: [https://wiki.manjaro.org/index.php?title=Configure_mplayer_the_right_way Configure mplayer the right way]
 
Now you can use gnome-mplayer gui frontend for mplayer as well as mplayer command line to get video and sound from the Hauppauge USB Live-2.  See also: [https://wiki.manjaro.org/index.php?title=Configure_mplayer_the_right_way Configure mplayer the right way]
  
== Testing with VLC (Video LAN Player) ==
+
=== Testing with VLC (Video LAN Player) ===
  
To show the a/v stream using [[VLC]] instead of mplayer execute the command:
+
To show the a/v stream using [[VLC]] instead of [[mplayer]] execute the command:
 
  vlc v4l2:///dev/video0:standard=NTSC
 
  vlc v4l2:///dev/video0:standard=NTSC
 
If the last time the input was displayed was NTSC then vlc will default to NTSC with just  vlc v4l2:///dev/video0
 
If the last time the input was displayed was NTSC then vlc will default to NTSC with just  vlc v4l2:///dev/video0
Line 113: Line 113:
  
  
== Adding to MythTV backend configuration ==
+
=== Adding to MythTV back-end configuration ===
 +
 
 +
MythTV is designed to work with capture devices that have tuners.  [http://www.gossamer-threads.com/lists/mythtv/users/140368 Our device has no tuner] so it has to be configured in an irregular way that is not as well supported by the MythTV devs.  First review pertinent information from their documentation.
 +
 
 +
<small>From the MythTV Wiki: [http://www.mythtv.org/wiki/MythTV-HOWTO_-_0.26#Capture_Cards Capture Cards]
 +
 
 +
''You should have no capture cards defined, so the highlight will be on (New Capture Card). Press space to begin.
 +
 
 +
Choose the appropriate settings for your particular tuner. Use the arrow keys to move around and to make your choices, and press RETURN when complete. Pressing RETURN will take you back to the Capture Cards screen; if you have additional capture cards in this machine, press the space bar when the highlight is on the (New Capture Card) row to define another card.
 +
 
 +
If you have made a mistake, you can delete a card by highlighting it and pressing the 'D' key, or you can highlight it and press the RETURN or 'E' key to edit it.''
 +
 
 +
From the MythTV Wiki: [http://www.mythtv.org/wiki/MythTV-HOWTO_-_0.26#Video_Sources Video Sources]
 +
 
 +
''When you start, the highlight should be on (New Video Source). Press the space bar to begin. The first field asks for the name of the video source. You may choose something easy to remember, like "Antenna" or "Cable". Once you've chosen a name, press the down arrow to move to the next field.''
 +
 
 +
From the MythTV Wiki: [http://www.mythtv.org/wiki/MythTV-HOWTO_-_0.26#Input_Connections Input Connections]
 +
 
 +
''On this screen, you will associate the various video sources you defined earlier with a physical input to a encoder card. It's entirely possible that you have multiple tuners, and each tuner has a different input, so on this screen you let MythTV know which device will connect to which input source. Don't add a video source to a hardware input if you don't actually have anything connected there. For example, adding "Cable" to the Tuner and to the Composite inputs without having something connected to Composite will lead to blank recordings.'' </small>
 +
 
 +
Launch the backend setup
 +
$ mythtv-setup
 +
Answer "Yes" when prompted to close the backend server. Enter the password.
 +
 
 +
*Capture Card Setup
 +
:*Card type: Analog to MPEG-2 encoder card (PVR-150/250/350,etc)
 +
:*Video device: /dev/video0
 +
:*Probed info: <nowiki>Hauppauge USB Live 2 [cx231xx]</nowiki>
 +
:*VBI device: ''(leave this blank - it is for closed caption)''
 +
:*Tuning timeout (ms): 6000
 +
 
 +
* Video sources
 +
:* Video source name: VCR ''(call it what you want, VCR is just an example name)''
 +
:* Listings grabber: ''(choose something temporarily such as North America)''
 +
:* Channel frequency table: default
 +
:* Network ID: -1
 +
 
 +
* Input connections (choose composite)
 +
:*Capture device: <nowiki>[MPEG:/dev/video0]</nowiki>
 +
:*Input: Composite1
 +
:*Display name:
 +
:*Video source: VCR
 +
:*External channel change command:
 +
:*Preset tuner to channel:
 +
:*Starting channel:
 +
 
 +
We left some things blank in Input connections that we will go back and fill later.  Now exit mythtv-setup and DO NOT run mythfilldatabase.  We have to use mysql to add a dummy channel.  Your mysql admin login will be the same as your mythtv user password
 +
 
 +
mysql -p
 +
mysql> use mythconverg;
 +
mysql> update videosource set xmltvgrabber = NULL where sourceid=1;
 +
mysql> insert into channel (chanid, channum, sourceid) VALUES (1001,1,1);
 +
 
 +
What we did here was first inside the "videosource" table we set the xmltvgrabber for our new video source to NULL.  If your sourceid is something other than 1 then adjust accordingly.
 +
 
 +
We also made a dummy or placeholder channel in the channel table so that the MythTV front-end has a channel it believes it is turning to when capturing from the USB Live-2.  This is a hack to deal with the fact that our device has no tuner.  The important fields are chanid, channum and sourceid.  You choose whatever unique channum you want.  The sourceid has to match that in videosouce table.  [http://www.gossamer-threads.com/lists/mythtv/users/44731 The chanid is a calculated field]: (sourceid * 1000) + channum
 +
 
 +
Now you can exit mysql and go back into
 +
$ mythtv-setup
 +
 
 +
* Video sources
 +
:* Video source name: VCR ''(call it what you want, VCR is just an example name)''
 +
:* Listings grabber: '''No grabber'''
 +
:* Channel frequency table: default
 +
:* Network ID: -1
 +
 
 +
* Input connections (choose composite)
 +
:*Capture device: <nowiki>[MPEG:/dev/video0]</nowiki>
 +
:*Input: Composite1
 +
:*Display name: VCRSource
 +
:*Video source: VCR
 +
:*External channel change command:
 +
:*Preset tuner to channel: '''1'''
 +
:*Starting channel: '''1'''
 +
 
 +
Exit the backend setup and this time go ahead and let it run mythfilldatabase.
 +
 
 +
Open the MythTV frontend.  You will know we have accomplished something when it confirms that we are connected to the backend.
 +
 
 +
Choose "Watch TV" to test...
 +
 
  
 
''So far unsuccessful.  In progress..''   
 
''So far unsuccessful.  In progress..''   

Latest revision as of 12:25, 7 March 2015

The Hauppauge USB Live-2 is a USB 2.0 capture device without a TV tuner. It has both composite and S-video inputs. It also has stereo audio inputs. It has never been fully supported in Linux, however, new kernels have some degree of support. The chipset in the device has been revised at least twice. Success with the device may depend on which encoder chip is present.

driver and system recognition

The driver will be loaded by the kernel during boot. When the system is up, use the command lsusb to see the device.

Example:

# lsusb
Bus 002 Device 002: ID 174c:3074 ASMedia Technology Inc. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 09da:0006 A4 Tech Co., Ltd Optical Mouse WOP-35 / Trust 450L Optical Mouse
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 005: ID 2040:c200 Hauppauge 
Bus 001 Device 002: ID 174c:2074 ASMedia Technology Inc. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here the device can be seen as Device 005 with the label "Hauppauge."

You will have better luck connecting this device to a USB 2.0 port than a USB 3.0 port. There is a bug in the linux kernel known as the "USB Shutdown Bug" which impacts machines that have both USB 2.0 and USB 3.0 ports. It is recommended that you disable support for USB 3.0 in the system BIOS.

If you are specifically impacted by the "USB Shutdown Bug" you will notice errors in "dmesg" such as:

xhci_hcd ERROR Transfer event TRB DMA ptr not part of current TD

You may observe no video, green video, or flickering partial video in your video player. USB ports may become inactive. If you have a USB mouse connected to the system you may lose use of the mouse as the USB ports will become non-functional until reboot. Again, disabling SuperSpeed or USB 3.0 in BIOS will often serve as a workaround.

testing video input

Once in Xfce you can test to see if you are able to receive video from a composite source via the USB Live-2. For basic testing purposes mplayer serves well. You will want to make sure that the driver loaded by using lsusb as described earlier. A device should have been created in /dev as /dev/video0 or if you have other capture cards it could be /dev/video1 or higher. Confirm which video device belongs to your USB Live 2. For our example we will assume /dev/video0

From the command prompt in a console window type the following:

mplayer tv:// -tv driver=v4l2:device=/dev/video0:norm=NTSC:width=720

mplayer will complain that there is no TV Tuner (because of the -tv switch) however this will not prevent video from being displayed. Specifying width= can be substituted with a width you prefer based on your resolution. You should now see video from your source.

Please note that the indicator lights on the USB Live 2 device will not illuminate nor will they blink during testing.

The driver dev made it default to PAL. This is annoying if you are in North America. norm=NTSC will force it to NTSC however if you observe dmesg you will see it tries PAL then NTSC.

cx231xx #0: do_mode_ctrl_overrides : 0xff
cx231xx #0: do_mode_ctrl_overrides PAL
cx231xx #0: do_mode_ctrl_overrides : 0xb000
cx231xx #0: do_mode_ctrl_overrides NTSC

I guess if the dev lives in Europe he is going to assume everyone uses PAL.

testing audio input

Install PulseAudio Volume Control.

apt-get install pavucontrol

PulseAudio Volume Control will show at least 2 devices under the "Configuration" tab. The first device will be your sound card or built-in audio. The second device will be for the USB Live-2. It will be labeled "Cx231xx Audio" as it is using the hacked Cx231xx kernel driver. For an example you might see:

  • Built-in Audio
  • Profile: Analog Stereo Output
  • Cx231xx Audio
  • Profile: Ama;pg Stereo Input

If you click on the "Input Devices" tab you should see, at the top, "Cx231xx Audio Analog Stereo" and below that...

  • Cx231xx Audio Analog Stereo
  • Port: Analog Input

You will see the horizontal bar fluctuating indicating input sound (if your source has sound) but you will not hear any audio. THis is because there is a "pulseaudio module-loopback" which is not automatically loaded nor can it be loaded though the graphical interface. To add the loopback module to the running instance of Pulse Audio issue the command:

pactl load-module module-loopback

To make the module auto load issue the command:

sudo sh -c ' echo "load-module module-loopback" >> /etc/pulse/default.pa '

Once module-loopback is loaded the pulse audio Volume Control panel will add an option to the Recording tab that allows selection to use on the loopback device.

reference: pulseaudio and saa7134 audio device

No additional audio related parameters were necessary to use on the mplayer command line for the test.

mplayer tv:// -tv device=/dev/video0:norm=NTSC

Now it is with picture and sound.

more testing with mplayer

Note: If you see a green picture with flickering lines at the top, then mplayer is attempting to play an NTSC video as PAL. Again, the dopey kernel driver assumes PAL unless you specify NTSC. You can see the problem in dmesg:

cx231xx #0: do_mode_ctrl_overrides PAL

It is useful to create a configuration file for mplayer with the defaults you use for your USB Live-2. Create or edit the mplayer config file. It is typically located at: /home/username/.mplayer where "username" is your username for mythtv. Mythbuntu creates an empty file for you. You can edit it.

vi ~/.mplayer/config 

Add the following to your config file (including the comment text that is already present).

# Write your default config options here!

[protocol.tv]
zoom = yes
vo = x11
tv = "driver=v4l2:device=/dev/video0:norm=NTSC"
monitoraspect = "4:3"

Customize to suite your system config. Now you don't have to specify command line parameters when running mplayer. Start mplayer to view from your USB source:

mplayer tv://

We can test using gnome-mplayer which is the graphical gnome version part of the deb package gnome-mplayer installed via the command:

sudo apt-get install gnome-mplayer

If you have the ~/.mplayer/config configured for mplayer it will be used by gnome-mplayer also. You will need to do this because gnome-mplayer won't accept the -tv switch from the command line and will also try to default to PAL. Now launch gnome-mplayer:

gnome-mplayer tv://

You may get prompted to "Resume Playback of Video X input at 0:00" - say "no."

Now you can use gnome-mplayer gui frontend for mplayer as well as mplayer command line to get video and sound from the Hauppauge USB Live-2. See also: Configure mplayer the right way

Testing with VLC (Video LAN Player)

To show the a/v stream using VLC instead of mplayer execute the command:

vlc v4l2:///dev/video0:standard=NTSC

If the last time the input was displayed was NTSC then vlc will default to NTSC with just vlc v4l2:///dev/video0

When vlc is closed, the sound continues to play.


Adding to MythTV back-end configuration

MythTV is designed to work with capture devices that have tuners. Our device has no tuner so it has to be configured in an irregular way that is not as well supported by the MythTV devs. First review pertinent information from their documentation.

From the MythTV Wiki: Capture Cards

You should have no capture cards defined, so the highlight will be on (New Capture Card). Press space to begin.

Choose the appropriate settings for your particular tuner. Use the arrow keys to move around and to make your choices, and press RETURN when complete. Pressing RETURN will take you back to the Capture Cards screen; if you have additional capture cards in this machine, press the space bar when the highlight is on the (New Capture Card) row to define another card.

If you have made a mistake, you can delete a card by highlighting it and pressing the 'D' key, or you can highlight it and press the RETURN or 'E' key to edit it.

From the MythTV Wiki: Video Sources

When you start, the highlight should be on (New Video Source). Press the space bar to begin. The first field asks for the name of the video source. You may choose something easy to remember, like "Antenna" or "Cable". Once you've chosen a name, press the down arrow to move to the next field.

From the MythTV Wiki: Input Connections

On this screen, you will associate the various video sources you defined earlier with a physical input to a encoder card. It's entirely possible that you have multiple tuners, and each tuner has a different input, so on this screen you let MythTV know which device will connect to which input source. Don't add a video source to a hardware input if you don't actually have anything connected there. For example, adding "Cable" to the Tuner and to the Composite inputs without having something connected to Composite will lead to blank recordings.

Launch the backend setup

$ mythtv-setup

Answer "Yes" when prompted to close the backend server. Enter the password.

  • Capture Card Setup
  • Card type: Analog to MPEG-2 encoder card (PVR-150/250/350,etc)
  • Video device: /dev/video0
  • Probed info: Hauppauge USB Live 2 [cx231xx]
  • VBI device: (leave this blank - it is for closed caption)
  • Tuning timeout (ms): 6000
  • Video sources
  • Video source name: VCR (call it what you want, VCR is just an example name)
  • Listings grabber: (choose something temporarily such as North America)
  • Channel frequency table: default
  • Network ID: -1
  • Input connections (choose composite)
  • Capture device: [MPEG:/dev/video0]
  • Input: Composite1
  • Display name:
  • Video source: VCR
  • External channel change command:
  • Preset tuner to channel:
  • Starting channel:

We left some things blank in Input connections that we will go back and fill later. Now exit mythtv-setup and DO NOT run mythfilldatabase. We have to use mysql to add a dummy channel. Your mysql admin login will be the same as your mythtv user password

mysql -p
mysql> use mythconverg; 
mysql> update videosource set xmltvgrabber = NULL where sourceid=1;
mysql> insert into channel (chanid, channum, sourceid) VALUES (1001,1,1);

What we did here was first inside the "videosource" table we set the xmltvgrabber for our new video source to NULL. If your sourceid is something other than 1 then adjust accordingly.

We also made a dummy or placeholder channel in the channel table so that the MythTV front-end has a channel it believes it is turning to when capturing from the USB Live-2. This is a hack to deal with the fact that our device has no tuner. The important fields are chanid, channum and sourceid. You choose whatever unique channum you want. The sourceid has to match that in videosouce table. The chanid is a calculated field: (sourceid * 1000) + channum

Now you can exit mysql and go back into

$ mythtv-setup
  • Video sources
  • Video source name: VCR (call it what you want, VCR is just an example name)
  • Listings grabber: No grabber
  • Channel frequency table: default
  • Network ID: -1
  • Input connections (choose composite)
  • Capture device: [MPEG:/dev/video0]
  • Input: Composite1
  • Display name: VCRSource
  • Video source: VCR
  • External channel change command:
  • Preset tuner to channel: 1
  • Starting channel: 1

Exit the backend setup and this time go ahead and let it run mythfilldatabase.

Open the MythTV frontend. You will know we have accomplished something when it confirms that we are connected to the backend.

Choose "Watch TV" to test...


So far unsuccessful. In progress..