Using Linux to watch HDTV

From YwwgWiki

Jump to: navigation, search

These days it is relatively easy to acquire AVI and OGG files in HDTV format. The resolution is sometimes not-quite-hd, but it is usually high enough. Often these files also come with awesome things like AC3 digital audio tracks.

Note: Anyone wishing to know how to acquire such files will be taunted.

Also, many HDTVs have VGA inputs and accept a variety of interesting resolutions to that input, including 1280x720 and 1920x1080. It doesn't take long before nerds like me add two and two and decide to hook a laptop to an hdtv in order to watch one of these high-resolution avi files.

I got this to work, but only after a lot of headache. Your milage may vary.

Contents

Step one: getting picture

My dad has a 42" Samsung DLP tv. It has a VGA port and claims to accept 1280x720 on that input. In order to make a linux laptop output an hdtv signal through VGA, you have to 1) tell xorg to use the external monitor jack, 2) tell xorg to output the correct signal, and 3) make sure your hdtv is ready to accept the signal.

external monitor

On my T43 I use the following line to tell the video card to use the outboard monitor:

Option "MonitorLayout" "NONE,CRT"

I found it helpful to test standard modes on a regular outboard monitor first before attempting to try weird HDTV resolutions.

modelines

I found a shitload of modelines online that claimed to work. Most didn't. this one did:

ModeLine "1280x720" 74.160 1280 1352 1392 1648 720 725 730 750 -hsync -vsync

or

Modeline "1280x720" 74.25 1280 1312 1592 1624 720 735 742 757

I also found others that didn't work as well:

Modeline "1280x720" 73.78 1280 1312 1592 1624 720 735 742 757
Modeline "1240x700" 74.812 1240 1360 1416 1656 700 714 720 750 +hsync +vsync
Modeline "1200x666" 74.556 1200 1312 1448 1664 666 694 697 746 -hsync +vsync
ModeLine "1160x680" 74.176 1160 1272 1312 1648 680 692 697 750 -hsync -vsync

Depending on your TV one or another of these modes might work. You might need to make your own. My dad's Samsung had a very helpful chart in the back of the manual listing the proper frequencies and refresh rates I should use. I then plugged these values into the X11 modeline generator page to get the correct modeline.

I tried these modelines for an hour and the TV wouldn't accept them. I discovered I had to boot the computer with the tv already plugged in for it to work. If your text console appears on the TV that's a great first step.

tv setup

The first couple times I got the TV to see the vga signal, the picture didn't look very good. There was a lot of overscan and bad moire in the standard X background. I discovered that the TV has a bunch of PC modes, including various zoom and stretch modes. I turned these off, and the picture got much clearer and fit the screen much better. There's still a bit of overscan, but not much.

Xine notes

I use xine to watch my videos because it has an insanely configurable keymap, so I can make the keystrokes match mythtv. With the default settings, mpeg4 movies flicker significantly in xine. To fix this, change the "MPEG-4 postprocessing quality" to zero in the config file.

video.processing.ffmpeg_pp_quality:0

Surround Sound

Getting surround sound on a linux laptop is a bitch. it sucks. Don't try. There are lots of usb audio devices that have s/pdif connectors, but they don't seem to support the iec958 standard, which is the linux code-word for "AC3-passthrough capable." I ended up getting the M-Audio Sonica Theater, which has a non-linux-usable s/pdif but also has multichannel PCM support that works. (s/pdif does seem to output the contents of front left and front right, but not all six channels -- whatever)

I learned a lot about alsa and ~/.asoundrc in making this thing work, but here's the short version. Add the following to your ~/.asoundrc:

pcm.my_surround51 {
 type route
 slave.pcm "hw:1" #0 is onboard sound, sonica is 1
 slave.channels 6
 ttable.0.0 1
 ttable.1.1 1
 ttable.2.4 1
 ttable.3.5 1
 ttable.4.2 1
 ttable.5.3 1
}

This sets up an alsa device called "my_surround51" which you can put in any box that wants the name of an alsa device. It assumes that the Sonica Theater is the second audio device, because laptops usually have one of their own. It also remaps some of the channels so the output matches what's written on the labels on the device itself.

After that, I had to edit my totem_config (I use totem-xine, which is much more reliable than the gstreamer version) to use my_surround51 in certain circumstances. the key line was changing

audio.device.alsa_surround51_device:plug:surround51:0

to

audio.device.alsa_surround51_device:my_surround51

and selecting "Surround 5.1" in the totem audio setup window.

It's also important that the audio.device.alsa_default_device is your surround device, even if you have a different preferred device for stereo or mono tracks. Otherwise xine will always use two channels even if the stream has six

Also use gconf-editor to change apps/totem/whateveritis to the proper setting

that's it

So now you have hdtv video over VGA, which is great quality, and surround over six analog cables, which is also just fine quality. Enjoy!

Personal tools