Flash Video in Drupal 5: A complete multimedia tutorial.


Introduction:

When I first started getting very familiar with Drupal about 5 months ago, I realized that, while it was an incredible CMS, it still lacked the video capabilites of todays leading Web 2.0 websites. Although I was very impressed with the versatility of the current Video module, I was not impressed with how incredibly non-user friendly the module was... well, from a non-developer point of view. You see, my goal was to create a user-generated video website. You know what I am talking about. You see them everywhere! YouTube, Google video, AOL video, and I could just go on and on.

The problem with the current Video module is that is was not designed for a User-generated video website. It was only created to allow a web developer the ability to easily upload a video, and display that video. This web develpoer is able to do this by creating a Video node and provide what seems like a thousand different parameters to embed that video in his site. This is where I see the problem... First of all, I don't beleive that a video should be considered a "node". A video is simply a file, and should be treated as such. And Drupal already has a fantastic module that allows a user to easily upload files to any node in the system, the Upload module. What is even more cool about this module is that the user is given the ability to upload as many files to their node as they wish. This got me thinking... This should also apply to video; Why shouldn't I be able to upload as many videos to my node as I wish? If a video is not considered a node, but rather a file, then this would be possible using the Upload module. In fact, it would be stupid easy for anybody creating content. So stupid easy, that in fact, anybody (not just a web developer) can do it. You see where I am going here, don't you. By using this video content philosophy... You would, in fact, have a brand new video module built for the user-generated websites, and as far as I am concerned, the websites that WILL be and ARE the future of the web. I would like to introduce to you, the brand new FlashVideo module which I wrote to do just this... Take a look for yourself! (oh, and I'm not an animal hater... I just thought these videos were heeeelarious!)

I don't think you can do this easily with the current Drupal Video module. But with the brand new FlashVideo module, this is EASY!!!

In this tutorial, I will walk you through step by step on how to create your very own Web 2.0 website with integrated Flash Video. I will teach you how to use this new module that I have written, FlashVideo, and personally show you how easy it SHOULD BE to add Flash video to your Drupal 5 website. So sit back, pop them fingers, and get ready for Web 2.0.

As I have my video blog on

As I have my video blog on my own home server, I have a pretty bad upload speed. What I'd want to know is that would it be possible to do this: After converting the video file to flv, it gets uploaded to a specified ftp site (external) and then it gets linked to the post. This would make the videos buffer/load way faster, but I could still have it on my own server. I have access to hosted ftp, but I'm simply wondering if there's an easy way to accomplish this. olympus waterproof

Two questions: 1. How to get

Two questions:
1. How to get the video player to show the first frame captured for the thumbnail instead of just a black empty screen. (this is before you play the video). Maybe this can be fed as a parameter to the flv player?

2. My MPEG1 video files get converted with no sound. Any ideas? I edit my videos with CyberLink PowerDirector and this is a plain mpeg1 file.

clubpenguin

I realized that, while it

I realized that, while it was an incredible CMS, it still lacked the video capabilites of todays leading Web 2.0 websites. Although I was very impressed with the versatility of the current Video module, I was not impressed with how incredibly non-user friendly the module was... well, from a non-developer point of view. You see, my goal was to create a user-generated video website. You know what I am talking about. You see them everywhere! YouTube, Google video, AOL video, and I could just go on and on.
birthday card

Flash backup?

Hi,

Love this module! Only problem I've got is providing a smooth experience for users without flash. Can you recommend a way to provide a flash backup?

Thanks,

Nick

efsa3

Because thanks to my friends about this author.
every time you enter the site. youtube is always providing the original video.

is installing FFMPEG

is installing FFMPEG necessary?

I have downloaded the module, activated it from admin section, created one content type, activated the FlashVideo for this newly created content type. I have created the directories named ""video_import and "video_output" for import video and output directory for converted video, But when i upload the flv file then i found .flv file in video_output directory, but when i tried to upload .avi file the i gound it at ./files directory and not in output directory

some errors i am getting

dl() [function.dl]: Unable to load dynamic
library './ffmpeg.so' - ./ffmpeg.so: cannot open shared object file:
No such file or directory in
/home/x/public_html/sites/all/modules/flashvideo/flashvideo.module on line 1420.

