Video encoding made easy with AWS
Перейти к файлу
Martyn Loughran 9a33fc5369 Sanitycheck Panda config on load and clean up the example config file
* Clearer example config file with more documentation
* Made defaults more sensible.
* Checks that all required config options have been set
* Warns if no encoding profiles exist.
2008-10-10 16:37:56 +01:00
app Sanitycheck Panda config on load and clean up the example config file 2008-10-10 16:37:56 +01:00
benchmarks Benchmark tests for RVideo capture_frame. 2008-10-07 18:22:49 +01:00
config Sanitycheck Panda config on load and clean up the example config file 2008-10-10 16:37:56 +01:00
lib Sanitycheck Panda config on load and clean up the example config file 2008-10-10 16:37:56 +01:00
log Created log dir 2008-09-24 13:19:19 +01:00
public Nice style for the 'pick a thumbnail' pages (was unstyled). 2008-10-09 16:32:55 +01:00
script Initial import from our internal version of the Panda HQ application 2008-06-05 21:41:11 +01:00
spec Sanitycheck Panda config on load and clean up the example config file 2008-10-10 16:37:56 +01:00
.gitignore Integrated Clipping object into existing code (removed lots of code from Video) 2008-10-07 17:09:14 +01:00
LICENSE more explicit license 2008-09-16 21:55:48 +01:00
README rescue everything! 2008-08-04 10:59:11 +01:00
README_EC2 - Changed root dir from /usr/local/www to /var/local/www. We will soon to update AMI,too. 2008-09-23 15:52:02 +01:00
Rakefile encoder could work now, but needs intense refactoring 2008-06-11 23:06:21 +01:00
panda.god Add notifier to God recipe. 2008-09-30 16:04:27 +01:00
panda_nginx.conf.example - Changed root dir from /usr/local/www to /var/local/www. We will soon to update AMI,too. 2008-09-23 15:52:02 +01:00

README

Panda is a Merb app which runs on a special EC2 instance to encode videos for you. Uploaded videos are stored on S3 with a small amount of info kept in SimpleDB. The REST API makes it easy to integrate user video uploading into your web application.

How does Panda work?
====================

1. Video is uploaded to panda
2. Panda checks the video's metadata, uploads the raw file to S3 and adds it to the encoding queue
3. The encoder application picks the encoding job off the queue when it's free and encodes the video to all possible formats
4. Panda sends a callback to your web application notifying you the video has been encoded
5. You use the S3 url of the encoding you want to show to your users

Installation and setup
======================

Gems
----

Merb 0.9.2
S3 (http://amazon.rubyforge.org/)
SimpleDB (http://nytimes.rubyforge.org/amazon_sdb/)

gem install merb merb_helpers activesupport RubyInline amazon_sdb sqs

Other deps
----------

# libjpeg
http://www.ijg.org/
http://www.libgd.org/FAQ#gd_keeps_saying_it_can.27t_find_png_or_jpeg_support._I_did_install_libpng_and_libjpeg._What_am_I_missing.3F

# libgd
http://www.libgd.org/Main_Page

RVideo
------

Build gem from svn://rubyforge.org/var/svn/rvideo/trunk with `rake install_gem`.
Then `sudo cp lib/rvideo/tools/*.rb  /Library/Ruby/Gems/1.8/gems/rvideo-0.9.4/lib/rvideo/tools/` on OS X.

FFMPEG
-----

Available in all good package repositories including Darwin Ports.

If you're developing on Mac OS X, you can grab ffmpeg out of the ffmpegX application instead of compiling it: http://www.macosxhints.com/article.php?story=20061220082125312

Configuration
=============

Encoding profiles
-----------------

    Profile.create!(:title => "MP4 SD",   :container => "mp4", :video_codec => "mpeg4", :video_bitrate => 300, :audio_codec => "aac", :audio_bitrate => 48, :audio_sample_rate => 48000, :width => 320, :height => 240, :fps => 24, :position => 2, :player => nil)

    Profile.create!(:title => "Flash video SD",  :container => "flv", :video_bitrate => 300, :audio_bitrate => 48, :width => 320, :height => 240, :fps => 24, :position => 0, :player => "flash")
    Profile.create!(:title => "Flash video HI",  :container => "flv", :video_bitrate => 400, :audio_bitrate => 48, :width => 480, :height => 360, :fps => 24, :position => 1, :player => "flash")
    
    Profile.create!(:title => "Flash h264 SD",   :container => "mp4", :video_bitrate => 300, :audio_codec => "aac", :audio_bitrate => 48, :width => 320, :height => 240, :fps => 24, :position => 2, :player => "flash")
    
    
    Profile.create!(:title => "Flash h264 HI",   :container => "mp4", :video_bitrate => 400, :audio_bitrate => 48, :audio_coded => "aac", :width => 480, :height => 360, :fps => 24, :position => 3, :player => "flash")
    Profile.create!(:title => "Flash h264 480p", :container => "mp4", :video_bitrate => 600, :audio_bitrate => 48, :audio_coded => "aac", :width => 852, :height => 480, :fps => 24, :position => 4, :player => "flash")

Further information
===================

Investigating encoding errors
-----------------------------

When an encoding fails the status of the video is set to 'error' and the output of ffmpeg is saved on S3 with the filename video_token.error

SimpleDB schemas
================

Videos
------

    filename # 976a4b00-16cc-012b-7316-001ec2b5c0e1.flv
    original_filename # sneezing_panda.flv
    parent

    status # original, queued, processing, done, error

    duration
    container
    width
    height

    video_codec
    video_bitrate
    fps
    audio_codec
    audio_sample_rate

    profile # id of encoding profile used
    profile_title

    updated_at
    created_at

Encoding profiles
-----------------

    title

    container
    width
    height

    video_codec
    video_bitrate
    fps
    audio_codec
    audio_bitrate
    audio_sample_rate

    updated_at
    created_at