1. VirtualBox MediaServer
This page was put together 'over time' so 'some assembly may be required'. Typically, I keep notes for my own use. Then I'll rearrange them a bit, add some random rambling and throw it on the net. If you have a decent knowledge of your OS, you might be better of starting with the server and client pages...
First a warning for those interested in running virtual machines:
Running HTPC's or media servers in a virtual machine is asking for problems.
That's mostly due to lack of video support, or some weird and unpredictable behaviour of some applications. You probably want to skip this section and immediately go for the real thing, that is: get yourself a decent PC and turn it into a dedicated server.
well, you have been warned. Read on...
(Well, okay, a box to run VirtualBox on :-))
After installing and setting up your OS it's time to install all other software... Try and test one application at a time, don't go wild!
If (when!) I fall in some specific trap OS related I'll add some notes here.
2009 Windows XP SP3
Ah, my favorite OS to date. Works well, though it's nearing end-of-life. It isn't free and you probably can't even buy it anymore. But it does work on not-the-latest hardware, with some effort :-)
Alas, Windows XP is almost dead (no more patches / updates from April 2014) and you can't buy it anymore, so it's time to look around for something newer.
I cannot say a simple good thing about Vista, just skip it. It's like the 32 bits version of WIndows ME.
You may consider Windows 7 (if you can still obtain a copy) but be aware that you might not be able to run it on onder hardware due to lack of drivers.
Then there's the beast called Windows 8. The Metro interface is horrible, and there are some other limitations, but unless you go for Linus it just might be your only chance... I'm going to try to upgrade my home server (currently running XP) to Windows 8, and see how things go from there.
As I started out with Windows XP, I'll focus on any major differences and add them. I don't expect too many, but still...
Don't ask. I'm pretty much a Windows guy, but I may be forced to go the Linux way... sigh... Will be continued once I'm either comfortable enough, or can no longer affort Windows...
Only install a codec pack if you need one.
I've been using the CCCP for a while, the Combined Community Codec Pack. You'll find it here: http://www.cccp-project.net. There are other packs, and the last release of for example TVersity seems to include one itself, though I haven't tried it.
Make sure your codec pack works well on your OS and hardware. I'm still using CCCP, even on my 64 bit Windows 7 box, but there are many horror stories around.
Now you've collected hundreds and hundreds of files, but how do you organize them? That depends...
This may seem to be entirely a matter of taste, but there are some things to consider. Some software may offer document management features, some other software may force you to name and tag each and every file, whilst other software simply uses the folder structure to present all files to the end user.
My suggestion is to try and organise your folder / file structure as systematically as possible. Assume your server has two drives, C and D. Drive C would contain the OS and all software, and D would contain all media files. The next step would be to organise your files something like this:
D:\mediaThe above works great if you use a single harddisk, but once you end up with a bunch of harddisks, you might adopt something like this:
D:\temp - generic temporary folder... or whatever piques your fancy...
Next when you set up software like TVersity, you can assign specific names / folders / paths / tags / whatever to each folder. And it would be a good idea to keep 'logical' names as close to the real paths, so accessing material through a logical path would be pretty much the same as accessing it through a file share.
Note that some software does not support a dedicated temp folder, for example TVersity. If you use an SSD or USB drive as your boot device, it may be smart to install TVersity NOT in its default place (under C:\Program Files) but on another drive (D:\TVersity or something similar).
Obviously you may want to consider more than one user, and you may not want your average user to delete or rename your files in which case make sure you give that specific user only Read Only rights.
By organizing stuff from the start, you'll have an easier time finding things back, no matter how you access them. For example, here are some devices browsing my mediaserver, either through TVersity UPNP or Windows shares.
A PC (or HTPC) accessing Windows shares:
Some file formats allow you to enter meta data, for exmaple the MP3 file format supports all sorts of tags. Some player software can use the folder structure, but sometimes it can not so you'll be forced to check all tags in your files...
MP3's are the prime candidates for such a treatment. If your folder / file structure is consistent, you could use a program such as MP3Tag to replace the existing tags in your MP3 files.
Some AVI and MKV files seem to support their own flavour of tags, sometimes accessible through file properties, but if not I have no idea how to manipulate them.
If you run multiple services on your server, such as TVersity, Servioo, SqueezeServer etc. all these programs allow you to specify a name, under which they can be found on your network. Use sensible names. Here's what I might use on a server on 192.168.0.72:
6. Stuff that won't run as a service
Many applications won't run as a 'service'. Blame it on Windows, or blame it on the programmer, but fact is a fact. If you want to run some programs, you have to be logged in as administrator. This obviously is a bit of a security risk, especially if you use your server for other purposes as well.
Unfortunately, there's no real and 'proper' solution. All you can do on Windows XP is allow fast user switching, then, on startup, automatically login as a specific user, execute what you need, then return to the login-screen, whilst everything you started keeps running in the background. Who said this was a perfect world?
Anything that would run as a service (and would make sense to run as a service) I set up that way. Everything else I start using a batch file.
Here's what I did:
tskill squeezeslaveIt's possible to fancy up things. By inserting some delays the actual boot time decreases (ie. launching programs do not compete for resources). I also rearranged all windows to have a better quick overview of what's running and what not. And sometimes 'start' works fine, but not always and then I have to fall back on psexec.
Fooling around a bit with cmdow and nircmd (and I wouldn't bother too much with the 'wait' statements, they were just minor improvements, and don't really matter when using Wake On Lan or SSD's...) Here's an example startup batch file:
cmdow @ /TOPThe two interesting programs here are mircmd and cmdow.
Nircmd is a kind of all-in-one toolbox, which was many different functions. Including a very simple 'delay' function (which doesn't eat up timeslices).
Cmdow is often blacklisted as a 'hacker tool', just like netcat. Cmdow in itself is simply a little command line tool that allows you to do all sorts of things to Windows. Including moving or hiding them. It has been abused by malware programmers to hide windows from the user, hence the blacklisting.
Power saving is an issue. First, make sure you won't waste too much energy by picking the right hardware...
the next sections if power management is not your thing, and you've
got lots of money to burn :-)
7.1 Windows XP
Things may not work as expected, depending on your hardware and configuration! That out of the way, here's the issue:
Another problem is how to wake up the machine. You cannot let your PC wake up on any network traffic as there will be other devices on your network generating network traffic. If you have a better router with an option to assign a route to redirect all traffic for a specific IP to a specific port (and filter out anything else, including 'broadcasts') this might work but I'm pretty sure (for the majority of us) it won't. It would have been great if the software applications and hardware clients would generate a WOL whenever they need some data, but alas, there's hardly any mediaplayer that's able to generate a WOL message and the same goes for 99% of the software.
here's the choice: either implement WOL with magic packets, and accept
thatyou may have to 'wake up' your server (though it may wake up accidentally),
or leave your server up and running all the time. I've calculated my own
usage, and I would save 50 euro per year in energy costs by using WOL.
Thus, WOL it is.
Hardware warning for 'standby'
once you go into standby, all your hardware except network card and memory
is off. Or is supposed to be off. I've seen a few machines that kept their
fans spinning. If that is a good or bad thing I'll leave up to you.
What is WOL?
WOL, WakeOnLan, Wake On Lan... clear as any marketing slide ever... (Check out Don McMillan!)
Most network cards offer two options for wake up: wake up on either a 'magic packet', or wake up on any traffic.
By sending a special message to your server you can switch it on. This message is a so called 'magic packet'. If your server supports 'power saving' modes (stuff called S3, S4 etcetera) and your network card supports WOL you can wakeup your server whenever it's needed.
could opt for waking up the server on any traffic, but for all practical
purposes that means your server keeps waking up all the time. Thus never
goes to sleep.
Hibernation versus standby
In hibernation your machine saves all memory to the harddisk, then shuts down everything except all electronics related to WOL. Not all machines like or recover well from hibernation, you have to test this for yourself. Advantage: power outages will not bother your PC (it's off anyway) and power consumption will be fractionally lower. Disadvantage: slow restart, more wear and tear on your harddrives. Return from hibernation may spin up all your drives, even when not necessary. (On my machine it does.)
In standby mode, your machine doesn't save all memory to harddisk, but instead keeps memory alive and under power, yet shuts down pretty much everything else (except for WOL related stuff, obviously).Not all machines like or recover well from standby, you have to test this for yourself. Advantage: quick restart. Disadvantage: power failure will make you lose non-saved data. Return from standby may spin up all your drives, but then again it may not. (On my machine it spins up the boot drive just before going into and immediately after going out of standby mode, other drives stay silent.)
Your mileage may vary.
On my test-setup, using a Core i3, 4 GB Ram, on-board audio and graphics, an old power supply and 3 harddrives, I got the following power consumption figures:
This is using regular drives. I should try again using an SSD and a better quality power supply.
These settings depend on your preferences. After fooling around with them I settled for two hours, looking at the typical usage by my users (read: my family).
(The exact location / naming schedule depends on your version of Windows, but this should give you a clue where to look.)
may not make much sense, as the power difference between hibernation and
standby was marginal. Still, I would have liked to hibernate after let's
say 72 hours, but that isn't possible AFAIK.
Hybrid Sleep in Windows 8...
... messes up everything... so...
(The exact location / naming schedule depends on your version of Windows, but this should give you a clue where to look.)
Getting the server's MAC address
C:\> ipconfig /all
Wake-up on the local network
On an iPad, install mWOL by Mocha, and enter the IP address and MAC address you've found. Hit the 'Wake up' button to wake up your machine.
On Android, install WOL by Ben Finnigan, enter the IP address and MAC address, etcetera.
When using mcwol:
Here's an example batch file which waits until a specific machine is awake:
ping 10.151.0.72 -n 1 -w 5000
ping 10.151.0.72 -n 1 -w 10
if errorlevel 1 goto loop
If you need a batch file that's a little more refined output wise, try this one: (it also seems to handle timeouts better, but better check out the Internet for proper wakeup scripts)
There are multiple options to keep the server alive. Which option is the best for you depends on the situation. A few options...
The SqueezeBox server has an option to stay awake whilst music is playing. Though transcoding tools like Serviio and TVersity don't seem to have such an option, the transcoding itself should provide enough CPU load to keep the server awake.
simply serving files from a Windows share may not keep your (Windowx
XP) server awake. I haven't found a good solution for this problem, server
side wise. You could keep sending WOL packets as long as the client application
is awake (I think XBMC has such an option).
You might also have a look at the MCE
Standby Tool, which offers a function Windows idle / Maximum allowed.
The higher you set it, the less likely it will be for Windows to shut down.
Obviously, setting it too high will keep Windows from going asleep...
Wake-up from the Internet
If you want to access data on the server from the Internet (because you're simply elsewhere) things can get tricky. If you're on ADSL with a fixed IP address, do this:
Wake-up from the Internet using a FritzBox
If you own a Fritzbox router, you're not allowed to forward to anything like x.x.x.255, but the Fritzbox offers another option:
Solution: disable or manually switch on / off (the rules for) those forwarded ports. You may have to manually enable / disable those rules, enable uPNP, or accept slightly slower speeds and less sources without those ports forwarded, however in most cases you won't have to do a thing, the NAT protocol in the router will take care of it.
leaves you with a funny setup: local users need to wake up the server,
whilst it wakes up automatically for a remote users accessing it
from the Internet.Yeah, the computer industry still has to think a bit
harder on this energy management / WOL stuff... (Why not implement WOL
as part of Windows as a kind of fall back scenario?)
What if it all doesn't work?
Yeah, those things happen. I'm running into a strange issue myself, where my server goes to sleep fine if I keep the time out short (for example standby after 5 minutes works fine). Yet, when I set it up to go to sleep after 2 hours, it rarely does... One of the installed applications must be doing a periodic scan or something messing up the idle detection. (I think it was Serviio, but strange things do happen.)
Still, I want to save some energy! So to this end I cooked up this elaborate scheme, which handles a multitude of problems... (Hey, I'm good! :-))
C:\> %windir%\system32\rundll.exe powrprof.dll,SetSuspendStateNote: with hibernation enabled the machine will go into hibernation, not into standby. With standby enabled and hibernation disabled it will go into standby.
To shutdown the server at 03:00, I call a batch file containing the following:
taskkill /IM javaw.exe /F /TEither ServeToMe or ImageBank needed killing the Java engine (I forgot which one :-)) and the Serviio lines are no longer required since I uninstalled Serviio.
So, here's what happens:
If your server is somewhere where you do not have immediate and convenient access to it (attick, garage, broom closet etc.) then install a remote management tool like VNC. It allows you to remote control your server, and you definitely want that! There are many flavours of VNC. TightVNC seems to work well for many people.
installing VNC on the server, install it as a 'service' to keep it running,
no matter if you're logged in or not.
Windows XP / Windows 7 / Windows 8