in the flash video module settings if i use
Use FFMPEG-PHP to extract video information. then i get tht error or else video gets uploaded properly.
and the embed code thts generated in not playing the video i just get an player thts it it does not play it
the embed code is like

<object width="320" height="240"><param name="movie" value="/sites/all/modules/flvmediaplayer/player.swf"></param><embed src="/sites/all/modules/flvmediaplayer/player.swf" type="application/x-shockwave-flash" type="movie" width="320" height="240" allowfullscreen="true" allowscriptaccess="true" flashvars="config=http://www.xyz.com/flvmediaplayer/54"></embed></object>

any idea on whts the problem.

Thanks,
Pradeep

Some other converter?

before anything i should say that the tutorial helped a lot and everything is working fine except the thumbnails. I don't have this FFMPEG on my server. Is it possible to use another converter like ImageMagick? I don't need to convert the videos (i upload them as FLV already) but i guess the thumbnails won't work because of this FFMPEG which I don't have. Any other way to fix this problem?

Return to start after outro video

Just wondering if anyone can help - we are using intro and outro videos, but after the outro one plays, we would like the 'playlist' to reset and load the intro video again - currently if the user hits play again, it replays the outro video, instead of the whole thing.

Any ideas?

Using a external server for hosting

Hi,
So far this tutorial has proved most useful. I just have one question. I'm actually trying to use Cirtex Hosting for only the conversion and hosting with my set up. I'm hosting my Drupal 6 instance on another server. Is this possible and if so how do I go about configuring this? TIA.

Thanks for the tutorials

This works 100%. Thanks for the tutorials.

_______________________________________________________________________________
Back Pain | Frozen Shoulder | Orthopaedic | Plantar Fasciitis | Stiff Neck | Trigger Finger | Singapore Hotel

Drupal 6.9

Will this work with drupal 6.9 with the JW Player??
Are there many changes?

/Lone

3gp sound problems

3gp files (for example from mobiles) are working - but it seem that there are sound problems with these fileformats - in my case i hear only brrrrrrrrrrrrrrrrrrrrrrr....
anyone knows a solution for this ?

thx

I realized that, while it

I realized that, while it was an incredible CMS, it still lacked the video capabilites of todays leading Web 2.0 websites. Although I was very impressed with the versatility of the current Video module, I was not impressed with how incredibly non-user friendly the module was... well, from a non-developer point of view. You see, my goal was to create a user-generated video website. You know what I am talking about. You see them everywhere! YouTube, Google video, AOL video, and I could just go on and on.
health science university

Agreed

I completely agree. The abilities of the CMS are great but the usability is terrible. In this day and age people want usability the most and without it you're dead in the water.

online colleges

Thankss...

youtube

thank you poster...

FFMPEG Drupal integration issue

We are working on drupal-5.x.We have integrated ffmpeg in our site.It was working well a few days ago. But now it is not generating either thumbnails or video.

We have installed latest ffmpeg wrapper module. FFMPEG on the server works via shell command, so that's not where the issue is. The ffmpeg_data and the Flashvideo tables in Drupal shows nothing.

Thanks in advance for any pointers/ help in resolving this conundrum.

embed extern videos

hi

thanx for that grat module !

a question: is there a possibility to use also other extern video content like youtube videos (embed code) with the same functionality as when you upload a video ?

Development

Hey!

First of all, love what you've done and the continued support on this module.

Thing is, I basically need the module to do more. More specifically, to also handle audio (ie. convert wav to mp3 and use a flash player to stream that), and something more unique: convert psd to png (which can be achieved easily with imagemagick) & word to pdf (easy enough).

I'm just wondering, do you have any tips or pointers how to actually do this on *top* of your module?

my files are flv already...

so, I don't really need the ffmpeg encoder to do anything. But, I still want the functionality of uploading to a node. When I finish posting to a node I get the "Video Not Available" poster frame. So, I'm wondering if the system still wants to encode even though I haven't set up ffmpeg and the only way the module works is that you must have ffmpeg working or...I just stuffed up and haven't configured it properly..Hope this makes sense...I'd really like to get this working...thanks

justifying videos

I cannot seem to justify the video within the node. Even placing the video inside a table, and justifying the table to left or right, the video is always centered in the page. Any ideas? (I am using the fckeditor).

You will need to override

