View Full Version : MythTV's Ringbuffer for LiveTV
Turtleggjp 09-25-09, 03:34 AM I've been getting into MythTV lately, and have Mythbuntu installed on my system. This system has 8GB of memory installed, because I used to use a FusionHDTV card in Windows XP x64 and I had a 6.5GB Ramdisk that I directed the Fusion card's playback software to use for timeshifting. I was excited at how easily I could create a similar ramdisk in Linux, and was eager to setup MythTV to use this for live TV buffering. I quickly found out that MythTV no longer uses a ringbuffer for live tv, but what it did do sounded like it would work. Sadly though, it does not work very well in this configuration, as the backend often crashes if I watch TV long enough on one channel to completely fill the ramdisk (I use tmpfs, so the size of the ramdisk is fixed).
I understand how this method of treating live TV is more beneficial for most people, but I just don't like the idea of using a HDD for this purpose, especially since what I am watching is always a few seconds behind what is live. Is there anyone else that thinks the old live TV ringbuffer should have been left in as an option?
Matt
wnewell 09-25-09, 04:04 AM AFAIK, live Tv uses the same HD buffer as any other tuner would use. In General of mythtv-setup. I think mine is still default at 9400KB. Be sure and remove your ramdisk before setting it too high.
quantumstate 09-25-09, 07:40 AM I never watch live TV anymore. No need, and commercial-skipping is the naz.
djb61230 09-25-09, 09:52 AM Yes I agree, live TV is just wrong. :D
Even for sports I find something "else to do for a while" and start watching sometime after game start so I have a time buffer to skip commercials, halftime etc. By the end of the game I'm usually caught up.
I do admit you thought of a good use case for a ringbuffer and ram disk that some would consider doing but I would not.
Turtleggjp 09-25-09, 12:36 PM AFAIK, live Tv uses the same HD buffer as any other tuner would use. In General of mythtv-setup. I think mine is still default at 9400KB. Be sure and remove your ramdisk before setting it too high.
So are you saying that if I remove my ramdisk and set that setting up very high I can achieve what I am trying to do? I didn't mess with that setting because I thought that would cause there to be an even bigger lag between live TV and the farthest point forward I can skip (with 9400KB, that is about 4-5 seconds).
I never watch live TV anymore. No need, and commercial-skipping is the naz.
I understand where you are coming from. I like to watch the local news when I get home from work, and I usually like to pause it and take care of a few things so I have some room to commercial skip.
Yes I agree, live TV is just wrong. :D
Even for sports I find something "else to do for a while" and start watching sometime after game start so I have a time buffer to skip commercials, halftime etc. By the end of the game I'm usually caught up.
I do admit you thought of a good use case for a ringbuffer and ram disk that some would consider doing but I would not.
Yeah, I thought of it when my parents upgraded to Dish Network HD and got a DVR that could timeshift for 1 hour. I never liked the idea of timeshifting with a hard drive, and then I thought that maybe it has enough memory to hold all the timeshift data. With Dish Network's lower bitrate for HD, 4GB might be enough to hold 1 hour. Since I use ClearQAM, I figured I'd need closer to 8GB. This was not terribly expensive to put into my system (4GB memory sticks are still about 4x the price of 2GB sticks, so I got 4x2GB), I did put it in, and I really liked timeshifting to a ramdisk. I was having various other issues in Windows, so that's why I turned to MythTV on Linux. I'm probably asking in the wrong place, but I just wonder how hard it would be to add the ringbuffer code back into MythTV and have it be an alternative to the current way of handling live TV.
wnewell 09-26-09, 01:27 AM I'm not sure exactly how the ring buffer works. Try it and see. I don't watch live TV very often. Actually, never except as a test. Why don't you just set the shows you want to watch to record and then not worry about live TV. They are available to what when they start recording.
waterhead 09-27-09, 10:03 AM I see that my use differs from most. I rarely pre-record shows and usually watch "live" TV. I guess that's because I'm an old codger, and set in my ways.
MythTV records EVERYTHING! There is no way to change this. When you are watching "live TV", you really are watching the recording of the live broadcast.
The buffer is just how long it waits before it will display the "live TV". If you are having trouble with "live TV", then increasing this will sometimes help.
wnewell 09-28-09, 01:22 AM I'm certainly no spring chicken (60+a few), but I've always hated watching live TV because of the commercials and being interrupted. And I haven't watched live TV in probably 20 years. Used to have 5 VCR's. Got rid of 2 of them when I added an S1 Tivo, and RCA dvr. When I started using MythTV (2005) I got rid of all that crap. And good riddance. My 5 tuner master and 2 frontends cost less than a single Tivo HD with lifetime sub and works a heck of a lot better.
Turtleggjp 10-05-09, 09:54 PM I had some more trouble with the backend crashing yesterday while watching football (it kept writing to my tmpfs ramdisk until it was full). Tonight though, it is creating a new file every 30 minutes (like it is supposed to I guess), so it has a recording to expire when the disk fills up. Still not an ideal solution, since I can only back up to the beginning of the current recording, but at least it isn't crashing on me tonight. Anyone know why sometimes it works one way and sometimes another like this? I am using the 0.21 build with VDPAU from Avenard's repo.
I don't understand - you have an aversion to just using a normal hard disk for your nearly-live viewing and so are trying to contort your system into doing something it wasn't designed for? What, exactly, is your rational for not doing it the way mythtv is designed to do it? Its not like you are going to wear out your hard disk any sooner by actually using it. One streamer writer and one streamer reader at ~2MB/s each is practically peanuts for just about any desktop hard disk manufactured in the last 5 years.
Turtleggjp 10-07-09, 11:41 AM I guess I have this vision in my mind of a HDD rapidly switching between read and write trying to keep up with demand. I think I even observed this type of frantic behavior on Windows with my FusionHDTV tuner's software. I felt much better doing such fast reads/writes to a ramdisk. I figure though that if the reads and writes are made in large enough chunks, then you are right, it shouldn't be a problem for most modern HDDs. Anyone know how big MythTV's read/write buffer is for live TV (or any recording playback for that matter)? Can it be adjusted?
This whole thing I was trying to do may not work out anyway, as I'm looking to move my backend onto my Ion system, which I think is limited to 4GB of memory anyway, which is not enough for what I want to do with it. If the Ion (dual core Atom) can handle backend duties as well as frontend duties (it's already doing a great job as a frontend), then I will probably use it that way, since I'm much more happy leaving an Ion system on 24/7. I have a 500GB 2.5" HDD that I pulled out of my new laptop (replaced it with a SSD) that I would like to use in the Ion system for live TV recording. If I did, I would probably try and partition it so that it has 30GB or so at the beginning (fastest part) of the drive for live TV recordings.
wnewell 10-07-09, 03:14 PM The OTA 8VSB bitstream will never exceed 19.39Mbps, or about 2.2MBps. Her's the speed of a 2 drive raid0 array.
/dev/md0:
Timing cached reads: 6272 MB in 2.00 seconds = 3137.03 MB/sec
Timing buffered disk reads: 482 MB in 3.01 seconds = 160.05 MB/sec
My system with 5 tuners regularly records 5 hdtv shows at once while sending 2 hdtv bitstreams to frontends, That still doesn't even come close to the capability of the drives. In fact a single drive would handle it fine. Here's an old WD 120GB drive.
/dev/sda:
Timing cached reads: 4934 MB in 2.00 seconds = 2467.83 MB/sec
Timing buffered disk reads: 116 MB in 3.00 seconds = 38.65 MB/sec
Just use a decent file system like JFS (I use JFS), or XFS. You could set seperate partitons for each tuner if you want to, but I've never done even with 5 tuners.
quantumstate 10-07-09, 04:34 PM wnewell (no offense intended) your readings are off the charts, even for the latest drives, which means your reads are cached and you are actually testing your disk controller speed. You must not have rebooted between tests.
For a little perspective, my new WD 2TB drives in a RAID10offset2 (striped & mirrored) array with a 4MB read cache maxes out at 77.7MB/s.
Turtleggjp for you a little perspective, if that disk drive is a good brand (not Seagate, Samsung, Hitachi, Sony) it will serve faithfully for 10 years no matter how hard you bang on it. To ease its life though, make sure it does not autopark every 10 seconds like some do, and set up an optimal readahead cache like this:
# blockdev --getra /dev/sda
256
# blockdev --getra /dev/sdb
256
# time dd if={somelarge}.iso of=/dev/null bs=256k
{answer}
And then set the a value 1024, 1536, 2048, 4096, 8192, and maybe 16384 (reboot each time, or disk cache will lie):
# blockdev --setra 4096 /dev/sda
# blockdev --setra 4096 /dev/sdb
# time dd if={somelarge}.iso of=/dev/null bs=4096k{etc}
1024 71.3 MB/s
2048 71.2 MB/s
4096 77.7 MB/s
8192 69.4 MB/s
16384 76.6 MB/s
Turtleggjp 10-07-09, 04:57 PM Turtleggjp for you a little perspective, if that disk drive is a good brand (not Seagate, Samsung, Hitachi, Sony) it will serve faithfully for 10 years no matter how hard you bang on it.
It's a Hitachi :(. Had no choice, it came with my laptop, and I didn't buy that laptop for its HDD (which is why it was one of the first things to come out). I will give it a try anyway and see how it does. I'll need to borrow a 500GB drive from somewhere though so I can re-partition the drive. Would it be better to use XFS for the live TV partition? I don't really care about losing them in a power outage (since they were going to be on a ramdisk anyway).
As of right now, I only have 2 tuners (1 HDHomerun), and I may plan on getting another 2 later if I have the need. So you're saying that I can better optimize disk performance outside of MythTV? That would be nicer, since it's not dependent on whether or not settings for it exist in MythTV.
quantumstate 10-07-09, 05:05 PM I used XFS for almost a year and found subtle, enraging file corruption over time due to power outages. I don't trust XFS or Ext4 for this reason, and use JFS.
Yes you can only optimize disk performance outside Myth. With Myth 0.22 you can optimize video performance by tweaking buffers, but it's not for casual users, and shouldn't be needed in most cases.
Main disk performance problem with Myth is flagging commercials when the database and target video are on the same drive. It will thrash, but good drives are designed for that.
Turtleggjp 10-07-09, 07:14 PM So which file system do you recommend for my live TV partition? Considering I will be deleting large files (3-4GB) frequently while reading and writing other files at the same time, and I don't care if all the data on the partition is lost during a power failure (which are very rare for me anyway).
wnewell 10-08-09, 02:19 AM I've been using JFS for a number of years without a hitch. And it's faster than most other files systems when dealing with large files.
|
|