Approaches to a Linux PVR

What are the best options if you want to build you own PVR, and what dependencies and conflicts should you consider?

I have been looking into how to set up a Linux personal video recorder, or PVR. I don't have one working yet, but I have learned a few things. Here are notes on the two approaches that look best for a Linux PVR.

Requirements

My goal is to have the option of full-quality capture. Thus, I am not interested in any solution based on USB; no USB solution can capture full-size frames at full speed. USB 1.1 simply doesn't have the bandwidth for real-time video capture, even with compression. USB 2.0 does have the required bandwidth, but I haven't seen any USB 2.0 TV capture devices. Also, I am not interested in any solution that cannot capture stereo sound.

However, the capture does not necessarily have to be highly compressed. A two-step capture process would be perfectly adequate. It could, for example, capture in some easy, low-compression format and then automatically (in the middle of the night) re-encode the video to something more space-efficient for long-term storage.

Video Format Issues

Ideally, the video will be in an open format at all times. Although some devices permit video capture in MPEG-2 in real time, the patent issues encumbering MPEG-2 make me reluctant to use it in a Linux PVR.

The standard format for a DVD is MPEG-2, though. In order to make a standard DVD, some sort of legal MPEG-2 encoder is required. A hardware device that handles the MPEG-2 encoding would be a convenient way to get a legal MPEG-2 encoder on a Linux system.

The Ogg Theora Project holds great promise as an open video format, and it's currently in a pre-alpha development stage. It is based on VP3, but all the patents on VP3 have been signed away, so Theora can be fully open and free. Naturally, Theora uses Vorbis for the soundtrack.

If disk space isn't an issue, you could leave the video in the same format in which the PVR software originally saved it.

MythTV

The simplest way to build a Linux PVR probably would be to get MythTV working. MythTV looks nice in the screenshots, it appears to have some very nice features and the folks who use it rave about it.

The major obstacle is to find a TV capture card that will work with MythTV. Which card is best? The MythTV web page simply says that you can use "any TV card supported by Video for Linux". I studied various web pages and figured out that what I want is a card based on the Brooktree 878 chip. The 878 supports audio capture, in stereo, using the btaudio kernel driver.

Older TV cards usually require that you connect an audio-out jack on the TV card to an audio-in jack on your sound card. The major problem with this connection is the clock on the audio card may be subtly out of sync with the clock on the TV card. Thus, the video capture stream and the audio capture stream may drift out of sync. Even a tiny difference, adding up over an hour-long TV show, may result in sound and video being annoyingly incongruous. Obtaining the audio and video streams from the same 878 chip should avoid this problem.

I also wanted to know if it is possible to set up a PVR that has multiple TV cards. I am not sure how much CPU time it takes to capture video, but I suspect that two TV cards would be workable on an Athlon XP or a Pentium 4 system. Obviously, it would be easier to plug in two TV cards than to plug in two TV cards and route audio cables into one or two sound cards. If you plan to capture and play back on different computers, however, with an 878-based TV card your capture computer won't even require a sound card.

Okay, we want a TV capture card based on an 878 chip--which card is that? If we want a solution simply works, we probably want an older TV card. The ATI TV Wonder looks viable, and I plan to try one soon. The ATI TV Wonder VE, on the other hand, is not a good choice. Although it does use an 878 chip, direct audio capture is enabled on the VE card; you must connect an audio-out jack with your sound card. And it doesn't support stereo sound.)

I bought a Pinnacle PCTV Pro card, on sale at CompUSA, because I had determined it had a Conexant 878 chip. I figured this would be compatible with the Brooktree 878 chip, and it should work easily. This turned out not to be the case, however; the card is too new to be recognized by the version of the bttv driver module bundled with the 2.4.20 kernel. I upgraded my bttv driver module to the latest version, and the Pinnacle card was detected correctly, but it did not actually work. I plan to set the module for maximum verbose logging, collect the logs and ship them to the bttv driver folks. Hopefully, in the near future the PCTV Pro card might work and be a good choice. Meanwhile, I am ordering an ATI TV Wonder to try. I'm hoping it will work with the bttv module bundled with the 2.4.20 kernel.

MythTV captures in NuppelVideo format, an open standard that has good free software support. Tools are available to transcode it, and MPlayer has support for directly playing NuppelVideo files.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Want PVR or Media Center?

Ira's picture