You will need to override the flashvideo template to override the centered video. You can open up the flashvideo_objects.inc to figure out which one you need to override.

Restrict single file upload

How to restrict user to upload just 1 video per content ? Beside that I would like just videos to be uploaded by users not everything.

Thanks

Hi Travis i have separate

Hi Travis

i have separate video_import directory
output directory is different from video_import directory for sure
i have tested many times with different values
i have changed input dir, output dir, video import dir
but all the same:
successful video conversion - but after second or third cron run - the flv files are deleting!

nodes are creating ok, videos is playing ok too - but after cron run - FLV files are deleting

My only suggestion is to

My only suggestion is to have me look into it for you. If you are willing to pay for my services, I can get in there and figure it out pretty quickly. I am not convinced this is a FlashVideo issue since nobody else seems to be having this problem. Contact me through the contact form if you are interested.

cron delete flv

the same pb form me
FlashVideo 6.x-1.3
I upload already encoded flv it's ok but the
files are deleted after the cron run
so i can't publish my website ...

can't figure out how to get a workaround. I tried to set another export directory but when i manually upload, the file are generated in the goor directory but the path is wrong (the default one to file)

any clue
thanx

Does this support 3GP mobile phone video format now?

I would like to use Flash video to let people upload the 3GP video standard for mobile (cell phones). What's the situation with this?
Thanks.
marcusp

Travis - where are you ???

Hi!

Travis please advise, the cron deleting FLV files problem is still unresolved :(
i have commented file_deletion functions in flashvideo.module, but somehow files are deleting :(

another question - how to extract the FLV video filename in the node ?
i want to extract video duration from the video and i need the file name in node
if i Enable ffmpeg-php in flashvideo settings - the flashvideo module not extracting information using ffmpeg
so i decided to extract it myself but i can't get the file name in the node

please advise!
Thanks !

:) I have been very busy,

:) I have been very busy, and I am afraid FlashVideo has taken the rear seat for a little while. Don't worry, though, I will be back on it shortly. If files are deleting in FlashVideo even when you comment out file deletion funcitons, then that would indicate to me that there is another module that is not playing nicely with FlashVideo. What other modules do you have installed?

And about your other question... I am not sure what you mean "extract the FLV video filename in the node"...? Do you mean just the filename? I am not sure that was ever even a feature with FlashVideo, and all FFMPEG-PHP does is get the size of the video to show the video player correctly.

I hope this helped. Sorry I have not been around, but I have a lot of irons in the fire right now.

Thanks,

Travis.

Is this bug ?

Hey!

i have noticed one more bug or something
if you import already FLV files using flashvideo video_import feature
then for some reason new nodes are not in PUBLISHED status..
could you please check this ?
and one more thing - please, if it possible to add feature to allow flashvideo created nodes to add "promote to frontpage" feature

thanks again and waiting

Huray! You're online :)

hi!

about file deletions:
then i upload files via drupals ADD CONTENT - then no files deleting
but then i add them using video_import directory
then FLV files deleting. i even installed drupal + flashvideo module without any additional modules - the same effect.

i want to display the duration of movie on my pages
i need the filename and the path there is the movie, like /sites/default/files/movie.flv

then i create new ffmpeg-php object and extract the duration
the problem is i don't know how to get the movie name and the path inside the node

UPDATE: i have tested again all this stuff with deletion
and figured out what ONLY if i import videos already in FLV format, then only this files deleting
avi, wmv converting from video_import directory to FLV format and they are not deleting, only FLV imported files

