Saturday, March 27, 2010

Misc 16

We'll now set up Music and Video streaming. This can be done through an apache mod known as ampache. Ampache uses MySQL to store user and media information and is mostly configured through a web-based GUI. Users also access the streaming server through a web-based GUI.
Make sure apache is installed. Then, install ampache:
apt-get install ampache

During installation, you will be prompted to enter a password for the root MySQL user. Remember this as you will need it to configure ampache properly later on. For this purpose, I'll use "root" as the password. Next, select to automatically configure apache2.

Once it's done, you'll need to configure the ampache server. To do this, connect to localhost or from another system. If you're using a non-GUI system, you can the built-in use www-browser to access the web:
www-browser localhost/ampache

After clicking on "Start configuration", scroll down and enter the parameters as follows:

Desired Database Name: ampache
MySQL Hostname: localhost
MySQL Administrative Username: root
MySQL Administrative Password: root
Create Database User for New Database? * (tick)
Ampache Database Username: ampache
Ampache Database User Password: ampache
Overwrite Existing: * (tick)

Finally, click Insert Database to proceed.

Now you will need to enter the MySQL username and password for the ampache database. This will be what you specified at the previous screen. For me, I'm using ampache:

Web Path: /ampache
Desired Database Name: ampache
MySQL Hostname: localhost
MySQL Username: ampache
MySQL Password: ampache

When you click on Write Config, you will be able to save the ampache.cfg.php file. This file is to be placed in /etc/ampache/. If you're using www-browser, you'll have to press "S" (Shift+s) to save the file. Save it as ampache.cfg.php. (For www-browser, type "B" (Shift+b) to go back)

Now scroll down and click on the verification button. Both boxes should show "OK". When that's the case, proceed to step 3. At step 3 you just have to create an admin account that will be used for the first logon.

When you're done, access the server from a real web browser and it should be all working and dandy.

One of the first things you need to do is to add a catalogue. To do this, create a folder to contain your music or videos (videos are supported only from version 3.5. If you're running 3.4.1, videos are not officially supported and you'll have to add the extensions into ampache.cfg.php yourself for it to work properly). For me, I'm using /etc/ampache/music/. Inside the music folder, I have the follow structure:
Artist/Album/Track Title.mp3

To add a catalogue, click the grey chassis on the left navigational panel and click on Add a Catalog. According to my folder structure, I should have these settings:

Catalog Name: Music
Path: /etc/ampache/music/
Catalog Type: Local
Filename Pattern: %T %t
Folder Pattern: %a/%A

I'll now add video files into the directory. To do this, you'll have to add the extensions that you want in ampache.cfg.php under catalog_file_pattern. When you're done, it's time to add a catalog for videos like how you added it for audio.

Note that video will only work when it is streamed in a media player. The flash player only supports playing of mp3 files (or files transcoded into mp3).

Note that if you've set up apache2 for SSL support, you can also access the site through https.

No comments :

Post a Comment