How to Set Up Drupal 6 to Use Amazon S3 and Zencoder for Video
So I recently decided that I'm going to try to do at least one video tutorial per month (hopefully more, but it's a start). I decided that it might be better to use a content distribution service to host my videos, even though my server is more than capable of it. Amazon has the infrastructure already in place to provide fast access to my content and the fees are relatively low. This makes their S3 a perfect place to put those items that might cause a bandwidth and resource usage spike.
For encoding videos to Flash, I can do it on my local machine if I want to, but ffmpeg is quite a resource hog when doing conversions. My server is capable of doing it, but I didn't want to have to schedule conversions during off-peak hours. I wanted to be able to upload videos from wherever I might be, so I decided I would use an online encoding service. Zencoder is good, quick, and inexpensive, and so I went with them. (And they also have full integration with the Video module.)
I'm going to show you how to set up Drupal 6 to use both of these services with the Video module. Let me know if it seems like I left something out. I tried to take good notes along the way and take screenshots.
1. Sign Up With Amazon S3
Go to http://aws.amazon.com/s3/ and sign up for an S3 account. It's pretty straightfoward.
2. Get Access Credentials
After receiving the email, you can follow a link to where Amazon gives you the access credentials for the S3 API. You will need these later, so write them down.
3. Create a "Bucket" for Your Content
Amazon calls the storage containers in S3 "buckets". Think of these like subdomains to a website. When creating a bucket, the name must be unique. What happens is the URL to your content stored there will be something like bucket.s3.amazonaws.com/whate.ver.
You will also need to add permissions for Zencoder. The user you need to specify is aws@zencoder.com.
4. Download and Install Modules
You will need to get two modules for Drupal.
If you are doing a fresh Drupal installation, or have one of those odd sites that doesn't use CCK and Views, you will need them, too. You will also need Filefield if you don't already have it.
After extracting the tarballs into your /sites/all/modules (or replace all with your domain or default if you use those), go to admin/build/modules and enable the following:
- Flowplayer API
- Amazon S3 on Video
- Video
- Video Upload
- Zencoder API on Video
5. Configure Video
Now we get to the fun stuff.
Remember that I said to write down your S3 keys or do something so you could find them later? Here's where you need them. The first thing you should do is set up Amazon S3 in the Video module.
Next, you should set what transcoder you want to use. Unless you have the resources, I recommend just using Zencoder, especially if you are on a shared server. Use a valid email addres, and your Zencoder account will be created automagically.
You will receive a link in your email to your new Zencoder account. The Pay As You Go subscription should be plenty for most people. Keep "Integration Mode" turned on until we know that everything is set up correctly.
Next, we need to choose the video player for different formats. Since Zencoder is going to return Flash videos, that's all we're going to worry about.
6. Add or Edit a Content Type for Video
Now we're getting somewhere! What you need to do now is go to admin/content/types. You can create a new content type just for video, or you can click the "manage fields" link on an existing content type to add a Video field to it. The choice is yours.
Either way, you going to add a new field of the type FILE and choose the element VIDEO.
Configure the field to your liking, but you will need to be sure to enable video conversion.
I didn't take a screenshot here, but under the General settings tab, I recommend enabling "Video Convert on Node Submit". This way, your video is queued at Zencoder for encoding as soon as possible.
7. Create a Node With Your Video
Finally, you get to make use of everything you've done so far. Go create a node like you normally do. This time, you'll see an option to upload a video.
Now, unless you use the Scheduler module to control when nodes are published, I recommend unchecking "Published" before clicking Submit. This way, you can wait until your video is actually available to publish the node. My 6 minute video on Facebook ads took about 10 minutes to complete. I believe it should still submit it if you use the Preview button, but you should still wait until the conversion process is done to actually publish the node.
So there you have it! Let me know if you have any questions or need any help.