Using small SSD as recording buffer
#1
Hi,

I have been using windows 7 with WMC and a PCIe dual tuner for a while. I am in the process of changing over to a NUC with Ubuntu on it and running Kodi with MythTV from a few USB tuners.

I love the feature in MythTV that allows 1 tuner to record multiple items as long as they are on the 1 frequency. In order to use this, HDD speed will be needed, so a spin drive (because of the seek times) will not be fast enough to do more than about 2 recordings at once.

At the moment, SSD's are still extremely expensive for anything 1TB or over, which is what I will eventually put in the NUC.

To get around this, the solution I was thinking, was to have a small (100GB or so) SSD that will be the one everything is recorded to. But then do something like run a script once the recording is finished to copy it to a USB spin drive, check the user is not watching it at the time (if they are, wait until they finish watching it) and delete it from the SSD. That way I can have a 1TB cheap drive that will contain all finished recordings, and there should only be 1 or 2 people at a time watching things off this drive.

Are there any scripts etc out there at the moment to do this? I have my NUC, but am working out what I need to buy in the way of an SSD still (and still waiting on the tuners to come in).

Thanks,
Michael
Reply
#2
Well this is not a mythtv support forum, and the mythtv forum or (better still) the mythtv-user mailing list is the place to ask.

However I do far more than two (HD) recordings at a time to spinning drives, as do many other people. I have seen reports of quite massive spinning disk setups on the mythtv-user mailing lists, but I haven't been following it much lately.

I have also seen people describe using a SSD to record and then having a post recording script to move the recording to hard drive. That way LiveTV [1] and recordings are directed to the SSD while they are being watched/recorded and then the SSD space is freed up. So long as both drives are in the same storage group then this will be transparent to the user.

[1] LiveTV is a recording in mythtv, but usually has a shorter expiry period, so is deleted after a day or two.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#3
I left a post on the mythtv forums, however, they are not nearly as active as the kodi forums which is why I posted here as well.

I found with WMC that the seek speeds on a HDD ended up with issues in the recordings. How do people get around this if they are using HDDs and not SSDs to record to?

The way you are describing the SSD to hard drive is what I am looking for. I have had a look around the forums and not really seen this so far, so keen for a tutorial or something I can follow. All I can find is here: http://superuser.com/questions/427326/my...dd-storage
Reply
#4
I switched from WMC to Mythtv several years ago, but never had problems on WMC or Mythtv with multiple recordings to HDD.

For Mythtv use "System Events" to move recordings from SSD to another HDD, see

https://www.mythtv.org/wiki/MythTV_System_Events

If you go to the bottom of the page there is a link to Example Scripts, which includes MoveRecording.sh
Reply
#5
Awesome, thanks for that! Will try editing that script to tweak it for what I want :-)
Reply
#6
I regularly used to record multiple HD/SD streams from several usb tuners at the same time on to an old USB2 drive from an old laptop without any problem. I used playback at the same time too. All tuners and drive shared the same usb hub to ensure it was all especially congested.

You can use "mythffprobe recording.mpg" and it will show the bitrate of a recording near the bottom (obviously put the correct filename for recording.mpg of some files you've recorded) and that will give you an idea of throughput for your country/channels. You're probably looking at around one or two megabytes a second for HD.

The trick I find is to ensure there is a lot of free space on the disk since if the disk is full then the files tend to fragment a lot to fill lots of holes (such as small gaps caused by deleted fanart) and cause "took a long time to write" warnings, but it doesn't actually cause problems. There is an option somewhere in mythtv setup to keep some disk space clear and IIRC I set it to 40G and my woes went away.

I have used zfs as the filesystem and have also used ntfs under fuse and neither are known for being speedy, especially on a usb2 drive. The mythtv faq used to recommend xfs but I'd be surprised if any filesystem made that much difference on any machine in the past five year compared to just leaving spare disk space and having enough free memory for caching.

I don't know your NUC configuration but I would say get 4GB memory at least since a couple of GB will be eaten up by OS, kodi, mythbackend, and mysql and that will leave memory to nicely cache all those images and multiple read streams and avoid the OS having to write to the disk _right_now_ and instead let it write to disk when it's more opportune, which also help avoid fragmentation. Also check out the mysqltuner since mythtv queries can be quite memory/disk intensive if you have a large number of channels and recordings.

What you really don't want is to have is the mysql database on the same drive as your recordings since it significantly reduces performance.

You can buy hybrid drives which are drives that have say 8gb ssd in front of a 1tb spin, but I don't think these will be effective for mythtv since they will only cache frequently used files and chances are that you will not be accessing the same files repeatedly. It might be ok for mysql.

You could split your recordings in to two separate drives ("storage groups" in mythtv) and mythtv can record across them one whole recording to one drive then one whole recording to the next drive. Or you can set up a raid so combine multiple disks in to one big disk and let the OS write one block to each disk round-robin. But, all this adds complexity. I'd just save the money and buy more ram and see how it goes.

Kodi tends to have a good buffer for playback so can weather a heavy disk seek and even playback HD over a slow network. If not, look in to the advancedsettings for the pvr minvideocachelevel (and _not_ the cachemembuffersize which is for non-pvr sources).
Reply
#7
Thanks for that. Yeh, the hybrid drives would be no help in this case. I will leave the mysql on the operating system drive. We have some channels that are Full HD (1080p) which will take more space and increase required write speeds. With windows media center, I felt that it was not using the ram efficiently (had 8BG, same with the NUC) as it never seemed to fill it and would drop frames and corrupt recordings if I was recording too many things at once. I had a quad tuner, and found that 2 things were fine, 3 things were sometimes OK but sometimes caused problems, and with 4 things a 5min test was OK, but recording longer programs resulted in issues.

I'm thinking the idea of drive groups could be ok. Could I set the max amount of recordings at one time to one drive? For example, just get it to pick the drive with the most free space on it (I will have a few usb 3 drives connected) unless there are already 2 things being recorded to that drive and then go to the next drive.
Reply
#8
Mythtv on Linux is no comparison with WMC for performance.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#9
(2015-12-18, 01:26)nickr Wrote: Mythtv on Linux is no comparison with WMC for performance.

That I like to hear! So you think mythtv will use the ram and hdd write better? As soon as I get my tuners I will have to run some tests Smile
Reply
#10
My channels are just 1080i x264. Even so, I'd expect 1080p to be just double the bandwidth. I've recorded the 4k (3840x2160) hevc test channel with no issues.

Mythtv has several options for I/O. Check out Setup_Storage_Directories on the mythtv wiki. You can choose to balance I/O or to balance free space (absolute) or percentage free space. The one thing to be wary of is that if you keep lots of old _unexpirable_ recordings on a small drive then you can end up with the scenario where there is only enough space on one drive to record one programme so mythtv records and then instantly deletes the programme to record the next one.

I'm surprised at the corruption. Even when you have a dropout you should only get say 1/2 second of blocky tv artificats (like when you receive a bad signal) and then recover at the next keyframe. Though perhaps the playback programme couldn't handle the corruption at that point and instantly failed.

Could be that the WMC didn't read the buffers from the tv card fast enough rather than write fast enough. One way to tell could be to create a ramdisk to store test recordings there and see if you still get corruption (don't know if you can still create ramdisks on Windows).