UPDATE #2: Travis, please advise - my mind will blow if i don't figure out why the files are deleting :((((
I have tested again all this stuff, i have commented out file_dele functions in flashvideo-module
also i have commented all module_invoke functions in your modula - but the files are deleting again :(

please help!
thanks

I think I might know what is

I think I might know what is going on.... What are the exact values that you have for the video import directory and the video output directory?.... They absolutely cannot be the same. In fact, the video_import directory should not be used for anything other than importing videos. If you set it to the same as your files directory then you will see some really strange things happen. If it is the same as the output directory, then you will probably see that it keeps creating nodes all the time. I am wondering if you have the video_import directory set to be the same as the files directory... this would cause this issue I think (but I have never tested it).

Let me know.

Cron deleting flv files

Travis -

I am also having the same issue as the previous poster. When I attach the videos, everything seems ok, but at some point the cron job comes through and whacks the files.

My files are already in FLV format if that makes any difference at all.

Please advise.

John Walker

Another problem with flashvideo module

Travist, please advise!
After successfully importing flv files, flashvideo module deleting FLV files after 2 or 3rd cron run..

why ??
please help!

Got a problem here then importing flv files

Hi!

thank you for your plugin!
i have a strange problem here

then i copy flv files into inport_dir and run cron, the system creates thumbnails writes them to output directory
and then MOVE the flv files from import directory to output
pretty good...
BUT

but in the node your plugin generates a code with sites/defaul/files path!
he thinks the flv videos is there, in drupal's sites/default/files directory but it must be the output directory

then i manualy upload avi files, it's works great, but not then i import flv files from import directory.

The same thing happens then i upload FLV files vie web form
flashvideo module creates thumbnail and MOVE the uploaded file to OUTPUT directory
in the node flashvideo module generates code with /sites/default/files dir but shoud be /sites/default/files/OUTPUTDIR

if i upload other files. avi for example - the system runs ok
converts files, copy the flv to output dir and the flashplayer displaying videos

please, please advise. Thanks

save your trouble

I think if you want to save all your troubles

you can always go to CrayonHost

they already got things in place an have great support

look at my website for sample site

Anton Soeharyo

path problem

Hi Travis

thanks a lot for all your time.
I have a clearly defined problem but no clue how to solve it.

exactly did all you explained
when I upload the movie there is a problem with the path:
++++++++++
warning: rename(/var/www/drupal-5.0//var/www/drupal-5.0/files/wwwBI_T29_T31.avi,/var/www/drupal-5.0//var/www/drupal-5.0/files/94_wwwBI_T29_T31.avi) [function.rename]: No such file or directory in /var/www/drupal-5.0/modules/flashvideo/flashvideo.module on line 1464.
++++++++++
as you see the "/var/www/drupal-5.0/" is for some reasons doubled :-(
this of course messes up the whole thing of conversion etc etc

I would appreciate any help...
thanks
selim

As always is happens...

As always is happens... after my last post, 5 min. later, I got the solution.

changing the
"File system path" solves the problem
cheers

Where did you make this

Where did you make this change?

install issue

Travis - again, great module.
One issue in the install file, though, is that mysql (v. 5.0.45) keeps dying on the "CREATE TABLE ffmpeg_data ..." statement, saying "#1101 - BLOB/TEXT column 'input_file' can't have a default value".
You may want to remove the default values for text fields from that statement.

Hope that's helpful...

Flashvideo flv file is not playing

Hi All,
I have install flash video module, ffmpeg program. Everything is working fine like converting to flv and creating thumbnail. While submitting the node the video file is converting into the flv format and plays the only once after submitting. But if I go again that node after clicking the thumbnail(created by ffmpeg) it shows the blank page. I dont know whats the reason. Any help would be appreciate.

Flashvideo_views.module improvement

Hi, I added the possibility to sort videos on play_counter in views. Here are the code of the flashvideo_views.module (based on 5x-2.6-beta version. Feel free to try it.

/**
* Implementation of hook_help()
*/
function flashvideo_views_help($section = 'admin/help#flashvideo_views')
{
switch ($section) {
case 'admin/help#flashvideo_views':
$output = 'The FlashVideo Views module provides a new Field in
the Views module that allows you to see the Video or Video Thumbnail.';
return $output;

case 'admin/settings/modules#description': return t('Provides a plugin to allow Views functionality to the
FlashVideo Module.');
}
}

/**
* The views plugin for the FlashVideo module is developed and maintained
by * user mikesmullin at http://drupal.org/user/108440
*
*
* This include file implements views functionality on behalf of the
* flashvideo.module. */

function flashvideo_views_views_tables() {
$tables['flashvideo'] = array(
'name' => 'flashvideo',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'nid'
),
'right' => array(
'field' => 'nid'
),
),
'fields' => array(
'nid' => array(
'name' => t('FlashVideo: Video'),
'handler' => 'flashvideo_views_handler_video',
'option' => array(
'#type' => 'select',
'#options' => 'flashvideo_views_option_video',
),
'notafield' => true,
'sortable' => true,
),
),
'sorts' => array(
'play_counter' => array('name' => t('Flashvideo: Played
Counter'))
),
);
return($tables);
}

/**
* Views handler for displaying the video.
*/
function flashvideo_views_handler_video($fieldinfo, $fielddata, $value,
$data) {
$node = node_load($data->nid);
switch ($fielddata['options']) {
case 0: // Flash Video Player
return flashvideo_get_video($node, array());
case 1: // Thumbnail Image
case 2: // play_counter
return $node->play_counter;
default:
return flashvideo_get_thumbnail($node, array());
}
}

/**
* Views - Generate a list of options for the */
function flashvideo_views_option_video($op) {
return array(
t('Flash Video Player'),
t('Thumbnail Image'),
t('Played Counter')
);
//return $a;
}

Suggestion and a Bug

Hi, flashvideo is a great module. Thanks for developing !

I have a suggestion for the automatic import via video_import directory.

I think the import should not set the videos automatically to "published" after rendering the video, since the author may want to, change the title, edit the node text before publishing the video. It would be great if the module would grab the default settings (Publish settings, Comment settings) of the node type settings.

I think i also found a bug. Selecting the node type for the automatic import seems to only work correctly when you enable flashvideo support for at least 2 node types. Otherwise it does not save video with the correct node type and falls back to the default node type specified in the module source code.

Modifying the source

Hello there,

I love the FlashVideo project because of it's automation and simplicity.

However, as I have my video blog on my own home server, I have a pretty bad upload speed. What I'd want to know is that would it be possible to do this: After converting the video file to flv, it gets uploaded to a specified ftp site (external) and then it gets linked to the post.

This would make the videos buffer/load way faster, but I could still have it on my own server. I have access to hosted ftp, but I'm simply wondering if there's an easy way to accomplish this, or if I need to dig into the code?

Thank you!

- Dids

Its awesome

I know!

its so awesome the way the Video loads so much faster than the original ones

FFMPEG hosting News

Not at all... The video

Not at all... The video import directory was put into place to solve this and should just work with the latest version of the FlashVideo module.... First, just create a directory in your files directory called "video_import". Make sure the permissions allow for reading. Then FTP any video that you want to add to your site into that directory, run cron, and yiola! You should then be able to go to your content section and see that some new nodes were created with those videos you uploaded via FTP. You can then change the node type in the Global FlashVideo Settings.

Enjoy!

Actually, the problem here

Actually, the problem here is that I am using two different servers. One that I maintain at home, which is where the videos get uploaded and converted, but then I have a domain at GoDaddy, but it has no ssh and no ffmpeg.

What I'd like to do is simply store the FLV files on the GoDaddy domain, and fetch them via the drupal on my home server (where the original videos get converted).

This way the buffering would be smooth, even if the site (home server) was under heavy traffic. Basically GoDaddy would only serve as a file storage for the already converted flv's.

The biggest problem with the video_import module was that it was also used to convert the videos, but as my current GoDaddy plan can't handle that, I have to let my home server do it.

Thank you!

- Dids

I wish I had so much website

I wish I had so much website traffic that I would need a server just for that. Anyway, thanks to all of you for the details.

Hello

Hello

First of all, thanks for your walkthough! I am an absolute newbie (hosting on Dreamhost.com) and have little knowledge in terms of server administration. Anyway, I did everything, and yet it keeps saying "no video availble" even if I manually run the cronjob.

have a look yourself:

http://www.tiervideos.net/?q=tracker

If anybody could help I'd be sooo glad. Feel free to register and try it out yourself (cronjobs run every 10 minutes). I'm a bit annoyed with the whole situation as I can't continue to work on my site (which is pretty poor at the moment ;-) without the flash player working.

Have you actually looked at

Have you actually looked at the output directory and see if it is actually converting the videos? If not, then I would first focus my attention on why the video is not being converted instead of why it isn't showing up in your node. Here are some reasons why the ffmpeg would fail.

  • Your output directory does not have writable permissions for all users (ie: chmod 777).
  • You do not have an mp3 codec installed for your ffmpeg (usually results in a zero byte flv file)
  • You have the wrong path specified for ffmpeg (In the FlashVideo settings, verify that your host path is /usr/bin/ffmpeg