- <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>
This displays something like this:
<!--- 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">
Note that if you only define either width or height the corresponding other size will be calculated by Railo automatically.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">
You can of course extract a full size image and use the CFIMAGE tag or the image functions of Railo in order to resize it. This might lead to better
results as well.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">
Now every conversion and extracrion is done so let's display the video:
<cfvideoplayer video="target.flv" preview="target.jpg">
Please note, that you have to set width and height as soon as you are using external videos. Otherwise Railo will throw an error.
<cfvideoplayer video="http://www.railo.ch/blog/videos/target.flv" preview="http://www.railo.ch/blog/videos/target.jpg" width="640" height="360">
This produces something like this:
<cfvideoplayer playlist="right" playlistsize="200" playlistthumbnails="true" width="640">
<cfvideoplayerparam video="/target.flv" preview="target5.jpg">
<cfvideoplayerparam video="/target.flv" preview="target15.jpg">
</cfvideoplayer>
The isVideoFile() function returns a boolean telling you whether the passed path to a file is containing a valid video file (including images) or
not. Railo does not only check the extension, but in the background the meta data of the file is analysed and evaluated.
<cfdump var="#isVideoFile("/isVideoFile.cfm")#">
<cfdump var="#isVideoFile("/target.flv")#">
The source I created (including the source video) can be downloaded here.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 |
9 responses so far ↓
1 Anuj Gakhar // Sep 30, 2008 at 3:35 PM
2 Gary Fenton // Sep 30, 2008 at 4:35 PM
Also can it convert audio files? e.g. a high quality WMA or MP3 file that a musician may have uploaded that needs converting to a lower bitrate in various formats?
3 Gert Franz // Sep 30, 2008 at 4:41 PM
Yes it can. There are nearly all formats supported. Sometimes there are some trial 'n errors but just find it out. I sometimes do convert some videos into mp3 in order to listen to them while I am driving...
4 Andrea Veggiani // Oct 6, 2008 at 11:22 AM
Just a question, how it's possible to play streamed flv from FMS?
I've tried with rtmp://myvideoaddress in the video attribute of <cfvideoplayerparam> but it does not work.
5 huffington // Jan 27, 2009 at 7:39 PM
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/swfobject.js"></script>
6 Vitor Rodrigues // Mar 29, 2009 at 4:12 PM
This code generate this error!
Get the Flash Player to see this player.
and not render video.
7 Vitor Rodrigues // Mar 29, 2009 at 4:25 PM
<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.
8 brian // Aug 24, 2010 at 3:29 PM
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.
9 Jay Pandya // Jan 4, 2012 at 6:26 AM
Thank You for this great tag
Leave a Comment