Railo 3.0 released - Features part III - Multimedia

September 30, 2008 · By Gert Franz · 9 Comments

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
The video conversion functionality is supported only in the Railo Develop and in the Railo Enterprise version. In order to use the necessary video components, you can just start using the tag or go to the Railo Server Administrator and upload the corresponding video components. You will find more information in the Railo Server Administrator under Services/Video.
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: 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">
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: 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>
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

NameTypeRequiredDescriptionAction
actionstringYes Type of video manipulation that the tag performs. Valid actions are [info,convert,cutimage,concat] -
aspectratiostringNo Aspect ratio (16:9,4:3) convert
audiobitratestringNo Sets the audio bitrate. The default is the same as the input or part of defined quality (example: 10kbps, 10mbps, 10bps) convert
audiocodecstringNo Force using a certain audio codec convert
audiosampleratestringNo Audio sample rate. The default is the same as the input or part of defined quality convert
authorstringNo Set the author meta data of the destination video convert
buffersizenumberNo Set the buffer size for the conversion convert
commentstringNo Set the comment meta data of the destination video convert
copyrightstringNo Set the copyright meta data of the destination video convert
debugstringNo Fills a variable with this name with the shell call to the converter. convert
destinationstringNo Sets the path of the destination video convert,cutimage,concat
executionstringNo Allowed values are [quality, performance] convert
fpsnumberNo Sets how many frames per second shall be used convert
frameratenumberNo Alias for fps convert
heightstringNo Set the height of destination video convert,cutimage
maxstringNo Sets the maximal length of destination video. You can define either frames (f) or a time in milliseconds (ms) or seconds (s) convert
namestringNo Name of the destination video convert
nameconflictstringNo 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
profilestringNo Defines which standard profile to be used (declared in the video.xml) convert
qualitystringNo Alias for profile convert
resultstringNo Sets the name of the struct that holds the result when executing action info (default is cfvideo) info
sourcestringNo Sets the path to the source video that will be converted convert,concat,info
source1stringNo Sets the first source video for action concat concat
source2stringNo Sets the second source video for action concat concat
startstringNo 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
titlestringNo Sets the title meta data for the destination video convert
videobitratestringNo Sets the video bitrate. The default is the same as the input or part of defined quality (example: 10kbps, 10mbps, 10bps)  convert
videobitratemaxstringNo 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
videobitrateminstringNo 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
videobitratetolerancestringNo 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
videocodecstringNo Forces the use of a certain video codec convert
widthstringNo Sets the width of destination video convert,cutimage

CFVIDEOPLAYER

NameTypeRequiredDescription
allowfullscreenbooleanNo A click on the 'full screen' button of the player displays it by filling the complete screen of the client
autostartbooleanNo Set this to true in the player to automatically start playing the video when the page is loaded.
backgroundstringNo Alias for bgcolor
backgroundcolorstringNo Alias for bgcolor
bgcolorstringNo Set the background color
debugbooleanNo  
downloadbooleanNo Set this to true to display the download button in the player controlbar
fgcolorstringNo Set the foreground color
foregroundstringNo Alias for fgcolor
foregroundcolorstringNo Alias for fgcolor
groupbooleanNo When multiple videos are defined, you can define whether the videos should be broken into parts or played as a single video
heightstringNo Height of the video player. This attribute must be set, when the source video is not stored locally (eg. http://...)
idstringNo  
lightcolorstringNo  
linkfromdisplaybooleanNo  
linktargetstringNo  
overstretchstringNo 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
passthroughstructNo Attributes that should natively be passed to the flash player
playliststringNo Set whether to display a playlist or not. Values may contain right or below
playlistsizenumberNo Size in px of the playlist. If playlist is set to right of display this represents the width otherwise the height of the playlist
playlistthumbnailsbooleanNo Sets whether to display thumbnails in the playlist or not
previewstringNo Path to a preview image (JPG)
screencolorstringNo Sets the screen color
showpausestringNo Display the pause button in the player control bar
showplaystringNo Display the play button in the player control bar
showtimelinestringNo Display the timeline in the player control bar
targetstringNo ...
thumbnailsbooleanNo Alias for playlistThumbnails
thumbsbooleanNo Alias for playlistThumbnails
videostringNo path to video file (flv/mp4)
widthstringNo Width of the video player. This attribute must be set, when the source video is not stored locally (eg. http://...)

CFVIDEOPLAYERPARAM

NameTypeRequiredDescription
authorstringNo Author metadata
flashstringNo path to a flash file 
imagestringNo Alias for preview
indexnumberNo For further usage
linkstringNo Link associated with the playlist entry.
previewstringNo Preview image for the playlist entry.
showstringNo Display the video in the playlist.
titlestringNo Title of the video in the playlist
videostringNo path to FLV file 

Tags: Features · Multimedia · Railo 3.0 · Railo 3.1 · Release

9 responses so far ↓

  • 1 Anuj Gakhar // Sep 30, 2008 at 3:35 PM

    Great work on these tags and Railo in general. Very excited to actually get to use these some day.
  • 2 Gary Fenton // Sep 30, 2008 at 4:35 PM

    Excellent! Apart from FLV and MP4, what other video formats can Railo 3 convert from and to?

    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

    @Gary
    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

    Really great work :)

    Just a question, how it's possible to play streamed flv from FMS?

    I've tried with rtmp://myvideoaddress in the video attribute of &lt;cfvideoplayerparam&gt; but it does not work.
  • 5 huffington // Jan 27, 2009 at 7:39 PM

    just started playing with cfvideo and it is AWESOME! i can't wait until 3.1 and the plugin manager. I'm gonna track down the feature requests, but thought i'd add it here as well.

    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:
    &lt;invalidTag type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js&quot;&gt;&lt;/script&gt;
  • 6 Vitor Rodrigues // Mar 29, 2009 at 4:12 PM

    &lt;cfvideoplayer video=&quot;http://localhost:8080/videos/rails.flv&quot; preview=&quot;http://localhost:8080/videos/rails.jpg&quot; width=&quot;640&quot; height=&quot;360&quot;&gt;

    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

    this samples code not run.
    &lt;cfvideoplayer video=&quot;http://localhost:8080/videos/rails.flv&quot; preview=&quot;http://localhost:8080/videos/rails.jpg&quot; width=&quot;640&quot; height=&quot;360&quot;&gt;
    produce this message:
    Get the Flash Player to see this player.
  • 8 brian // Aug 24, 2010 at 3:29 PM

    Hi, just wondered if anyone had come across this. I downloaded Railo Express
    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:

    &lt;cfvideoplayer autostart=&quot;YES&quot; width=&quot;750&quot; height=&quot;460&quot;
    allowfullscreen=&quot;true&quot; playlist=&quot;right&quot; showpause=&quot;false&quot;&gt;

    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 1.flv&quot; title=&quot;Chapter 1&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 2.flv&quot; title=&quot;Chapter 2&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 3.flv&quot; title=&quot;Chapter 3&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 4.flv&quot; title=&quot;Chapter 4&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 5.flv&quot; title=&quot;Chapter 5&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 6.flv&quot; title=&quot;Chapter 6&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 7.flv&quot; title=&quot;Chapter 7&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 8.flv&quot; title=&quot;Chapter 8&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 9.flv&quot; title=&quot;Chapter 9&quot;&gt;
    &lt;cfvideoplayerparam video=&quot;_flash/Chapter 10.flv&quot; title=&quot;Chapter 10&quot;&gt;

    &lt;/cfvideoplayer&gt;

    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

    This really great feature and one can use for personal video conversion also.

    Thank You for this great tag

Leave a Comment

Leave this field empty: