Video Plugin

This plugin is written for the Groovy on Grails web application framework, and intends to make it relatively easy to add flash video capabilities to a Grails project. The goals of this plugin are as follows:

  • Host and manage Flash movies
  • Provide an easy mechanism to convert standard movie formats such as Quicktime, MPEG, etc. to the Flash movie format (FLV)
  • Perform movie conversions (i.e. MPEG -> FLV) asynchronously
  • Provide mechanisms for streaming and recording FLV video
  • Provide options for video players
  • Use open source technologies

To achieve these goals, the plugin provides services to manage movie files for a Grails application. For the first revision of the plugin, the focus is on the conversion process for a newly uploaded movie and providing some basic HTTP streaming of the movie. Later revisions will integrate with Red5 and provide more advanced streaming and video capture capabilities and well as integration with the fabulous Amazon S3 Plugin to store FLV videos in a cost effective manner.

This plugin uses the following applications to provide the video capabilities:

For Intel Mac users, you can download precompiled binaries for FFMPEG and YAMDI using the link below:

ffmpeg-yamdi.zip

Features

The initial revision of the plugin focuses on managing/converting/displaying user uploaded video. As such it provides these features:

Current Features

  • Grails Service artifact that provides asynchronous (background) conversion of movies to the flash format
  • Storage of a digital master copy of the movie for later resampling of the video asset
  • Two options for Flash video players (JW FLV and Flowplayer) to display the uploaded flash video via a new GSP tag (see example below)
    • <vid:display movie='${movie}' player="jwflv" stream='true'/>
  • Streaming Flash video via HTTP streaming for large flash video
  • Small MVC application included to manage videos to serve as an administrative utility as well as a reference application that makes use of the Grails Video Service (VideoService) and options for the video players

To achieve the goals mentioned above, we are also planning several more features to be released in the near future.

Planned Features

  • Enhanced FLV metadata and thumbnail creation (does this include the output of multiple resolutions
  • Use of the Amazon S3 Plugin to store the video assets
  • Integration with Red5 for RTMP streaming and recording of flash video
  • Security integration with Acegi or JSecurity plugins to manage access control lists on Video assets
  • Reporting on Video usage
  • Pre and post roll ad management

Requirements

This plugin was built using the Groovy on Grails version 1.0 RC1. We will make every effort to update the plugin to the final 1.0 release when it is out. The plugin has also been tested against Groovy 1.0 and the latest release candidate for Groovy 1.1. The plugin comes bundled with the copies of Flowplayer and JW FLV Players. Please visit their respective sites (see links above) for licensing.

Installation

  1. Download the latest version of the plugin using the link below: grails-video-0.1.zip
  2. Download the binaries for YAMDI and FFMPEG and save to a safe folder.  Refer to the links above for binary distributions on various platforms.
  3. The plugin depends on the Grails Quartz plugin version 0.2 or higher. To install that go to your Grails application and type: grails install-plugin quartz
  4. Install the plugin: grails install-plugin <path to your downloaded plugin zip>

Upon review and acceptance from the Grails community we will move the plugin to the official Grails plugin repository located at http://svn.codehaus.org/grails-plugins/.

Configuration

The plugin makes use of whatever datasource the application has defined for database access, as all videos entered into the system are managed using a domain class called Movie. The plugin also requires specific configuration information to be able to use FFMPEG and YAMDI. This configuration should appear in your application’s Config.groovy file. An example of this configuration is given below:

video {
    location="/movies/"
    yamdi {
        path="/media_coders/yamdi"
    }
    ffmpeg {
        path="/media_coders/ffmpeg"
        convertflv="-b 600k -r 24 -ar 22050 -ab 96k"
        makethumb="-an -ss 00:00:03 -an -r 2 -vframes 1 -y -f mjpeg"
    }
}

A description of each of these configuration elements is given below:

video.location The location on the local file system to store the uploaded and converted movies
video.yamdi.path The absolute path to the yamdi executable on the file system
video.ffmpeg.path The absolute path to the ffmpeg executable on the file system
video.ffmpeg.convertflv The parameters to pass to FFMPEG for the FLV conversion process. This includes such parameters as sampling rate, bit rate, etc. See FFMPEG documentation for more information
video.ffmpeg.makethumb The parameters to pass to FFMPEG for the thumbnail creation process, see FFMPEG documentation for more information

Licensing

This plugin is open source and is licensed under the Apache License, version 2.0

Feedback

The Grails community has been an amazing resource during our own development with the Groovy and Grails framework and we welcome (and hope for) feedback from the community on the design and purpose of the plugin as well as possible usability and performance enhancements. We’re constantly checking the Grails Mailing Lists for comments and feedback on the plugin. You can also reach us through our Contact Us form.