| 17 | | Video transcoding, even on good hardware, is a time-intensive task. |
| 18 | | So any CMS that wanted to support embedded video would probably need |
| 19 | | to run the encoding job in an asynchronous process anyway. On systems |
| 20 | | that do support asynchronous production processes, like Mir, you |
| 21 | | probably wouldn't want to put big encoding jobs into the queue anyway, |
| 22 | | because no one wants to wait 20 minutes for a video to finish encoding |
| 23 | | when they need to update the startpage. Running the video encoding in |
| 24 | | a separate process also allows the encoding process to get "nice'd" |
| 25 | | to an appropriate priority so it doesn't bring down your server. |
| 26 | | It also means that it is very easy to graft support for embedded |
| 27 | | video onto any existing cms that stores video in the file system. |
| 36 | | * Python 2.4 or higher |
| 37 | | |
| 38 | | * Flowplayer, available from http://flowplayer.sourceforge.net |
| 39 | | |
| 40 | | This provides a nice embedded flash video player, you should |
| 41 | | download a copy and put a copy on your web site. |
| 42 | | |
| 43 | | * Mencoder, the Mplayer video encoder/decoder swiss army knife. |
| 44 | | |
| 45 | | This is better than ffmpeg because it is designed to handle |
| 46 | | any proprietary cruft that your users throw at it. |
| 47 | | Get it from www.mplayerhq.hu, or, for debian packages, from |
| 48 | | www.debian-multimedia.org |
| 49 | | |
| 50 | | * FLVTool2, http://inlet-media.de/flvtool2 |
| 51 | | |
| 52 | | You need to be able to write some metadata to the file so |
| 53 | | users can seek during playback. This ruby program does the |
| 54 | | trick (make sure you've got ruby installed!) |
| 55 | | |
| 56 | | * Cheetah template library for Python. |
| 57 | | |
| 58 | | You can get this from http://www.cheetahtemplate.org/, or just |
| 59 | | 'apt-get install python-cheetah' |
| 60 | | |
| 61 | | * Twisted networking - |
| 62 | | You can get this from http://www.twistedmatrix.com |
| 63 | | or 'apt-get install python-twisted' |
| 64 | | |
| 65 | | * For OggTheora support, you need ffmpeg2theora and Cortado applet |
| 66 | | |
| 67 | | How do I set it up? |
| 68 | | ------------------- |
| 69 | | |
| 70 | | First, you need to open up indytube.conf and change the config variables |
| 71 | | to something sensible. |
| 72 | | The default path for this file to live on a production server is |
| 73 | | /etc/indytube/indytube.conf |
| 74 | | |
| 75 | | Here you need to set the paths for your orginal and encoded files, plus |
| 76 | | urls for the resources like the flowplayer files and your splash |
| 77 | | screen image(an Indymedia one is included here if you need one). You |
| 78 | | can also tweak the encoder options(sensible defaults are included for |
| 79 | | small video files and quick encoding with decent quality) and turn off |
| 80 | | encoding altogether. There's logging settings for debugging, and a |
| 81 | | way to specify the maximum number of encoders you'd like to run in |
| 82 | | parallel, and at what priority. |
| 83 | | |
| 84 | | You also might want to customize the include.template, which is used |
| 85 | | to generate a fragment to be included in any page with video. The |
| 86 | | basic idea is that the cms template is tweaked to pull in this |
| 87 | | template, which does nothing if it isn't there, and also to include a |
| 88 | | "waiting for encoder" message, which a bit of javascript in the |
| 89 | | generated include fragment "turns off". |
| 90 | | |
| 91 | | An example, for mir, might make this more clear. What you need to do |
| 92 | | is go into the place in the article template where the link to the |
| 93 | | video file attached to an article happens, and add something like: |
| 94 | | |
| 95 | | <div id="waiting4encoder${media.id}"> |
| 96 | | <i>Waiting for encoder...check back in 10 minutes for flash version.</i> |
| 97 | | </div> |
| 98 | | <!--#include virtual="/media/${media.creationdate.formatted["yyyy/MM"]}/${media.id}.flv.inc" --> |
| 99 | | |
| 100 | | Make sure that the "waiting4encoder" div preceds the include file! |
| 101 | | Notice you can also put something like: |
| 102 | | |
| 103 | | <!--#config errmsg=" " --> |
| 104 | | |
| 105 | | if you want to suppress the [an error occurred while processing this |
| 106 | | directive] stuff that will happen while you're waiting for an encoder. |
| 107 | | |
| 108 | | Then, just set up indytube.py to run every minute or so out of cron. |
| 109 | | If the maximum numbers of encoders are already running, it just |
| 110 | | stops. Otherwise, it will check for video files in the directory |
| 111 | | you've specified, see if they've already been encoded, or if another |
| 112 | | encoder is already handling them, and if not, generate the flv file |
| 113 | | and the include file. And then you've got streaming embedded video. |
| 114 | | |
| 115 | | |
| 116 | | Still Todo: |
| 117 | | ----------- |
| 118 | | |
| 119 | | * Configuration via command-line options |
| 120 | | * Video thumbnail generation (how do you find a non-blank frame automatically?) |
| | 10 | --- |
| | 11 | 14/oct/07 |
| | 12 | andy@engagemedia.org |