The easiest way to get a PVR or a media center on your linux Box is this :
XDTV + OST-BOX
Both have rpms and both are great.
OST-BOX is a media center like MythTV or freevo but much much easier and simpler for newbies. it has built-in Lirc support that you can configure from the GUI. OST-BOX also has an internal TV viewer but for me I prefer to use XDTV and it's really easy to add it to OST-BOX items. XDTV has an excellent picture quality (as good as TVTIME) plus it has built-in recording, so you can record your shows while watching TV (very very fast too) I use it on a 900MHZ PC with a TV Tuner software card.
What's left :
With OST-BOX you can browse and play your video files , mp3s , play cds and DVDs , schedule recording (you can also use the one provided from XDTV) just the usual stuff you expect from a media center.

You can also easily add as much functions to OST-BOX as you want, for example I added : Radio and Internet radio (Shoutcast), shutdown PC , sleep function, and many more functions for my personal taste.
Try them!

Audio sync

Anonymous's picture

I use a TV Wonder VE (looking to swap it out, though -- it's starting to show vertical "static" lines in the captured video), and I route its audio through my sound card's mic-in (I tried using line-in, but the captured audio is way too quiet on that channel; the sound card is handled by the snd-ymfpci driver).

I use transcode to capture directly from /dev/video0 and /dev/dsp -- and I keep the synchronization using some options to transcode's v4l2 input driver. The important argument for the sync is -x v4l2="resync_margin=X:resync_interval=Y" (I use X=2, Y=5, but anything should work fairly well). This tells the v4l2 driver to drop or clone video frames as needed, checking every 5 frames, and fixing problems if the signal is out of sync by 2 or more.

The options to the v4l2 driver should be in the transcode docs somewhere, but I don't know if they are anymore... this works on transcode 1.0.2 though.

Not an ideal solution, but it does allow me to capture from my crontab (I don't know whether mythtv does that or not).

ATI based cards?

Anonymous's picture

I read that MythTV can support ATI Theatre 550 based cards. These provide the best possible quality from a TV card. And I also know MythTV supports MPEG encoders on cards like the WinTV PVR-150/250/350. But if I have a card based on the ATI Theatre 550 with an MPEG encoder, can I use it?

Mythtv

Anonymous's picture

First off, this article would have been better if the author actually built and used the system. A PVR is a fairly large project that takes patience and determination. The results, for me, are great.

I have been playing around with Mythtv (0.17) supporting a pcHDTV card (very nice) connected to an antenna and an old BT 848 connected to cable. There is quite a lot of work to get Mythtv set up and running. Mythtv comes as a base module and a collection of supporting modules. All together this is a very nice package. The major components have fairly long lists of required software. You have to get and build the list items before building the Mythtv component. Some components come with your distribution and some get downloaded from the net. The instructions are quite good and there are additional pages on the web that are also useful (google for Mythtv)

I have my system running pretty well and am very happy with the results. Its not completely setup so there is more to do. At present I can watch, record HDTV and Cable TV, and play DVDs. I have the web based tv guide running too which is great. It provides web based access to the database and backend for operating all of Mythtv except watching vidio. A few notes:

Mythtv recommends Nvidia based vidio cards because they have better Linux driver support than ATI. Get a card with mpeg support. I bought a 5700 based card and really like it.

With HDTV you need big disks. HDTV records typically 7.5GB/hour. Standard tv seems to be about 1.6GB/hour. (There may be compression, I havn't explored that yet).

Its a good idea to learn how to use the mysql program to examine and edit the database. You will occasionally need to cleanup some rows.

There are some bugs that I havn't yet resolved (havn't tried too hard either):

I am getting a "floating point exception" in mythfrontend when attempting to play some recorded cable shows and live cable tv shows.

I am having sound problems especially when using the 848 card. The sound output is turned on when recording and left on after recording completes and its not that obvious how to turn it off. This interfers with watching TV while recording. Sometimes starting and stopping xawtv shuts it up. I think the tuner is left running.

I get pauses in playback of HDTV. (Pausing to buffer messages every few seconds). This is anoying. I have a fast system (2.8G Prescott with 1GB of memory and 2 fast SATA disks (software raid0). This shouldn't be happening.

Changing channels while watching live HDTV doesn't work well. The sound cuts out and the picture breaks up. Stopping and starting mythfrontend works around the problem. Also switching between the tv cards while watching live tv isn't working yet.

I learn more as I go along. This is the kind of project that I enjoy so its hard spliting my time between tinkering with the software and watching tv.

MythTv + Hauppauge PVR 350 + Fedora Core 3 + ASUS Pundit

Bruce's picture

I did my research and I decided on the following for a PVR system:

ASUS Pundit (Small quiet system; size of a VCR)
Hauppauge PVR 350 (Hardware encoding/decoding of MPEG2 w/Tv-Out)
MythTV
Fedora Core 3

After carefully reading a wonderful FAQ on how to install and configure a MythTV system on Fedora Core 3 Linux (see reference, below), I have a sweet fast PVR system. I'll never go back to a VCR again. In fact, I'm thinking of purchasing another PVR 350 board since MythTv can handle multiple boards.

If you have the cash, I recommend going the PVR 350 route. Most other choices are a waste of time and resources. The PVR 350 sports hardware encoding and decoding to (S-Video or Composite) Tv-Out.

A really nice remote also comes with the 350. A little reading also allowed me to program the remote just the way I wanted it. The remote has a lot of buttons -- forward, rewind, jump forward, jump backward, pause, stop, information, menu, and specialized (colored) buttons for special functions. I programmed mine for 'next commerical marker', 'previous commercial marker', 'slow motion', and I forgot the purpose of the last colored button -- there are 4 in total. The remote is very nice.

I wanted a dedicated system for my PVR so I did the research for compatibility with MythTv and the PVR 350 and the ASUS Pundit became my choice. The system is awesome. It's small, stylish, and quiet. It sits upright next to my Tv stand, although I've been thinking about getting rid of the VCR and putting the Pundit in its place. However, first, I have to dub some tapes onto the computer and burn them on a DVD.

I also put a DVD burner in the Pundit. It's an Iomega SuperDVD EIDE burner. Its burning abilities didn't work under RedHat 9 but the burning works fine on FC3. I just used Nautilus to burn an FC3 ISO. Note: When you choose a DVD/CD driver for the Pundit, make sure that the drive has strong opening mechanism. The drive will need sufficient force to open the Pundit plate that covers the DVD drive tray.

The first drive that I put in the Pundit could not consistently open the Pundit face plate. It would try to open and then close because it detected resistance. The drive was too sensitive. Luckily, the DVD burner that was in my RH9 system does have plenty of strength so it pushes the Pundit plate open with ease.

Anyway, if you're looking to build your own PVR system, at the least, I recommend the Hauppauge PVR 350 board. You won't be disappointed, once you get it working. ;-) Here's a word of advice. Follow the FAQ.

References:

http://usa.asus.com/prog/spec.asp?m=Pundit&langs=09
http://www.hauppauge.com/pages/products/data_pvr350.html
http://wilsonet.com/mythtv/fcmyth.php

How to make a MythTV box the EASY way

Eric Skiff's picture
  • Start with the lowest barebones box you can buy today, or anything above 1ghz you have lying around.
  • Use an old ATI card as your main video (not capture) card. This will save you a lot of headaches since they're amazingly well supported in linux. I'm using a Rage 128 chip.
  • Buy a Hauppauge WinTV card (around $40)
    -Do not get the Digital or HDTV cards as these only work with "over the air" (OTA) signals, and not with the cable you pay for. (Of course, you could use an antenna to grab the OTA signals, but it's tricky)
  • Install Fedora Core 3
  • Install apt-get from the atrpms kickstart package
  • apt-get update
  • apt-get install mythtv-suite
  • That will just about do it. Kudzu will pick up the wintv card, mythtv-setup will walk you through setting up your system, and apt-get installed not only all of mythtv but all of the dependencies.
  • Enjoy.
  • "The Wonders and Horrors of Myth TV" or "How to (and not to) Build Your Own TiVo Box."

myth approach

Anonymous's picture

FWIW I got mine up using knoppmyth distribution as I'm relatively new to linux (but not unix.) I use the pvr350 card, with hardware mpeg, so no issue there. it is also producing a standard format file.

as to the cpu use, recording at 5mbit/sec 6mbit/sec max uses 3% of the cpu time of a athlon xp 1800.

I also have a cheaper pvr150mce card but am still leary of using a development ivtv driver, kind of waiting for it to get 'official' v.a.v. 150 support.

Myth also seems to work fine with an older hauppauge wintv-theatre card but I never tried to mix and match.

why not stop futzing around and do it! find out a card that does work with myth and give it a spin! it's fun!

nrf

Re: Approaches to a Linux PVR

Anonymous's picture

This is very bad advice...

With the Linux drivers, only 3 BT878 cards are known to work with the btaudio driver. My KWORLD KW878-RF Pro can't work with the Linux audio driver at all.

What's worse, I've had lots of other bugs that have prevented me from using audio-passthrough on either of my two soundcards for recording...

The only solution was to use ALSA, which works fine with one of my soundcards, not at all with another, and even with the one that works, it's a hell of a lot of work to get it going properly. Although, I have finally gotten it working with MythTV. Now I need to figure out the solution to one MythTV bug I'm having, and hope that the mythtv patch to mplayer allows me to convert the mythtv format into something useful (why the hell couldn't they use avi, mpeg or ogg? Thier stupid format needs to be converted, and it means I can't drop-in any files to be watched with MythTV) It's too bad that Freevo isn't further along, I'd much rather be using that, since it has features like allowing you to watch videos on your harddrive, DVDs, etc.

Use MythVideo!

Anonymous's picture

The MythVideo plugin allows you to drop in pretty much anything - you just have to put an entry in the MySQL database describing it. I'm still working on my Myth box, but I've gotten that far. It wouldn't be hard to create a quick-and-dirty script to put an entry in the database.

Re: Approaches to a Linux PVR

Anonymous's picture

Hrmm.. perhaps with all our powers combine we can build a product better than Replay or Tivo! mwhahaa. Since the trend seems to be that no one agree with each other on what would work best, why don't we all just eat each other?

Re: Approaches to a Linux PVR

cdm96247's picture

I found that the Hauppauge card work well in creating the PVR in Linux Here is the link that help me build mine.

http://www.extremetech.com/article2/0,3973,1016212,00.asp

Next venture to upgrade the Hard drive to 200 MB..

Re: Approaches to a Linux PVR

Anonymous's picture

Hi all,

Check out http://www.brainlessinc.com/ecstasytv.pdf (233kb)

It is a small synopsis that describes what Ecstasy TV is capable of doing. If it interests you, let me know.

Within a span of 4-5 months I am planning to sell Ecstasy TV via web for $220.

-Regards Anurag

anurag@brainlessinc.com

Re: Approaches to a Linux PVR

Anonymous's picture

If I could get such a box, I would... However, I am highly skeptical that it will ever come to be. Sounds like a couple people sat down and thought it up without adequate knowledge of the market.

Sure, offer it online and I'll be one of the first to order it, but I'd be keeping a very close watch on my credit-card bills... Nothing personal.

Re: Approaches to a Linux PVR

Anonymous's picture

That sounds very cool and should have a good audience if it works!

Re: Approaches to a Linux PVR

Anonymous's picture

You won't need to build your own IR transmitter, check out: http://www.dodgies.demon.co.uk/

And BTW, you may want this no matter what, as consider what the situation looks like if your signal is coming from a DirecTV receiver, for example.

Re: Approaches to a Linux PVR

cdm96247's picture

Here is another link for a unit that you can make cheaply that fits in a 5.25" bay

http://www.cadsoft.de/people/kls/vdr/remote.htm

Re: Approaches to a Linux PVR

Anonymous's picture

I also have a Hauppauge wintv 250 which has a PAL/NTSC/SECAM tuner and decodes in hardware straight to Mpeg-2 in many formats including DVD quality 720x576 with stereo sound. I believe there are linux drivers for this card but I haven't tried it yet [ony had it one week]. The quality in win2k is great. I am using divx to compress the recorded video by about a factor of two for long term storage.

Re: Approaches to a Linux PVR

Anonymous's picture

I have a PVR 350 (same chipset as the 250 ... Connexant I believe) and use it under linux. There are two drivers out right now. ivtv.sf.net is the "open" driver that is in a pre-Alpha state but support v4l. There is also a set of "grey" drivers that are available on the net (hint:

http://www.shspvr.com/forum/viewtopic.php?t=1804). that are not v4l compliant The grey drivers work quite well while the open drivers have some stability issues. That said, it's more than a little disheartening that Hauppauge has refused to provide a driver and information on these PVR cards.

Re: Approaches to a Linux PVR

Anonymous's picture

nvrec is a project which specifically deals with the audio synchronization issues. I had to switch to it after bad synchronization with vcr.

nvrec.sourceforge.net

I personally think recording direct to xvid (divx) is the way to go. Excellent results with excellent compression. Even 640x480 high bit rates gives you about 600meg for an hour.

The other big advantage its plays great on windows boxes.

I'm not clear what the mpeg-4 licensing implications are of xvid.org but it is a great project that many in the windows video world are switching to from divx.

Anyone interested in video on linux should know about

http://www.theorie.physik.uni-goettingen.de/~ostreich/transcode/

it's great for moving between formats.

I look forward to ogg's solution whenever it shows up in debian-unstable : )

So you didn't manage to record a thing, did you ?

Anonymous's picture

What's the purpose of writing an article about Linux PVR without actually assembling one ? How do you/we know if any of the approaches presented will work and how. I'm looking forward to "Linux PVR Part II".

Re: So you didn't manage to record a thing, did you ?

Anonymous's picture

I think it's called 'planning.' I've heard that people who 'plan' before 'doing' often wind up with better results.

Re: Approaches to a Linux PVR

Anonymous's picture

and i have been using vcr for about a year, and i'm quite happy with it.

i have a normal tv capture card, hauppauge win tv pci i think it's called, which can capture stereo. i can remember that i had quite a struggle getting the correct version of avifile to work with vcr on my suse 7.3 system, but since then, i have been using it in combination with the cron daemon to record my favourite series.

oh i am also using the windows divx codecs btw.

Re: Approaches to a Linux PVR

Anonymous's picture

any chance you could post the version of avifile you are using that works correctly?

Re: Approaches to a Linux PVR

Anonymous's picture

I tried getting a PVR solution on an old 450MhZ AMD and although the software was easy enough to get working I could only capture really tiny video at like 4 frames a second. That may not be too surprising on such a limited machine but:

* what performance are people getting on 1.0 -> 2.0 GhZ processors? What's the minimum requirement for this?

* apart from the DC10, are there any other hardware compression solutions support by the linux video tools yet?

- joHnnY

Re: Approaches to a Linux PVR

Anonymous's picture

Dual PII 233Mhz cpu box for the capture machine.

Paired 5400rpm Maxtor drives attached to a 3ware Esclade 2port ide raid card striped.

Three dc10+'s and 3sblives

Triple capture of maximum resolution ntsc (640x480) @ 29.97fps (the actual NTSC frame rate) at maximum dc10+ quality setting is possible, but it does put a heafty load on the raid card and pair of drives.

Typically, full frame NTSC (640x480) at maximum dc10+ quality is about 20Gig/hour.

Half frame NTSC (320x480) at maximum dc10+ quality is about 10Gig/hour. Half frame is generally good enough for time shift purposes.

Encode to mpeg to save space (this is the really time consuming part, mpeg encoding eats CPU time for breakfast, lunch, and dinner if you want decent low noise pictures in the end.

Playback is through Hollywood+ em3800 chip dvd mpeg accellerator cards. Playback of full DVD resolution/rate mpeg is possible with a H+ on a dual pentium 90Mhz (yes, you read that correctly) provided a high speed ide interface card (promise) is installed.

Re: Approaches to a Linux PVR

Anonymous's picture

What software are you using to play it back?

Re: Approaches to a Linux PVR

Anonymous's picture

Look at the Pinnacle DC10plus board. It works with mjpegtools and mplayer. It does hardware MJPEG onboard, so the system doesn't take a big bandwidth hit. Compression is variable so you can capture at 768x576 (PAL) and burn 8Gbyte an hour if you like, or decimate at less quality for reasonable disk usage. The DC10plus has video in and out so you can connect up a PC without a display to be a PVR.

There is one nasty, the infamous diagonal lines problem (see the Pinnacle webboard), this requires you to solder on a capacitor if your motherboard is so noisy that it causes interference. I've had excellent results, no interference, with a 1.3GHz Shuttle SV25, but YMMV.

DC10Plus with 2.6 ? how did you do that ?

PhiX's picture

Do you got Pinnacle DC10Plus (Zoran chipset) working with a 2.6 linux ?

Last time I checked, zoran drivers worked only with linux 2.4...and didn't compile, leaving me helpless.

My experience with Myth

Anonymous's picture

I've been using MythTV for about two months. It is an excellent piece of software. My hat is off to Isaac and the other developers on the project as they have turned out an excellent and flexible piece of software.

I have a dual tuner setup using an Athlon XP 2200+, an old BT848, and a newer off-brand BT878.

I don't use digital audio capture and I've never seen the out of sync audio condition you mention. I know there are people who have posted to the mailing list about out of sync audio but as far as I know this is because they don't mute the line-in and they are listening to the live audio instead of the decoded audio as they should be hearing so this would be a configuration mistake. The documentation is very clear on this issue.

For people who need a lot of hand holding I recommend buying a Tivo or DVD/Harddisk recorder. For users who can follow instructions and don't mind dedicating a system Myth is an excellent solution today.

Re: My experience with Myth

Anonymous's picture

I'm curious. What were the actual cards you used?

Thanks.

Re: Approaches to a Linux PVR

Anonymous's picture

have you looked at Freevo?

http://freevo.sourceforge.net/

Greg

or vdr? here is guide to inst

josk's picture

or vdr? here is guide to install vdr on mandriva
http://www.sajaniemi.net/content/view/40/49/

Re: Approaches to a Linux PVR

Anonymous's picture

There is a new site which has setup guides to help you to get one of these PVRs setup.

http://pvrguides.no-ip.com

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix