Gallery Server Pro 2.6 is now available. It sports a brand new file upload widget, the ability to encode video and audio files, and much improved SQL CE performance. Full details about this release are posted on the release history page.
To upgrade an existing version, just copy the files from the upgrade package over the ones in your existing web directory. If you are upgrading from 2.3 or from .NET 3.5 or earlier, there are a few extra steps – full details are in the Admin Guide. If you are using the DotNetNuke module, just follow the standard module install steps.
I covered the new features in my previous blog post, so here I’ll just cover what is missing from that post.
New file upload experience
The ComponentArt Upload control has been replaced with Plupload. There are several benefits:
- HTML 5 drag and drop support
- Ability to create a compressed version of images before uploading them
- Takes advantage of advanced browser features while gracefully degrading when necessary
- Progress feedback in medium trust scenarios
- Multiple file selection
When the add objects page loads, the upload control detects your browser’s capabilities and chooses the most appropriate runtime, based in this order of preference: HTML5, Silverlight, Flash, BrowserPlus, and HTML4. The runtime is shown in a tooltip when you hover over the upload area, as seen in the screen shot below.
The exact features available depend on your browser’s capabilities, including whether it has Flash or Silverlight installed. For example, drag and drop works only in Chrome and Firefox. Client side image resizing requires Flash or Silverlight to work in IE.
Client side image resizing
To request that images be resized on the client before being uploaded, select the ‘Discard original file’ option below the file selection window, as seen here:
When that option is selected and the browser supports client-side resizing, a compressed copy of each image is created in the browser and then uploaded to the server. This can dramatically reduce the length of time it requires to upload files. If the browser can’t create a compressed file, the original is uploaded and the server takes care of creating the compressed version and discarding the original file, just like how it worked in previous versions of Gallery Server Pro.
In most cases, the image’s metadata is copied to the compressed version so that it can be extracted on the server. However, there is one unfortunate exception. The Silverlight implementation, which is often used in Internet Explorer, fails to copy the image’s metadata to the compressed file, resulting in the metadata being lost. There are two workarounds:
1. Do not select the ‘Discard original file’ option when uploading files. Instead, delete the original files after they have been uploaded with the ‘Delete original files’ option in the Actions menu.
2. Modify the file upload’s control definition so that it never uses the Silverlight implementation, or at least prefers the Flash one to the Silverlight one. Do this by opening the file gs\pages\task\addobjects.ascx in a text editor and looking for this line:
Either delete Silverlight from the list or rearrange it to be after Flash. However, in my experience the Flash runtime is not as robust as the Silverlight one, so that is why I choose to prefer Silverlight.
Video / audio encoding
Version 2.6 adds support for encoding video and audio files to other formats after uploading. For example, you can upload an AVI file and have it automatically converted to a Flash Video file (FLV). The original AVI file is still available by clicking the view original button, much like original images are always a click away, even though web-friendly ones are shown by default.
The encoding is done by FFmpeg, a popular open source utility that Gallery Server Pro was already using to generate thumbnail images from videos. FFmpeg is included in the Gallery Server Pro Binary Pack. Note that your gallery must be running at full trust in order to execute FFmpeg.
You have complete control over which files are converted, to what they are converted, and how it is done. Here are the default encoder settings you’ll see when you look at the Video & Audio page in the site admin area:
These settings are interpreted as:
- Do not encode MP3, MP4, FLV, or M4A files.
- Try to convert all video to FLV. If that fails, try converting it to MP4.
- Convert all audio to M4A.
Feel free to adjust these as needed. I experimented with several variations and settled on this as the best compromise. Originally, I preferred converting to MP4 H.264 first, using FLV only when that failed. But, while MP4 files have several advantages, such as being a (fairly) open standard, small files sizes, and the ability to play without a plug-in in some browsers, it has one big limitation: The MP4 files created by FFmpeg must be fully downloaded by the browser before they begin playing, so you might have to wait a while before your video starts. This is a limitation of FFmpeg, not MP4 H.264, so I am hopeful that a future version resolves this. For now, Gallery Server Pro will default to converting video to Flash Video.
Viewing the encoding progress
An encoding’s progress is monitored as it processes each file. You can see the latest information about an encoding by refreshing the web page and then clicking the Expand link in the encoding queue.
Adjusting the encoding timeout
During QA testing, I noticed that certain video files would hang, continuing to use processor resources but not making any progress. Worse, when this happened, the encoding process didn’t respond to requests to cancel it, unless you used Task Manager to kill it. This is a potentially nasty situation because encoding uses a lot of server resources, and you don’t want it running for hours hammering away on your server’s processor. Your hosting company could get quite upset.
The solution I came up with was to set a timeout when kicking off the encoding process. The timeout default to 15 minutes (900,000 milliseconds) and can be set in the site admin area as seen in the screen shot above. If the encoder is still running when the timeout fires, it is automatically cancelled.
You may need to increase this timeout if converting large files. Whenever a timeout is hit that causes an encoding to be abandoned, an entry will be written to the error log.
Rebuilding encoded files
Gallery Server Pro treats the encoded video and audio files just like it does the optimized images that are created for image files. The encoded versions are shown by default when you view the media object, but the original is available by clicking the ‘View original’ button in the toolbar.
To build encoded versions of your media objects after you upgrade to 2.6 or anytime you change an encoder setting, run a synchronization with the ‘Rebuild optimized versions’ option selected. The existing encoded version will be replaced by a freshly created one.
The old handler that served media files didn’t support HTTP range requests, which is a technique some browsers use to request a portion of a media file. iOS devices require this support, so for version 2.6, the handler was rewritten to support these types of requests. Now any iOS supported file can be played in your device from the gallery. I believe the current supported file types are MP4, MP3, M4V, MOV, and M4A.
If you have media files in your gallery that are not supported in iOS, you can tweak the encoder settings to create an iOS-compatible version. One easy way to do this is to reposition the MP4 encoder setting to come before the FLV setting in the encoder settings section. Just remember the one big flaw with MP4 files – they must be fully downloaded in the browser before they begin playing.