JFamily
Posts: 27
Joined: Tue Aug 11, 2015 1:40 am

How to optimize my MediaPi?

Mon Dec 07, 2015 3:05 pm

I'm trying to find a way to improve the performance of my RasPi. It's running raspbian jessie w/ Kodi (gkreidl) on a SanDisk Ultra 8GB Class 10. All content is streamed from my main computer via a 100% wired network. For the most part everything is pretty good. However, certain films are very glitchy and we have a very hard time getting subtitles that should work to work. The most noticeable problem is the complete crashes that occur, especially when trying to skip forward or backwards during playback. Whenever kodi crashes, we can eventually get out of it by moving the mouse and getting returned to the desktop. It's usually best if I go ahead and restart Raspbian at that point.

I've been thinking about using a thumb drive or an externalized powered SSD for the OS but I'm not sure if this will solve the problem or if it's even the best solution. I don't know enough about how the process of streaming movies works. Given the knowledge I do have of computers, I know that data has to be in constant motion across my network and that at least some of the data for the movie is being read from/written to a temp folder on the SD card constantly. Is it possible that this constant read/write environment is simply wearing out my SD cards? My first SD card died after a few months. I thought the short life time was due to the number of times I completely reinstalled and recompiled everything. This time I've only reinstalled it one time and that was before I got most of my programs setup on the initial install.

I thought it might be my network or the hard drive in my main computer but that has to be ruled out because the glitch's still happen when no one is using the network for anything else and the computer is completely idle. The data I'm streaming is stored on a secondary hard drive. So for the most part, nothing else is ever accessing that drive.

What I'm trying to figure out is: Do I need to buy something (If so; What?) or is there something I could change with my configuration?

Appreciate any advice!
I'm notoriously terrible at being concise.
RaspberryPi 3 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / Kodi v15.2
RaspberryPi 2 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / PleXMBC (wip)

gkreidl
Posts: 5953
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: How to optimize my MediaPi?

Mon Dec 07, 2015 3:34 pm

How are the media shared? Samba or some kind of media server.
To run the complete OS (except for the boot partition) from an USB HDD gives much better performance than from any SD card and is much more reliable. My first SD card broke down after a few months (getting worse after each repair) and since then I'm running my RPis from HDD only.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

JFamily
Posts: 27
Joined: Tue Aug 11, 2015 1:40 am

Re: How to optimize my MediaPi?

Mon Dec 07, 2015 4:23 pm

Thank you gdkreidl,

The media is shared via samba. In Kodi, sources are setup to point to smb://192.168.0.10/movies /tvshows, etc. We access the folder's directly instead of using Kodi's library system by editing the home screen options to point to favorites I created that are linked to the smb:// directories.

I don't know if it helps but this is how my fstab is setup:

Code: Select all

proc /proc proc defaults 0 0
none /var/run tmpfs size=1M,noatime 0 0
none /tmp tmpfs size=1M,noatime 0 0
none /var/tmp tmpfs size=1M,noatime 0 0
/dev/mmcblk0p1 /boot vfat ro,noatime 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
Not sure if this is best for my setup because I took it from a guide that seemed to be aimed at running raspbian in a bare minimum state, the options here seemed to be in my best interested so that's pretty much the only part of the guide I adopted.

So undoubtedly I will use an external hard drive. What is the best way to do that? I have a stack of old IDE and SATA drives and a usb->ide/sta adapter w/separate power source. Would I be better off buying a powered external hard drive? If I can use the adapter, would it be worth it to buy a small solid state drive or would performance be bottle-necked at the USBv2 interface?

I had one other question but I can't remember it now so it must not have been too important.
I'm notoriously terrible at being concise.
RaspberryPi 3 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / Kodi v15.2
RaspberryPi 2 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / PleXMBC (wip)

DarrenHill
Posts: 224
Joined: Fri Oct 03, 2014 3:03 pm

Re: How to optimize my MediaPi?

Mon Dec 07, 2015 4:48 pm

Do you need raspbian for anything else?

If not, maybe grab yourself another SD card and try an install of either OpenElec or OSMC. They are dedicated and optimised OS/Kodi combo's that are solely for media playing via Kodi (and both are supported both by their own communities and the Kodi Foundation).

OpenElec is the more streamlined of the two, but as a result has a very locked-down and cut-down read-only OS underneath Kodi, whereas OSMC has a more full OS underneath it and additional packaged can be added to it (it's a debian fork beneath - apt-get works on OSMC but not OpenElec).

Maybe give both a spin and see if either works for you and gives you better performance? In both cases it's just an image that you flash to the SD card with Win32DiskImager, in the same way that you would with Raspbian. Both are also available via Noobs if you prefer that way.

JFamily
Posts: 27
Joined: Tue Aug 11, 2015 1:40 am

Re: How to optimize my MediaPi?

Mon Dec 07, 2015 5:26 pm

I've tried both. I like having the ability to close Kodi and have a full OS to work with. I thought OSMC would be the best for the reasons you described (apt-get) but it didn't really measure up to what I want out of it. I like having the option to close kodi and have a full web browser available. I also like the technical side of things and enjoy working with the OS.

My expectations for raspbian have dropped because it's easier to play the occasional youtube video through the add-on or use my phone/tablet to do a quick internet search and I use PuTTy if I need to get to the command line. So I might try those when I do the next inevitable reinstall. Can I run those off an external hard drive? What would I do with all the extra space? If I use a HDD, the smallest I have is like 80GB, I could buy a small (32GB) solid state drive if I can justify it with even the slightest performance gains

EDIT:

This is what I'm torn between at this point; a mSATA USB portable SSD (link) or a USB to mSATA expansion board (link) for the Raspberry Pi with a standard mSATA SSD.

The former seems more conservative in that I can keep the form factor relatively low and my Pi get's to stay 100% in it's enclosure. The latter option seems cooler -- and potentially faster? It looks like it hooks up via GPIO instead of using one of the USB ports and doesn't have to powered as long as the hard drive is powered separately. If it isn't powered separately, there is a mini USB connector to provide power to the board. But I'll have to take the top off of my case and cut out holes for the mount.
I'm notoriously terrible at being concise.
RaspberryPi 3 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / Kodi v15.2
RaspberryPi 2 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / PleXMBC (wip)

MysticWhiteDragon
Posts: 53
Joined: Sat Dec 22, 2012 2:51 am

Re: How to optimize my MediaPi?

Mon Dec 07, 2015 8:31 pm

If you look closely at the 2nd link you provided, it does show a USB port and you can see the GPIO headers are not in use. Besides, I doubt you can use the GPIO for data transfer at a decent speed. I think many people have tried tests.

If you look at the tech specs:
- 1 x USB 2.0 Micro-B female
- 1 x USB 5-pin pin header (Pin Header assignment: 5V, D-, D+, NC, GND)

So, you can either use a micro USB cable or use a USB cable with a brakeout board. Maybe, they did this for those who like to do things like replace the USB ports with jumpers?

HiroProtagonist
Posts: 212
Joined: Sat Jun 29, 2013 9:45 am

Re: How to optimize my MediaPi?

Mon Dec 07, 2015 10:35 pm

JFamily wrote:I could buy a small (32GB) solid state drive if I can justify it with even the slightest performance gains
I don't think you will see any significant performance gain with a solid state drive.

Your best bet would be to isolate the problem - is it the network or the pi?

Can you copy a media file to a usb stick & play that without problems on the Pi?

JFamily
Posts: 27
Joined: Tue Aug 11, 2015 1:40 am

Re: How to optimize my MediaPi?

Mon Dec 07, 2015 10:55 pm

HiroProtagonist wrote:Your best bet would be to isolate the problem - is it the network or the pi?

Can you copy a media file to a usb stick & play that without problems on the Pi?
I have no doubt that it is the Pi unless I'm trying to stream something of 1080 quality and then it's absolutely the network. As long as I keep everything at 720, the playback is great for the most part. The thing I'm mostly interested in improving is stability (crashes when skipping forward or backward in a video and random crashes while navigating through Kodi). I think we've determined that an ext hard drive would mostly resolve that issue and maybe I should try OSMC again for a more optimized media center. I also know now to just go with a regular ext hdd. The only reason I can find now for a SSD is that I've fallen in love with the silence of my new media computer
I'm notoriously terrible at being concise.
RaspberryPi 3 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / Kodi v15.2
RaspberryPi 2 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / PleXMBC (wip)

jb63
Posts: 116
Joined: Mon May 11, 2015 6:41 pm

Re: How to optimize my MediaPi?

Tue Dec 08, 2015 1:41 am

I have all my media on a dedicated network drive, connected directly to a router. That way, I'm not tasking my computer, and OSMC gets the files directly from the network drive.

flubbard
Posts: 65
Joined: Tue Dec 08, 2015 12:41 pm
Location: Ohio, USA
Contact: Website

Re: How to optimize my MediaPi?

Tue Dec 08, 2015 12:44 pm

I didn't see this information in your original post but what type of file are you trying to play. If you are using MPEG files, have you purchased and installed the MPEG2 codec from the foundation and installed the key in your config.txt file?

- Barry

JFamily
Posts: 27
Joined: Tue Aug 11, 2015 1:40 am

Re: How to optimize my MediaPi?

Tue Dec 08, 2015 2:23 pm

flubbard wrote:I didn't see this information in your original post but what type of file are you trying to play. If you are using MPEG files, have you purchased and installed the MPEG2 codec from the foundation and installed the key in your config.txt file?

- Barry
The last video I tried to play that gave me problems was a .mkv video. I have had problems with some file types and I know I need to buy the codec and get it setup. Just haven't gotten around to it yet. The main reason for this post was to find a quicker, more stable way to run the operating system. Most of the problems I have are not related to playback other than the fact that it sometimes crashes when skipping a video forward or back. I fully believe that the issues I'm having are related to SD cards volatility. They're cheap and easy enough to replace but if I can just hook up a regular HDD and boot from the SD and not have to worry about the card going belly up while I'm gone leaving the kids with no TV, I'll do it.
jb63 wrote:I have all my media on a dedicated network drive, connected directly to a router. That way, I'm not tasking my computer, and OSMC gets the files directly from the network drive.
That would probably be a slight help. However, even when my system is under heavy loads, playing video games, etc, there is no noticeable difference for the performance of video playback on the Pi.
I'm notoriously terrible at being concise.
RaspberryPi 3 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / Kodi v15.2
RaspberryPi 2 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / PleXMBC (wip)

flubbard
Posts: 65
Joined: Tue Dec 08, 2015 12:41 pm
Location: Ohio, USA
Contact: Website

Re: How to optimize my MediaPi?

Tue Dec 08, 2015 3:34 pm

I wouldn't count on moving the os to a hard drive as a way to make the system more stable. If you have trouble with the SD card, I think it will cause you problems regardless, at least during the boot process. I have not found the SD card to be unstable on any of the Pi's I have played with, and that is using the cheapo cards available here at MicroCenter.

I know that there have been some problems with trying to skip on playback depending on the player being used. I've been using Kodi of late (either through OpenElec or direct through Raspbian) and haven't noticed any major problems on this front. I think its more of an issue when dealing with .iso file playback.

As for network performance, I have had problems over time with SMB not being quite as efficient under linux as nfs, just more hiccups. If possible, try sharing using nfs instead and see if you see any difference.

- Barry

gkreidl
Posts: 5953
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: How to optimize my MediaPi?

Tue Dec 08, 2015 3:45 pm

My media are shattered across the network and shared via samba. I can access all of them from kodi but for a much snappier access I use my own simple media server: no database, just directory based, can create playlists on the fly and if the client is running on the same machine it serves file links instead of http streams. A second server manages Sat-TV (including times recordings) and lets me access all TV-Streams everywhere on the network. Everything is accessible from the browser. The whole kweb development was started to provide a fast frontend for my media servers.

Kodi is a great media system and can do lots of things, but most of the time I prefer my simple solution. I don't need media covers, descriptions etc. but simply want to navigate my media as fast as possible and just start a file or a list of files with a simple mouse click.

And yes, running any system from HDD gives a great improvement in speed and reliability. Only people who never tried that can claim the opposite. Ever tried to compile kodi on a SD card? It takes a little bit more than an hour on a Pi2 using 3 cores and running from HDD. Everything needing lots of random file read and write accesses will run up to ten times faster.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

JFamily
Posts: 27
Joined: Tue Aug 11, 2015 1:40 am

Re: How to optimize my MediaPi?

Tue Dec 08, 2015 11:22 pm

gkreidl wrote:And yes, running any system from HDD gives a great improvement in speed and reliability. Only people who never tried that can claim the opposite. Ever tried to compile kodi on a SD card? It takes a little bit more than an hour on a Pi2 using 3 cores and running from HDD. Everything needing lots of random file read and write accesses will run up to ten times faster.
I'm pretty interested in everything you just stated but those are ideas for another day. I'm going to take your suggestions and try setting it up tonight with my SATA/IDE to USB 2.0 adapter and power supply. I don't like the idea of the cable mess so I'll probably order an enclosure for the hard drive after I get everything working. I just tried OSMC on a different SD card... I think I'll stick with Raspbian for now.
I'm notoriously terrible at being concise.
RaspberryPi 3 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / Kodi v15.2
RaspberryPi 2 / SanDisk Ultra 8GB Class 10 / Raspbian Jessie / PleXMBC (wip)

jb63
Posts: 116
Joined: Mon May 11, 2015 6:41 pm

Re: How to optimize my MediaPi?

Fri Dec 18, 2015 2:08 pm

Not sure I agree that HDD is the fastest. I switched to SSD on my windows PCs, and the performance is way better.
Has anyone tried RPI with HDD vs. SSD ?

blc
Posts: 465
Joined: Mon Sep 05, 2011 9:28 am

Re: How to optimize my MediaPi?

Fri Dec 18, 2015 3:09 pm

I agree that switching to a USB HDD is a worthwhile activity if it's a system you plan on keeping active for a while. Usually my Pi's get their OS wiped every time I try a new idea/project, but I'm setting up my Pi2 with a USB HDD as I plan to use it as a general purpose machine. I can't say for certain that switching to a HDD will solve your problems though, not for definite.

I got this enclosure recently: http://www.amazon.co.uk/gp/product/B005 ... ge_o00_s00. It works perfectly on a single USB port with a regular "spinning rust" hard drive, although I have to enable the max USB current so you'd need a good power supply to run it. The power supply I was using was fine without the additional load of the hard drive, but started dropping out when I plugged in the drive and enabled max current.
HiroProtagonist wrote:I don't think you will see any significant performance gain with a solid state drive.
I agree, get a cheap 2.5" HDD - don't bother with an SSD, they are cheap these days but you won't get the benefit.
jb63 wrote:Not sure I agree that HDD is the fastest. I switched to SSD on my windows PCs, and the performance is way better.
Has anyone tried RPI with HDD vs. SSD ?
There really is no point in using an SSD on a Pi. An SSD will be faster in a regular PC because even the oldest SATA standard can theoretically reach a maximum throughput of 1.5 gigabits per second (that's 187.5 megabytes per second); the most recent standard is a whopping 6 gigabits/sec, or 750 megabytes/sec. On the Pi however you're limited by USB2 which has a max theoretical throughput of 480 megabits/sec (or 60 megabytes/sec). And bear in mind that's a theoretical maximum - true throughput speeds will be lower due to CPU, OS & filesystem overheads. Have a look at some benchmarks, even older 5400RPM 2.5" HDDs can achieve 80 megabytes/sec, way over what USB2 can handle. I'm pretty sure I've seen the figure of 40 megabytes/sec throughput mentioned on the forums as being a "good" speed that can be achieved on the Pi, with some optimisation (that's streaming from the Pi over a network).

(And yes I know those figures are sequential read speeds, but we are talking about buffering a video streamed over the network and streaming write benchmarks show similar speeds as streaming reads.)

madigano
Posts: 1
Joined: Mon Aug 29, 2016 5:39 pm

Re: How to optimize my MediaPi?

Mon Aug 29, 2016 5:47 pm

I had a problem with the Pi shutting down randomly during playback (also with fast forward and menu navigation) in Kodi on OSMC.

What fixed my problem was simple and you may have already tried these steps:

1. Connect via Ethernet
2. SSH / terminal into your PI and run

Code: Select all

sudo apt-get update && sudo apt-get upgrade
followed by

Code: Select all

sudo apt-get purge
^ though that might not be necessary :roll:

3. exit terminal and cycle power

-- If this doesn't fix it --

Check your power supply. I turned out to have another unrelated issue where at certain loads, I was overdrawing the power supply and the system reset itself. My combo that worked was a Samsung base charger that came with my Note 4 and a cheap blue microUSB cable. (Sorry don't have specs ATM)

Return to “Media centres”