Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Video encoding made easy with AWS. Panda is now also available as a hosted service! Check out the site for more details.

This branch is 70 commits ahead, 36 commits behind zortnac:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
benchmarks
bin
config
lib
log
public
script
spec
.gitignore
LICENSE
README
README_EC2
Rakefile
panda.god
panda_nginx.conf.example

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 uuid

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

Grab the source, build, and install

  mkdir -p ~/src && cd ~/src
  wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
  tar zxvf jpegsrc.v6b.tar.gz
  cd jpeg-6b && ./configure && make && sudo make install

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

Grab the source, build, and install

  mkdir -p ~/src && cd ~/src
  wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
  tar zxvf gd-2.0.35.tar.gz
  cd gd-2.0.35 && ./configure && make && sudo make install

RVideo
------

Grab the source and build the gem:

  git clone git://github.com/jaikoo/rvideo.git
  cd rvideo
  rake install_gem

Install the rvideo tools (on OS X at least; your system may differ)

  sudo cp lib/rvideo/tools/*.rb /usr/lib/ruby/gems/1.8/gems/rvideo-0.9.4/lib/rvideo/tools/

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

Something went wrong with that request. Please try again.