External Storage

Media Factory provides storage by default on it's own infrastructure, through a combination of private a data center and Amazon S3. It possible however, to configure Media Factory to use your own infrastructure for media storage and delivery.

If you choose to completely host your media yourself, you have the choice to set this up using the External Storage settings found under Settings > External Storage in Media Factory. If you cannot find it, it probably means it has been disabled for your account. Contact Filemobile support for a resolution.

In this interface you can setup a new storage profile.

Amazon S3

If you would like to use your own Amazon S3 account instead of Media Factory, you can do this here. You need to specify an S3 Access key, your secret key and a (precreated) bucket.

The basePath is used to prefix all the file names. While you can specify your own basePath, the only basePath that is actually compatible with Filemobile is '/storage/'. So unless you have a special purpose for the external storage system, be sure to always use /storage/ here.

FTP

If you choose FTP, you must also make sure you are able to serve the media using HTTP. So in this case, you'll need at least a webserver with scripting support, as well as an FTP server. For SFTP, you will need an SSH server.

After creation, the following information is requested (all of which is required).

FieldDescription
HostnameThe domain name of your FTP or SSH server.
TCP portUsually this is 21 for FTP or 22 SFTP, but if your server is running on a different port, change it here.
UsernameThe username to access your server.
PasswordThe password for the account.
Base pathIf the files need to be in a subdirectory, you can enter it here. If you preceed the base path with a /, it will be relative to the root of your server, otherwise it will be relative to the login directory.
Directory structureSee below.

Directory Structure

If flat is chosen for a directory structure, all files will be thrown into one directory. While this is fine for a small amount of files, if you plan to exceed more than a few hundred files it is highly recommmended to choose hash2. The hash2 structure ensures that your file system stays very fast. The only reason you would not want to use it is if you use a btree-based filesystem, which is very uncommon as of 2010.

The hash2 uses the ID of the file to get an md5 hash. (for example fcea920f7412b5da7be0cf42b8c93759 for file id 1234567). The first 8 characters are then used to generate a 4-level deep directory name. In the example of 1234567, we would store the file in a directory named fc/ea/92/0f. The ensures that no more than 256 subdirectories are created in every directory.

Now, if we assume that 1234567 was a jpeg, the following files will be created:

fc/ea/92/0f/1234567_11.jpg
fc/ea/92/0f/1234567_12.jpg
fc/ea/92/0f/1234567_13.jpg
fc/ea/92/0f/1234567_14.jpg
fc/ea/92/0f/1234567_15.jpg

Serving the files

The problem with serving media files, is that the URLs used for accessing the files are completely different from the URLs used to store the files. For this reason you are forced to host a script that maps the urls to their respective paths.

The urls expected by the media serving system look like the following:

media.example.org/storage/1234567/11
media.example.org/storage/1234567/12
media.example.org/storage/1234567/13
media.example.org/storage/1234567/14
media.example.org/storage/1234567/15

As you can see, it is also missing the extension, which requires you to actually do a directory scan to find the appropratiate file.

We have provided a PHP script that does all these things, and it's freely downloadable:

fmstorage.zip(v0.2)

Last steps

Configure Transcoder Profiles:

If you've verified your settings are entered correctly, you can now change the External Storage location for each of the transcoder profiles in your Media Factory project. The list of profiles can be found under Settings > Media Transcoder. This will make the transcoders send the files to your infrastructure. Note that you can send files to multiple locations.

Configure Storage domain name:

Enter your storage domain name in the Storage domain field under Settings > Project Settings.

Be advised that any previously uploaded files to a different storage profile will now no longer be accessible. It is therefore wise to have everything setup before your project starts.

0 comments

Be the first to comment on External Storage.

Add a Comment

  • captcha