Drupal: FlashVideo – Convertation and Playing Video On Site
The module allows converting video-files uploaded to your site if ffmpeg library is set on your server. FlashVideo also outputs player and provides working with video.
Installing the module:
Enable the following parameters in .htaccess file:
<IfModule mod_php5.c>
php_value post_max_size 100M
php_value upload_max_filesize 100M
php_value max_execution_time 1000
php_value max_input_time 1000
</IfModule>
Module setting:
The module gets files with the help of one of these modules:
- ССК FileField
- Upload
In Upload mode
You need to upload FLV-file and thumbnail. These files will be stored in $node->files.
Showing rules of ImageCache module will not be used for a thumbnail. I.e. thumbnail should have the required size etc.
FlashVideo module catches video but don’t convert it.
Video in ССК fields is ignored in this mode.
In ССК mode
Files are passed through ffmpeg and if conversion was not successful video (even it is FLV file) isn’t shown.
2 fields are created for working with video (one for uploaded video and another one for final video – after conversion).
Ans there is 1 more file for thumbnail. ImageCache! works for this field.
$thumbnail_file = flashvideo_get_thumbnail($node, array(), TRUE);
if (!$thumbnail_file) {
if ($node->field_image[0][‘filepath’]) {
//Загруженная картинка:
$thumbnail_file = imagecache_create_url(‘video_thumb_front’, $node->field_image[0][‘filepath’]);
} else {
$thumbnail_file = $base_url . base_path() . path_to_theme() .’/images/no_thumbnail.jpg';
}
}
Automation of video and preview inserting
Change this line in a node template:
<div class=”content”><?php print $content ?></div>
To this code:
<?php if ($teaser): ?>
<?php print flashvideo_get_thumbnail($node);?>
<?php else : ?>
<?php print flashvideo_get_video($node);?>
<?php endif; ?>
<div class=”content”><?php print $content ?></div>
You should also disable using of tag in node text.
Displaying thumbnail
if (flashvideo_get_thumbnail($node, array(), TRUE)) {
$thumbnail = flashvideo_get_thumbnail($node);
} else {
$thumbnail = theme(‘imagecache’, ‘video_thumb_front’, $node->field_image[0][‘filepath’]);
}
‘video_thumb_front’ – name of a rule of ImageCache
‘field_image’ – name of ССК field an image is stored in. If just image is uploaded with video, you should use other code.
Direct uploading of FLV
If you don’t need to convert video on server, you can adjust the module as follows:
- Enable Upload module
- Open settings page of FlashVideo (admin/settings/flashvideo)
- Disable “Use the CCK FileField module for uploads” parameter
- Create ССК field for uploading preview picture with “image” name
- On “Show fields” page, adjust output or hiding fields with preview and uploaded video-file.
- When the node is saved, you should run cron to make video available or enable “Convert videos immediately” parameter
Here is the module description from Drupal.org:
FlashVideo is a complete video solution that expands Drupal’s upload capabilities to allow web developers and users to upload video files, automatically convert those videos to the popular Flash format, and then embed their video in any node type using the simple tag. This module allows more than one video to be attached to any node, and then referenced through the use of parameters passed to the tag . It also includes an automatic conversion of video files to the Flash format using FFMPEG technology.
Use this module if you…
- Would like a complete video solution for any user-generated-content video website.
- Wish to have the power to embed your video anywhere in the body of a node using a simple tag
- Wish to link as many videos as you like to a node.
- Would like a built in automatic Flash conversion.
Features
- Streaming Video — Version 6.x-1.5 adds the new capability to have your videos streamed to the user via either xmoov-php pseudo-streaming or via RTMP true streaming on a separate server such as a Flash Media Server or Red5 server.
- CCK FileField Support — Version 6.x-1.5 adds the new capability to have your videos attached to nodes by specifying individual FileField fields that should contain your videos and thumbnails.
- Amazon S3 Support — FlashVideo Module can be easily configured to integrate video on your site with the incredible Amazon S3 server. This provides large video sites the ability to host their videos on a completely separate server than their own so that the videos will not bog down their server. For more details on how to install and use this plugin, simply open up the README.txt file within the included “drivers” directory.
- Content Construction Kit (CCK) Integration — This module works very well with the Content Construction Kit, simply because it treats an uploaded video as a file instead of a node. Any CCK node type that you create can then enable the FlashVideo module to work with that node type. Because of this, this module can be treated as a CCK video solution. You can see this in action in the tutorial mentioned below.
- CCK Override Capabilities — The FlashVideo module includes a plugin called FlashVideo CCK which provides node-specific parameters to create or regenerate the thumbnail or video. This method allows for any node creator or updater to override the parameters specified by the FlashVideo Settings to create custom functionality out of their specific node. For more information regarding how to utilize this plugin, please go to http://www.travistidwell.com/flashvideo_cck.
Note: To use this plugin, you must enable it individually in the “Modules” section of your Drupal site. - Importing Videos — FlashVideo module includes a way for someone to import a large number of videos by just placing them in a directory (using FTP or some other means). Here is how it works. First thing you will need to do is go to the Flashvideo Settings page and decide which node type you would like to create with each imported video. Then, within the files directory, simply create a new directory and name it video_import (or use an alternate name that you define within the FlashVideo Settings page). Then, whatever video files you place within that directory will not only be added to the Drupal files table, but also be added to the FlashVideo cron cycle conversion queue. This makes it VERY simple for a site administrator to add MANY videos to their site without having to upload them all individually to nodes.
- Playlist Support — You can use the FlashVideo module to create dynamic playlists of your videos. For more information, please go to http://www.travistidwell.com/node/59.
- FlashVideo API for Developers — This module contains an API to allow module developers to tie into the powers of this module. For more information on what hooks and functions are available, please go to http://www.travistidwell.com/flashvideo_api.
FlashVideo Tutorials
- Walk-through tutorial by travist – http://www.travistidwell.com/flashvideo
- Screencast presentation by attheshow – http://fleetthought.com/blog-post/using-flashvideo-user-contributed-video
Installing a Media Player (Required Step)
Important Note: — For this module to work, you will need to download a media player to go along with it. Some of the media players that have been tested to work the FlashVideo are as follows:
Due to licensing, a media player is currently not included with the module, so you will need to download either one of these. This is covered in the tutorial mentioned above.
Troubleshooting FlashVideo
Are you having problems getting FlashVideo operational? If so, check out the troubleshooting guide available at: http://www.travistidwell.com/troubleshooting_flashvideo.
Special Thanks To:
Although Travis Tidwell is the primary creator and maintainer of this module, it would not be what it is today without the help and contributions of the incredible Drupal Community. This section is to give special thanks to these contributors.
If we have forgotten anyone who has contributed, then please contact one of the module developers to get your username added to the list.