Flash media server

I’m a bit of a geek, so I have lots of mobile gadgets. I’m also into Movies and (good) TV shows. I have archived many of my DVDs at home onto a server, so I have a lurvely home cinema setup throughout my flat. The only problem is that I want to watch these movies on my aforementioned gadgets.

Now option 1 is to copy the files over whenever I want them. Unfortunately I never quite know what I’ll want to watch, and I can’t carry all several TB around with me…

For some files I can just browse (via my shiny new VPN) to an Apache service and download/stream them off that. But what about the high quality DVD backups? And I recently moved to mkv as a container, and most mobile toys can’t handle .mkv files. Flash is a nice standardised (well, nice may not quite be the word…) protocol/media format. One option would be to transcode all the files. But that’s just stupid. In order to stream on my 1.5MBps up pipe I’m going to have to transcode the quality down a fair bit, and I don’t want to either lose all my nice high quality files nor have 2 copies of every file.

What I really needed was something which would stream, and transcode on the fly. Unfortunately such a thing didn’t exist, for free, anyway.

But fortunately, as previously stated, I am a geek. And a geek on holiday…

So, I have written FlashServer. The language of choice is C# as that way I get help from .Net for a load of things, and as I’m going to be throwing around a load of strings, I can’t be bothered with C++. Plus, with Mono I can develop on Windows and run on both Windows and Linux – useful as my linux server doesn’t have X…

The result: after around 24 hours of work, I now have a working web server, which allows me to browse specified ‘shares’, and stream movies off them – movies which are transcoded into flash on the fly. Performance seems sufficient for my 1-2 user use-case. There’s no rate limiting, so streaming it will use up a lot of the ‘up’ bandwidth – I may add that at a future date as it will be easy enough. Transcoding is done by ffmpeg, with specific settings set either via a couple of hard-coded profiles, or able to be chosen at start time. There’s no fast-forward or rewind, although you can start your playback from an arbitrary location.

The source is available for download (in MS VS Express 2010 solution format) from here. Note that you will need Inno Setup in order to use the installer (and will need to change paths etc).

Windows users, feel free to try the installer. FFMPEG is bundled with it in exe form. You’ll still want to tweak the conf file before use though. Note that .Net Framework 4.0 is used – install it from: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992&displaylang=en

For linux users, and those who don’t want to use the installer, a zip is available. This contains the .exe, a readme, and a sample config file. Please read the README, as you’ll need to point to your installation of ffmpeg. Terrifyingly, the program worked first time with mono, so something will undoubtedly go cataclysmically wrong at some point…

Please let me know (by a comment below, or email: flashserver at ianpeters.net) if you use this, and if you have any feature requests!

Those links again:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s