Railo 3.0 released - Features part III - Multimedia
As you might have read in my previous entries, Railo 3.0 introduces some new multimedia tags and functions. In this blog entry I will show you how to use them.
The three new tags in Railo 3.0 are:
- <cfvideo>
Tag for manipulating videos - <cfvideoplayer>
Displays a video with several options - <cfvideoplayerparam>
Adds videos to a certain playlist initialized by CFVIDEOPLAYER - isVideoFile()
As the only new function at the moment
Further below you'll find the complete documentation for the three tags. But let us start with some examples. The source video I am using for my examples can be downloaded here: Source video
First of all we will retrieve some information about the video. This can easily be done with the following call:
<cfvideo action="info" source="/source.mp4" result="info">
<cfdump eval=info>
| info | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
Now you can use the following syntax in order to convert this video into something else:
<!--- simple conversion --->
<cfvideo action="convert" source="/source.mp4" destination="target.flv">
<!--- a little bit more --->
<cfvideo action="convert" source="/source.mp4" destination="target.flv" width="640" audiobitrate="41000" fps="25">
<!--- a little bit more --->
<cfvideo action="convert" source="/source.mp4" destination="target.flv" width="640" videobitrate="1500kb" audiobitrate="41000" fps="25" execution="quality">
OK conversion done, now we should extract an image:
<!--- this extracts an image after 15 seconds of the movie --->
<cfvideo action="cutImage" source="/source.mp4" destination="target5.jpg" width="640" start="5s">
<cfvideo action="cutImage" source="/source.mp4" destination="target15.jpg" width="640" start="15s">
If you want to concatenate two videos just use the following syntax (resizing and setting other parameters is not supported at the moment):
<cfvideo action="concat" source1="/source.mp4" source2="/source.mp4" destination="target.flv">
<cfvideoplayer video="target.flv" preview="target.jpg">
<cfvideoplayer video="http://www.railo.ch/blog/videos/target.flv" preview="http://www.railo.ch/blog/videos/target.jpg" width="640" height="360">
| info | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
Looks nice, and this is how to create a playlist with the CFVIDEOPLAYER tag:
<cfvideoplayer playlist="right" playlistsize="200" playlistthumbnails="true" width="640">
<cfvideoplayerparam video="/target.flv" preview="target5.jpg">
<cfvideoplayerparam video="/target.flv" preview="target15.jpg">
</cfvideoplayer>
<cfdump var="#isVideoFile("/isVideoFile.cfm")#">
<cfdump var="#isVideoFile("/target.flv")#">
And finally here's the plain documentation for the three VIDEO tags:
CFVIDEO
| Name | Type | Required | Description | Action |
| action | string | Yes | Type of video manipulation that the tag performs. Valid actions are [info,convert,cutimage,concat] | - |
| aspectratio | string | No | Aspect ratio (16:9,4:3) | convert |
| audiobitrate | string | No | Sets the audio bitrate. The default is the same as the input or part of defined quality (example: 10kbps, 10mbps, 10bps) | convert |
| audiocodec | string | No | Force using a certain audio codec | convert |
| audiosamplerate | string | No | Audio sample rate. The default is the same as the input or part of defined quality | convert |
| author | string | No | Set the author meta data of the destination video | convert |
| buffersize | number | No | Set the buffer size for the conversion | convert |
| comment | string | No | Set the comment meta data of the destination video | convert |
| copyright | string | No | Set the copyright meta data of the destination video | convert |
| debug | string | No | Fills a variable with this name with the shell call to the converter. | convert |
| destination | string | No | Sets the path of the destination video | convert,cutimage,concat |
| execution | string | No | Allowed values are [quality, performance] | convert |
| fps | number | No | Sets how many frames per second shall be used | convert |
| framerate | number | No | Alias for fps | convert |
| height | string | No | Set the height of destination video | convert,cutimage |
| max | string | No | Sets the maximal length of destination video. You can define either frames (f) or a time in milliseconds (ms) or seconds (s) | convert |
| name | string | No | Name of the destination video | convert |
| nameconflict | string | No | Sets how Railo should proceed if a file with the same exists in the target directory. Valid values are [error,skip,overwrite,makeunique] | convert,cutimage,concat |
| profile | string | No | Defines which standard profile to be used (declared in the video.xml) | convert |
| quality | string | No | Alias for profile | convert |
| result | string | No | Sets the name of the struct that holds the result when executing action info (default is cfvideo) | info |
| source | string | No | Sets the path to the source video that will be converted | convert,concat,info |
| source1 | string | No | Sets the first source video for action concat | concat |
| source2 | string | No | Sets the second source video for action concat | concat |
| start | string | No | Sets the offset for the conversion or extraction of an image in the source. You can define either frames (f) or a time in milliseconds (ms) or seconds (s) | convert,cutimage |
| title | string | No | Sets the title meta data for the destination video | convert |
| videobitrate | string | No | Sets the video bitrate. The default is the same as the input or part of defined quality (example: 10kbps, 10mbps, 10bps) | convert |
| videobitratemax | string | No | Sets the maximum video bitrate when a variable bitrate is used. The default is the same as the input or part of defined quality (example: 10kbps, 10mbps, 10bps) | convert |
| videobitratemin | string | No | Sets the mainimum video bitrate when a variable bitrate is used. The default is the same as the input or part of defined quality (example: 10kbps, 10mbps, 10bps) | convert |
| videobitratetolerance | string | No | Sets the video bitrate tolerance of the variable bitrate. The default is the same as the input or part of defined quality (example: 10kbps, 10mbps, 10bps) | convert |
| videocodec | string | No | Forces the use of a certain video codec | convert |
| width | string | No | Sets the width of destination video | convert,cutimage |
CFVIDEOPLAYER
| Name | Type | Required | Description |
| allowfullscreen | boolean | No | A click on the 'full screen' button of the player displays it by filling the complete screen of the client |
| autostart | boolean | No | Set this to true in the player to automatically start playing the video when the page is loaded. |
| background | string | No | Alias for bgcolor |
| backgroundcolor | string | No | Alias for bgcolor |
| bgcolor | string | No | Set the background color |
| debug | boolean | No | |
| download | boolean | No | Set this to true to display the download button in the player controlbar |
| fgcolor | string | No | Set the foreground color |
| foreground | string | No | Alias for fgcolor |
| foregroundcolor | string | No | Alias for fgcolor |
| group | boolean | No | When multiple videos are defined, you can define whether the videos should be broken into parts or played as a single video |
| height | string | No | Height of the video player. This attribute must be set, when the source video is not stored locally (eg. http://...) |
| id | string | No | |
| lightcolor | string | No | |
| linkfromdisplay | boolean | No | |
| linktarget | string | No | |
| overstretch | string | No | Sets whether to stretch images/movies to make them fit in the player. Set this attribute to true in order to stretch them proportionally, fit to stretch them disproportionally and none to keep original video dimensions |
| passthrough | struct | No | Attributes that should natively be passed to the flash player |
| playlist | string | No | Set whether to display a playlist or not. Values may contain right or below |
| playlistsize | number | No | Size in px of the playlist. If playlist is set to right of display this represents the width otherwise the height of the playlist |
| playlistthumbnails | boolean | No | Sets whether to display thumbnails in the playlist or not |
| preview | string | No | Path to a preview image (JPG) |
| screencolor | string | No | Sets the screen color |
| showpause | string | No | Display the pause button in the player control bar |
| showplay | string | No | Display the play button in the player control bar |
| showtimeline | string | No | Display the timeline in the player control bar |
| target | string | No | ... |
| thumbnails | boolean | No | Alias for playlistThumbnails |
| thumbs | boolean | No | Alias for playlistThumbnails |
| video | string | No | path to video file (flv/mp4) |
| width | string | No | Width of the video player. This attribute must be set, when the source video is not stored locally (eg. http://...) |
CFVIDEOPLAYERPARAM
| Name | Type | Required | Description |
| author | string | No | Author metadata |
| flash | string | No | path to a flash file |
| image | string | No | Alias for preview |
| index | number | No | For further usage |
| link | string | No | Link associated with the playlist entry. |
| preview | string | No | Preview image for the playlist entry. |
| show | string | No | Display the video in the playlist. |
| title | string | No | Title of the video in the playlist |
| video | string | No | path to FLV file |



1) would be great to update the player to play H.264/MP4 files instead of just FLV. 264 files generally look better and are a tad smaller than FLV files.
2) you guys might consider using GOOGLES AJAX libraries for the SWFOBJECT. it's cacheable and since this is a module that will be on multiple sites, if anyone visits another site and SWFOBJECT is in the cache - the browser will use the cached version
more info at
http://code.google.com/apis/ajaxlibs/
or simply change the SWFOBJECT script call in the generated player to:
<invalidTag type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1...;
This code generate this error!
Get the Flash Player to see this player.
and not render video.
<cfvideoplayer video="http://localhost:8080/videos/rails.flv" preview="http://localhost:8080/videos/rails.jpg" width="640" height="360">
produce this message:
Get the Flash Player to see this player.
last night to give cfvideoplayer a try and have got a bit of a problem with the
play list feature. However I seem to order the videos in the code the play list
just comes up in some random order that seems to change every time you load the
page.
This is what I'm doing:
<cfvideoplayer autostart="YES" width="750" height="460"
allowfullscreen="true" playlist="right" showpause="false">
<cfvideoplayerparam video="_flash/Chapter 1.flv" title="Chapter 1">
<cfvideoplayerparam video="_flash/Chapter 2.flv" title="Chapter 2">
<cfvideoplayerparam video="_flash/Chapter 3.flv" title="Chapter 3">
<cfvideoplayerparam video="_flash/Chapter 4.flv" title="Chapter 4">
<cfvideoplayerparam video="_flash/Chapter 5.flv" title="Chapter 5">
<cfvideoplayerparam video="_flash/Chapter 6.flv" title="Chapter 6">
<cfvideoplayerparam video="_flash/Chapter 7.flv" title="Chapter 7">
<cfvideoplayerparam video="_flash/Chapter 8.flv" title="Chapter 8">
<cfvideoplayerparam video="_flash/Chapter 9.flv" title="Chapter 9">
<cfvideoplayerparam video="_flash/Chapter 10.flv" title="Chapter 10">
</cfvideoplayer>
Anyone know how to make them list in the order coded? BTW I've tried taking
spaces out of the titles and filenames with no luck.