Monday, October 8, 2018

Getting my Analog TV card to work in Ubuntu 18.04


I got a couple of old Analog TV cards and thought I'd chuck 'em into a Ubuntu 18.04 box and see if I could get TV to work.

Ubuntu finds them just fine, one's a BT878 [109e:036e] and the other is a CX23880/1/2/3 [14f1:8800].

I usually get VLC to open up the TV card to see if it's working:

vlc v4l2:///dev/video0 :v4l2-standard=NTSC :v4l2-tuner-frequency=61250 --crop 16:9 :live-caching=0 --zoom 2.2 --aspect-ratio 16:9


looks pretty decent since I'm getting the analog cable signal on channel 3 from the DTV adapter.

but the first video card on /dev/video0 seems to be getting a lot of interference and it looks terrible with hum bars all over the place.

Let's try the other video card on /dev/video1

vlc v4l2:///dev/video1 :v4l2-standard=NTSC :v4l2-tuner-frequency=61250 --crop 16:9 :live-caching=0 --zoom 2.2 --aspect-ratio 16:9

The video looks great, no interference, but now we've got another problem: only the top half of the tv screen is showing...I don't know why.

so let's try tvtime (which can be installed with "sudo apt install tvtime")

and it looks pretty good with:

tvtime -d /dev/video1 -c 3 -M -g 1920x1080


This looks pretty decent: -c 3 gets channel 3 -M is windowed and -g 1920x1080 gives me a window that fills my monitor.


So the video is fine, what about sound?

For some reason, the audio quality with tvtime stutters all over the place. So let's try using the Line-out from the TV card and piping that to the line-in of the onboard sound card.

But you go to the Ubuntu sound control panel and you can't get the line in stuff to work.


I installed pavucontrol with "sudo apt install pavucontrol" and running pavucontrol didn't help me fix it.

I had to issue this command:

pacmd load-module module-loopback

which is a bunch of pulse audio voodoo to pump the sound card line in to the sound card output.

If this seems wayyy too hard, it is. Getting stuff like this to work in Windows is so simple. I can see why people get frustrated with linux. You just go to sound properties and monitor the line out with two clicks.

Everything works pretty smoothly, but I have problems after I go into standby. When I come back out of standby the tvtime window is all screwed up with funky patterns instead of the video. I have to close tvtime, launch vlc and then reload tvtime.

So after I come out of standby I run this command: It launches vlc to init my /dev/video1, drops out after 2 seconds, then launches tvtime on /dev/video1.

timeout 2 vlc v4l2:///dev/video1 :v4l2-standard=NTSC :v4l2-tuner-frequency=61250 --crop 16:9 :live-caching=0 --zoom 2.2 --aspect-ratio 16:9; tvtime -d /dev/video1 -c 3 -M -g 1920x1080


Also I've noticed that if I leave the tv card running and go to standby, I will sometimes crash when coming out. So I'm closing the tv card when I go to standby. It seems that if you go with anything other than your normal video card and audio that standby gets a little flaky. It's gotta come back out of standby 100% of the time!