We only have single/dual tuners here so issue could also be with the tuner with four full HD channels? There are usually driver options somewhere for "pass full stream" (typically defaults to true) which passes the entire multiplex and relies on software to throw away the bits it doesn't want to record. Switching this to off would reduce overhead at the expense of not being able to record multiple channels on the same multiplex concurrently.

However, I'd still expect any modern PC to be able to record several channels with ease since here we have lots of commodity satellite/cable PVRs that can record two or three HD channels while still watching tv or doing playback, and these are running on low spec cpu/disk.
Reply
#11
Sometimes the recordings would corrupt, sometimes they would loose frames etc. Was not a reception issue. I think it was an issue with the write buffer. The seek times would be pretty high on a hdd when it's multiple files and the hdd is filling up. I will try a 2tb this time. I think wmc always tried to write directly instead of buffering in the ram for some reason.

I'm thinking the first think to do is get a usb3 2tb drive and see how it goes.
Reply
#12
I've used numerous USB2/USB3 drives from different manufacturers and they've all failed within a couple of years when used for mythtv recordings. Nowadays the small print in this country says "backup drive" as a disclaimer that they're not suitable for continual use. They'd probably be fine for archiving shows you want to watch again.

If your case allows then I'd get an internal drive such as WD RED/RE4 since it's designed to handle always-on and case vibration from multiple drives and has a three year warranty. A NAS/enterprise drive often means that when a sector does fail, you get told immediately, whereas on my usb drives the OS seems to keep retrying for minutes hoping the problem magically goes away. This then causes significant problems especially when trying to move the recordings from a failing drive to a new drive since the continual failures seem to cause the drive to get hotter, the usb drive typically have no fan so gets hotter still and causes more failures.

If the case doesn't fit multiple drives then I find a 50' hdmi cable allowed me to put a bigger/noisier case somewhere completely out of sight and earshot of the tv. Or use one of those $35 Android boxes or RPI2 that support kodi running HD and then gigabit network to the main box elsewhere.

Anyway, good luck.
Reply
#13
If you're not doing any transcoding, you shouldn't have any issues. My Myth box is an ASRock Beebox with a Celeron N3000, running from a 16GB mSATA with only 2GB RAM. The drive hosts the OS, MythTV and its MariaDB database. I have it connected with 2 network tuners with 3 streams each, and most of my channels are 1080p/5.1 AC3. I have no problems with 5 concurrent recordings all at 1080p at the same time.

Granted, my Storage Directories are all on a NAS, and the box is not running any frontend, it's entirely headless. But, 2GB of RAM is plenty for handling MythTV's database and backend.
Reply
#14
(2015-12-18, 17:24)kluc55 Wrote: I've used numerous USB2/USB3 drives from different manufacturers and they've all failed within a couple of years when used for mythtv recordings. Nowadays the small print in this country says "backup drive" as a disclaimer that they're not suitable for continual use. They'd probably be fine for archiving shows you want to watch again.

If your case allows then I'd get an internal drive such as WD RED/RE4 since it's designed to handle always-on and case vibration from multiple drives and has a three year warranty. A NAS/enterprise drive often means that when a sector does fail, you get told immediately, whereas on my usb drives the OS seems to keep retrying for minutes hoping the problem magically goes away. This then causes significant problems especially when trying to move the recordings from a failing drive to a new drive since the continual failures seem to cause the drive to get hotter, the usb drive typically have no fan so gets hotter still and causes more failures.

If the case doesn't fit multiple drives then I find a 50' hdmi cable allowed me to put a bigger/noisier case somewhere completely out of sight and earshot of the tv. Or use one of those $35 Android boxes or RPI2 that support kodi running HD and then gigabit network to the main box elsewhere.

Anyway, good luck.
You certainly don't need gig Ethernet. 1OOM is enough.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#15
The drive I'm looking at getting is not a backup drive. It's called an expansion drive and is $99 from officeworks (http://www.officeworks.com.au/shop/m20Pr...reId=10151 ). It's a 3.5" drive in a box so shouldn't have any issues.
Reply

Logout Mark Read Team Forum Stats Members Help
Using small SSD as recording buffer0