Embedded Video Improvement

Banta

Joined: 2006-04-18
Posts: 35
Posted: Mon, 2006-04-24 03:59

Wayne,

You are Da MAN! I want to Give you a BIG Thumbs Up!

Anyone who wants to use this function needs buy Wayne a Cyber Beer because, his stick-to-it-ness has made this possible. I'm not sure why it works, so I'm going to study his code to figure it out, but, I just tested it on IIS without UrlReWrite and it passed with flying colors.

This should be a part of the base install. Flash video, Gallery2 and Waynes FIX is fantastic.

Slightly OT
I was wondering what you and everyone is using to encode your flash video? And if anyone has figured out a way to go straight from VOB to .FLV?

Cheers again to Wayne, King for a Day!

__________
Banta

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Mon, 2006-04-24 04:02

On Average, how big would an hour of video be using your preferred method?

Hooray Wayne!

 
johndbritton
johndbritton's picture

Joined: 2005-03-23
Posts: 78
Posted: Mon, 2006-04-24 04:14

Congrats, I look forward to using this feature in my gallery. Thanks to everyone who contributed, and as for that beer, if you are in upstate NY ill buy you one.

 
azn_oohwee

Joined: 2006-03-06
Posts: 24
Posted: Mon, 2006-04-24 04:57
suprsidr wrote:
Ok, I know what to do, I just don't know how to go about it.

We need to replace the "&" in the url for the movie to "%26" see this page for flash special chars: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14143

I tried it here http://209.254.158.237/flvtest1.html where streamName=http://209.254.158.237/gallery2/main.php?g2_view=core.DownloadItem%26g2_itemId=501%26g2_serialNumber=2 and it works.

When this streamName=http://209.254.158.237/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=501&g2_serialNumber=2 does not.

For the &amp issue i've seen lots of people run across this. What you need to do for gallery 2.1+ is replace add the "htmlEntities=false" parameter into the <param name .... url> field. you can also grab the full url by using "forceFullUrl=true". Take a look at the puzzle module here its similar in structure to this flv plugin.

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Mon, 2006-04-24 08:44

Experimenting with this I have realized a couple of things.

1) This should be obvious but, I can sometimes be the villiage idiot. The animation size must be specified.
I have hard coded my .FLV files to always be 320x240, now I do not need to specify size everytime. But, if I have a movie that requires a different size, I can overwrite it with the animation size setting. Cool!

2). The MetaData must be injected into the movie. Some flv encoders automatically inject it, some don't.
When you play your movie in an external player, if you don't have a seek bar, you do not have any metadata and I don't think it will play in your Gallery. I use this simple free program to do the job FLV MetaData Injector Grab the GUI also if you're not comfortable with command prompts.

Anyhoot, just an observation.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2006-04-24 23:31

This would be our next logical step.
FFMPEG supports flv for encoding, thumbnail creation, and size detection.
So I will start here: http://ffmpeg.sourceforge.net/ffmpeg-doc.html
and look into what is required.

Banta, I usually rip from VOB with the new open source Dr. Divx, and then use the Macromedia(or do I say Adobe) Flash video encoder from flash 8, it uses the incredible On2 codec.

I'm attaching my modified copy of GalleryAnimationItem.class (from 2.1.1a)for anyone interested in trying this out.
The other changes will still have to be made manually.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-04-25 00:52

Ok, took a look at this today.. seems to be in good shape.
I know I recommended way back when to use GalleryAnimationItem (keep flash stuff together), but now I think it should go in GalleryMovieItem because I'm changing that item type to be used for video/* mime types instead a list of particular mime types.. so video/x-flv will become a GalleryMovieItem. I'll also be moving GalleryMovieItem/GalleryAnimationItem out of core and into a "video" module.. so we'll put the flvplayer there.

The big question: which flvplayer to use... where did the one attached in this topic come from? The controls look nice, but it doesn't have any visual indicator for buffering. Also without knowing its source we can't verify we are allowed to use it. Another player that we can use is flowplayer. This indicates buffering (though with english text.. how to localize?), but requires a kludge to pass the movie URL (it wants a base URL and filename, and auto-appends .flv to the filename).. but it does work.

yeah, figure out the commandline params for size detection and frame-to-jpeg and we'll get that support added to ffmpeg module!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2006-04-25 02:44

Ok, I think I found a script that contains what we would need to get this next part moving.
Although I'm not familiar with gallery's ffmpeg module, this attached script has all the commands I think we require.

Also if we decide to continue on with the encoding aspect I think this script will be all we need.
Personally I think encoding would be too cpu intensive for most users especially those on shared hosting - probably would not allow it anyways.
But for some of us it would indeed be a great tool.

So for now I think we should concentrate on the size detection/jpeg creation part.

mindless, if you could look over the attached script, and let me know if more info is required.

Thanks,
Wayne

Oh, and by the way, I have several flvplayers that I have made. They are quite easy to put together, so I will see if I can come up with one for the localization you asked about.

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Tue, 2006-04-25 05:35

I wanted to go straight from a VOB file to an FLV file and figured out how to do it using FFMPEG and a simple text file. Below is the outline on how it is done. Hope this is of some benefit.

I also am not familiar with Gallery FFMPEG Module. What is it suppose to do? If it can be customized to perform the outline below, that would be a trick mod. Anyaway, here goes.....

OK, In this example I am going to encode an entire DVD that contains separate sitcom episodes. The end result will be each episode in the .FLV format. The great thing about this example is that
every tool we'll use is free and readily available. The second nice thing about this is that we are going to go straight from the VOB file to the .FLV format so, there is no need to do an
intermediate encoding first. This saves time and quality by not stepping on the file too many times. This is a very straight forward process and is easy to do. You'll be surprised how fast you
can get your movies into small, quick playing .FLV files.

So, let's do it.

Firstly, grab a DVD that you want to work with and get yourself a copy of DVDSHrink HERE if you don't already have it. We need to get the VOB's off of the disk and onto our hard drives.
We could go straight from the DVD if we wanted to, but, with this method, we are assured we are not getting any garbage that we do not need, such as previews,
subtitles, alternate audio etc..

STEP 1. GET VOB's ONTO YOUR HARD DRIVE
Launch DVD Shrink and choose OPEN DISK

Choose your drive that your DVD is in and let it do it's analysis on the disk. This will take but only a moment.

My preferences are as follow.....

Select EDIT>PREFERENCES

Select the OUTPUT TAB and make sure that SPLIT VOB FILES INTO 1GB SIZE CHUNKS is NOT CHECKED

Select the STREAM SELECTIONS TAB and CHOOSE THE LANGUAGE YOU WANT.
Also, in the STREAM SELECTIONS TAB, make sure that DISABLE ALL SUBPICTURES EXCEPT MENUS AND FORCED STREAMS is CHECKED

Click OK to close the Preferences Dialog.

Select Re-Author at the top. We're only going to copy what we need to the hard drive.

Under Main Movie, on the right side, DRAG the titles that you want to encode to the left side. In my example of a sitcom DVD with Multi Episodes, there are 6 titles, but for a feature
film, there will only be one.

Once you have your selection dragged to the left side, you can preview any of the selections by selecting it and hitting the play button on the built in viewer. When your sure you have what
you want, go ahead and hit BACKUP!

Select a target folder for your files and MAKE SURE CREATE VIDEO_TS and AUDIO_TS SUBFOLDERS IS NOT CHECKED.

Select OK and your DVD selection is copied to your hard drive.

STEP 2. Converting to FLV
This is the cool part. Open your favorite text editor, I use TextPad. Insert the following code....

"C:\Program Files\ffmpeg\gui\ffmpeg.exe" -i "C:\PATH\OF\YOUR\VOB\3rd Rock\Season 1\Disk1\VTS_01_1.VOB" -t 60 -b 160 -r 15 -s 320x240 -hq -deinterlace -ab 80 -ar 44100 -ac 2 -croptop 10 -cropbottom 2 -cropleft 6 -cropright 6 "C:\PATH\FOR\YOUR\CONVERTED\FILE\Disk1\converted\3rdRock_Season1_Episode1.flv"

Make sure this is on ONE LINE and save it as a BATCH FILE. I call this one FLVCONVERT_4-3.BAT because the video I am encoding is in 4:3 format. I will make a separate BATCH FILE for
each scenario. For now, lets have a quick look at that code and what it is doing. You need to set some of these parameters to match your set up.

1). "C:\Program Files\ffmpeg\gui\ffmpeg.exe"
This is the path to your FFMPEG executable.

2). -i "C:\PATH\OF\YOUR\VOB\3rd Rock\Season 1\Disk1\VTS_01_1.VOB"
The "i" states which file you are encoding. Make sure your path to the VOB you just created is correct.

3). -t 60
This indicates that we only want to encode 60 seconds of the video. This if for testing and wiil be removed after we tweak the code to produce the output we want.

4). -b 160
Thats the bitrate. The lower it is, the smaller the resulting file will be. Higher numbers produce better quality, but much larger files. Since this is going to stream over the web, I
chose this as acceptable. Experiment with this, but remember, you will be encoding only 60 seconds. If you double it and your filesize jumps up 2 megs, and hour long feature will be
120 megs larger.

5). -r 15
This is the framerate

6). -s 320x240
This is your output size

7). -hq
This produces a higher quality encode.

8). -deinterlace
Deinterlaces a video. This is necassary for some things, like television episodes, but often not for feature films. If you have horizontal lines noticable in your encoded file,
you probably want to deinterlace.

9).-ab 80
Audio Bitrate

10). -ar 44100
Audio Rate 44100hz

11). -ac 2
Stereo

12). -croptop 10 -cropbottom 2 -cropleft 6 -cropright 6
Crop values. This is important because there is no need to encode the black bands that appear on all DVD's. They just take up precious space. In this example there is not much
to crop off, but on a feature film that is presented as 1:85 ratio, there is plenty to remove. It is good practice to remove the black borders.

13). "C:\PATH\FOR\YOUR\CONVERTED\FILE\Disk1\converted\3rdRock_Season1_Episode1.flv"
Finally, we have the path of our output file.

Once you have these parameters set, save the bat file and double click to run it. A DOS window pops up and VIOLA, you get a 60 second .FLV file after only a few seconds of encoding.
Very fast. View it and once your satisfied with the results, remove the -t 60 parameter and run it again. This time you will encode the entire video. An entire sitcom episode, 23 minutes,
starts off at over 750 mb becomes 39mb with these settings. and took about 5 minutes to encode.

If your DOS widow pops up and suddenly disapears, and you get no video encoding, something obviously went wrong. The most common issue I have run into is odd numbers. For instance, ffmpeg
seems to prefer -cropbottom 2 over -cropbottom 1. Odd numbers present odd problems. There is porbably a better explaination than this. Another issue could be bad paths in the parameters.

The last thing to do is inject the MetaData. Our gallery will not play the file without the MetaData injected. I use the free program in the link in my other post. However, it is NOT open source.
If we ever find a way to embed this into Gallery, we would need to inject the MetaData. Fortunatley, there is also this program, which IS open source and works well
FlvTool2

Hope this was helpful. While there are ways to get much better video quality using the On2 codec, this is the only way I figured out to go straight from VOB to FLV. Also, the file sizes are much
smaller and the encoding seems much faster. If you need top quality regardless of file size, then the On2 codec is the only way to go. It is truly amazing. Rivals anything out there IMHO.

One last note, if you need to run a batch of a bunch of files, say overnight, it is simple to set up. Just place additional SINGLE lines in your BATCH FILE and they will encode one after
another, like this.....

"C:\Program Files\ffmpeg\gui\ffmpeg.exe" -i "X:\PATH\OF\YOUR\VOB\3rd Rock\Season 1\Disk1\VTS_01_1.VOB" -t 60 -b 160 -r 15 -s 320x240 -hq -deinterlace  -ab 80 -ar 44100 -ac 2 -croptop 10 -cropbottom 2 -cropleft 6 -cropright 6 "C:\PATH\FOR\YOUR\CONVERTED\FILE\Disk1\converted\3rdRock_Season1_Episode1.flv"
"C:\Program Files\ffmpeg\gui\ffmpeg.exe" -i "X:\PATH\OF\YOUR\VOB\3rd Rock\Season 1\Disk1\VTS_02_1.VOB" -t 60 -b 160 -r 15 -s 320x240 -hq -deinterlace  -ab 80 -ar 44100 -ac 2 -croptop 10 -cropbottom 2 -cropleft 6 -cropright 6 "C:\PATH\FOR\YOUR\CONVERTED\FILE\Disk1\converted\3rdRock_Season1_Episode2.flv"
"C:\Program Files\ffmpeg\gui\ffmpeg.exe" -i "X:\PATH\OF\YOUR\VOB\3rd Rock\Season 1\Disk1\VTS_03_1.VOB" -t 60 -b 160 -r 15 -s 320x240 -hq -deinterlace  -ab 80 -ar 44100 -ac 2 -croptop 10 -cropbottom 2 -cropleft 6 -cropright 6 "C:\PATH\FOR\YOUR\CONVERTED\FILE\Disk1\converted\3rdRock_Season1_Episode3.flv"

Also, this isn't limited to VOB files, I think you can throw anything at it.

Easy Peasy!

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-04-25 16:04

I simply told ffmpeg module to check for flv in the -formats output and it seems to be doing fine creating thumbnails and detecting dimensions.. I'm not getting a duration, however.. ffpmeg -i {file} -vstats reports Duration: N/A in the output. This means we can't use thumbnail-page module to select a time offset for the thumbnail, but everything else works ok.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2006-04-25 18:04

Mindless, I just tried the same. I get a toolkit error. Either it is a windows&ffmpeg problem, or its the On2 codec I use to encode my flv. On2 was mentioned as experimental in ffmpeg docs. I will try with the sorenson codec later.

I created a Flv module from the Swf module(which I updated to work with 2.1).
This Flv module attemps to get the dimensions, upon failure it sets a default of 320x240 as per Banta's request.

I used the thumbnail module to set a default thumb, and the Flv module does the rest.

So if anyone's interested I'm attaching the Flv module, and also the updated Swf module.

See my examples in my gallery here.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2006-04-25 18:34

Ok, I just tried ffmpeg from the flash/riva package(a variant of 4.9_pre1) and I get an unsupported codec error. (better then the non-specific error I got before)
So I will try the sorenson codec now.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2006-04-26 00:42

Due to IE's recent "click here or we won't show it to you security update" I decided to externalize the script like the others.
A friend had to tell me that he could not see my movies to find this out - been so long since I used IE :)

So here's the new code:

Quote:
case 'video/x-flv':
$flvUrl = str_replace('&amp;', '%26', $src);
return sprintf('<script type="text/javascript">
// <![CDATA[
if (window.ActiveXObject) {
document.write(\'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="%s" height="%s" id="%s"%s>\');
document.write(\'<param name="movie" value="%s" />\');
document.write(\'<param name="salign" value="lt" />\');
document.write(\'<param name="quality" value="high" />\');
document.write(\'<param name="scale" value="noscale" />\');
document.write(\'<param name="FlashVars" value="skinName=%s&autoPlay=true&autoRewind=false&streamName=%s"/>\');
document.write(\'</object>\');
document.write(\'<noembed>%s</noembed>\');
} else {
document.write(\'<embed src="%s" flashvars="skinName=%s&autoPlay=true&autoRewind=false&streamName=%s" quality="high" scale="noscale" width="%s" height="%s" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\');
document.write(\'</embed>\');
document.write(\'<noembed>%s</noembed>\');
}
//]]>
</script>',

/* IE Object */
$width, $height,
!empty($params['id']) ? $params['id'] : 'movie',
!empty($params['class']) ? ' class="' . $params['class'] . '"' : '',
$urlGenerator->generateUrl(array('href' => 'modules/core/data/flvplayer.swf'), array('forceFullUrl' => true)),
$urlGenerator->generateUrl(array('href' => 'modules/core/data/skin'), array('forceFullUrl' => true)), $flvUrl,
$fallback,

/* Mozilla Object */
$urlGenerator->generateUrl(array('href' => 'modules/core/data/flvplayer.swf'), array('forceFullUrl' => true)),
$urlGenerator->generateUrl(array('href' => 'modules/core/data/skin'), array('forceFullUrl' => true)), $flvUrl,
$width, $height,
$fallback);

- Wayne

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-04-26 01:11

how does this behave differently? if using document.write bypasses whatever IE security thing, then it doesn't sound like much of a security thing!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2006-04-26 01:41

Yeah, you know it does not seem to make much difference, after a little testing. I guess the only way to externalize would be to call in an external js.

I guess it does not matter much.

Sorry, just trying options.

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Wed, 2006-04-26 05:12

I have a couple of questions. Perhaps you know the answers.

1). When running this under IIS, my movies will not play UNLESS I specify in ghe CONFIG.PHP..
$gallery->setConfig('baseUri', 'http://localhost/gallery2/index.php');
However, when this is set, I cannot add or delete items.

If I specify...
$gallery->setConfig('baseUri', 'http://localhost/gallery2/main.php');
I can add and delete, but not play the movies.

Any ideas of why this is happening and how I might fix it?

2). I added the FLV and the SWF modules available above. They seem to install fine but, I do not know what they are suppose to do
or, how to configure them, if configuration is needed.

3). What do I have to do to get the FFMPEG module working in IIS? I have three different versions of ffmpeg.exe on my system and they
all fail to get recognized as vailid under the mod. They all pass the command line -formats test. I have a differnt windows server
that allows at least one of em to pass but, I need to get it working with IIS. I am thinking this is some sort of permissions issue but,
What? Where?

4). What files do I have to modify to get the flv mime type recognized under the ffmpeg module? And what code gets added? I want to
try to get the thumb creation working with the other server while we figure out what is going on with IIS.

I had the Microsoft IE security update shoved down my throat. While it is annoying, it doesn't stop the movies from playing. They
do require a click in order to interact with the controls but, thankfully the movies play. HERE is a link to an Adobe page that
explains some work arounds.

Thanks for your help

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2006-04-26 11:17

In IIS I had to add the mime type for flv video/x-flv Had to do the same with the new divx format when I added their new webplayer (which we should add to gallery while we're at it).

Also why don't you try using your IP address instead of localhost. And set that in IIS control panel.

Some perms that are important in IIS are: g2data - IIS_WPG should have full control, IUSR_MACHINENAME should have read/write/exec, and more recently IWAM_MACHINENAME the same as IUSR.

I downloaded the precompiled for win32 ffmpeg package from gallery.sourceforge version 4.8 I think.
unpack ffmpeg to c:\ffmpeg give IIS_WPG full control, IUSR_MACHINENAME read/exec. If you add c:\ffmpeg to your system path(same with imagemagick and netpbm) gallery will auto config.
Path to ffmpeg in gallery admin: c:\ffmpeg\ffmpeg.exe
in modules\ffmpeg\classes\FfmpegToolkitHealper.class add $relevantTypes['flv'] = 'flv'; around line 140 reinstall ffmpeg module, and test it in admin and save if successful.
So far I have yet to get ffmpeg to create any thumbs for flv, if you use the older sorenson codec, you would have a better chance. I use flash8 which uses the new On2 codec which ffmpeg does not support.

Good luck,

- Wayne

 
Eka_Mei

Joined: 2006-01-03
Posts: 132
Posted: Wed, 2006-04-26 13:02

Anyone care to sum this up for us on how to install this improvement? Just the ability to play flv in a flash control window would be great. I don't even care that much if I have to manually edit all the size, and manually remake/upload all the thumbnail. Flash video is just by far much better then any other media support. I want my members to actually see a video, not deal with silly codex.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-04-26 14:50

I have much of this ready to commit to the codebase, so soon all you'll need to do is get a nightly snapshot. Unfortunately we are in limbo between CVS and Subversion and unable to commit anything right now. The "swf" module above is already obsolete, that code has been committed (you don't need a separate module.. all of imagemagick,netpbm,gd will get dimensions of swf).

 
Eka_Mei

Joined: 2006-01-03
Posts: 132
Posted: Wed, 2006-04-26 15:30

Interesting. I runs a swf module myself, Look like I can finally get rid of it when I upgrade from my 2.1 rc1 to 2.2 nightly.

By the way, good call with subversion. It is by far better then CVS.

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Wed, 2006-04-26 17:16

Ok, this is kindof whacky Not sure why this is happening but, as I stated above...

1). When running this under IIS, my movies will not play UNLESS I specify in ghe CONFIG.PHP..
$gallery->setConfig('baseUri', 'http://localhost/gallery2/index.php');
However, when this is set, I cannot add or delete items.

If I specify...
$gallery->setConfig('baseUri', 'http://localhost/gallery2/main.php');
I can add and delete, but not play the movies.

Changing to IP instead of localhost and configuring IIS with the flv MIME type did not change this behavior.

any further ideas I might try?

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Wed, 2006-04-26 18:31

OK, I got this figured out. I am not sure if/how this effects our implementation of the FLV features.
I had to change a line of the code to make it work. Here, I will recap/describe what worked and didn't so that
perhaps a different solution can be implemented. This is only FYI and relates to local IIS.

First, what wasn't working..
In config .php
$gallery->setConfig('baseUri', '');
Lauching a FLV video, produced this...
<param name="FlashVars" value="skinName=http://localhost/GALLERY2/modules/core/data/skin&streamName=main.php?g2_view=core.DownloadItem%26g2_itemId=17%26g2_serialNumber=2&autoPlay=true&autoRewind=false"/>
This didn't play a video, the streamName Parameter was in question here.

What did work....
$gallery->setConfig('baseUri', 'http://localhost/gallery2/index.php');
FLV returned....
<param name="FlashVars" value="skinName=http://localhost/gallery2/modules/core/data/skin&streamName=/gallery2/index.php?g2_view=core.DownloadItem%26g2_itemId=17%26g2_serialNumber=2&autoPlay=true&autoRewind=false"/>
However, I could not log in, add or delete/modify anything. But, the movies that already existed played.

Temporary(?) solution...
$gallery->setConfig('baseUri', '');
Changed the parameter in the code in GalleryAnimationItem.class to the following...
<param name="FlashVars" value="skinName=%s&streamName=/gallery2/%s&autoPlay=true&autoRewind=false"/>
Which produced this..
<param name="FlashVars" value="skinName=http://localhost/GALLERY2/modules/core/data/skin&streamName=/gallery2/main.php?g2_view=core.DownloadItem%26g2_itemId=17%26g2_serialNumber=2&autoPlay=true&autoRewind=false"/>
and everything was happy ( login, delete, etc..)

Basically, I had to add /gallery2/ before the %s in the streamName param.

Not sure why this worked, or what the consequences for other servers will be yet, but happy to find a solution for IIS.
____________
Banta

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Wed, 2006-04-26 20:52
suprsidr wrote:
Some perms that are important in IIS are: g2data - IIS_WPG should have full control, IUSR_MACHINENAME should have read/write/exec, and more recently IWAM_MACHINENAME the same as IUSR.

I downloaded the precompiled for win32 ffmpeg package from gallery.sourceforge version 4.8 I think.
unpack ffmpeg to c:\ffmpeg give IIS_WPG full control, IUSR_MACHINENAME read/exec. If you add c:\ffmpeg to your system path(same with imagemagick and netpbm) gallery will auto config.
Path to ffmpeg in gallery admin: c:\ffmpeg\ffmpeg.exe
in modules\ffmpeg\classes\FfmpegToolkitHealper.class add $relevantTypes['flv'] = 'flv'; around line 140 reinstall ffmpeg module, and test it in admin and save if successful.
So far I have yet to get ffmpeg to create any thumbs for flv, if you use the older sorenson codec, you would have a better chance. I use flash8 which uses the new On2 codec which ffmpeg does not support.

Well, I'll be Damned, IT WORKS!
Getting FFMPEG Module to work was the tough part. But, once I had that activated, and added the relevantTypes parameter you outlined, ( Uninstall ffmpeg and reinstall ), I was delighted to see the thumbnail was created when adding a new .flv file to the Gallery. Cool Beans! This is coming along nicely.

Now, for anyone who is having the headaches learning how to get the ffmpeg.exe recognized in the ffmpeg module under IIS. Here's how I did it. There are lots of places saying what needs to be done, but I found very little on clear instructions for, shall I say, Dummies ( referring to myself :).

1) Find cmd.exe on your computer. On my XP machine, this was
C:\WINDOWS\system32\cmd.exe

2)cmd.exe Right Click>Properties
Select the security tab ------SCCREEEAACHHHH! No security tab? No problem!
If you do not see a security tab, do the following..
a).Open Windows Explorer
b).Tools>Foler Options
Select the View Tab and UNCHECK Use Simple File Sharing
Viola - Security tab is now available.
3). Select Internet Guest Account from the Group or User Names: section
4). Place a checkmark in READ and READ & EXECUTE
5). Apply and Restart IIS

Go back and configure the ffmpeg module. Your ffmpeg.exe should be recognized now. If your adding the relevantType for FLV after this, remember to uninstall and re-install the module. Don't worry, ffmpeg.exe WILL get recognized again.

Congrats, you have just enabled your ffmpeg module and opened up a big security hole on your machine. But hey, it works!

Hope this helps someone who runs into the same issues.
__________
Banta

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Thu, 2006-04-27 03:11

If you still have trouble getting the ffmpeg.exe to be recognized in the ffmpeg module under IIS....
One more step may be necassary...

Right click on My Computer and choose MANAGE

-Expand SERVICES AND APPLICATIONS
-then EXPAND WEB SITES
-Right click on the default web site under which Gallery is running and choose PROPERTIES

-Select the HOME DIRECTORY TAB
-Under LOCAL PATH, make sure at least READ and WRITE is checked.
-Under APPLICATION PROTECTION, select Low(IIS Process) from the dropdown.

APPLY and Restart IIS.

The Application Protection was giving me fits when set to Medium.

HTH
__________
Banta

 
astapelfeld

Joined: 2006-03-22
Posts: 4
Posted: Sat, 2006-04-29 11:02

The flvplayer I attached some time ago came from :
http://coppermine-gallery.net/forum/index.php?topic=16818.0 (must be logged to see the attachment)

This seems to be a modification of this one:

http://www.peldi.com/fmswiki/index.php?title=FLVPlayer

And its probably licensed under Creative Commons Attribution-NonCommercial-ShareAlike License:

http://www.peldi.com/fmswiki/index.php?title=TwoWay

I really like this player.. the skin can be easily changed.. but I guess that license is not compatible with the GPL.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2006-04-30 20:21

I created a new player just for this app, skin is embedded, so no use for an external skin.

I could still do a little localization, if mindless points me in the right direction.

I even added a nifty little right-click context menu :)

If someone could do a little testing, I would appreciate it. Took me some time to get everything to scale properly.

so without the call for a skin, the code would be a little different (although flash will just ignore the extra vars):

Quote:
case 'video/x-flv':
$flvUrl = str_replace('&amp;', '%26', $src);
return sprintf( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="%s" height="%s" id="%s"%s>

<param name="movie" value="%s" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="FlashVars" value="streamName=%s"/>
<embed src="%s" flashvars="streamName=%s" quality="high" scale="noscale" width="%s" height="%s" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
<noembed>%s</noembed>
</object>',
$width, $height,
!empty($params['id']) ? $params['id'] : 'movie',
!empty($params['class']) ? ' class="' . $params['class'] . '"' : '',
$urlGenerator->generateUrl(array('href' => 'modules/core/data/player.swf'), array('forceFullUrl' => true)), $flvUrl,
$urlGenerator->generateUrl(array('href' => 'modules/core/data/player.swf'), array('forceFullUrl' => true)), $flvUrl,
$width, $height,
$fallback);

You can see it in action here.

Let me know if I'm allowing too much buffering(15 seconds), and if everything is scaling properly.

This would be the last piece for inclusion in the next update correct?

Thanks,
- Wayne

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Sun, 2006-04-30 23:39

Wayne,
I tested out your player. Nice work.

Couple of things I noticed when viewing your example. The preloader (gallery image) was
on the screen longer than I expected. When the movie started to play, the buffer showed 25% was
already loaded. I am not sure if this is something that can be worked out, but I think the movie
should begin to play as soon as enough info has been downloaded. On my local test, 15% was loaded
on a full length movie before the movie began to play. But, this was no longer of a delay than before.

When a movie begins to play, the controls are visible immediately. On first mouseover, they become invisible,
requiring a second mousover to make them visible again. Then, they remain on stage even on mouseout. The way the
old skin was working was similar, as the controls were visible as the movie started to play. However, they did
disappear and reappear as expected. IMHO, this was not right either. I think that the controls should only be visible
on mouseover, ever. Or better yet, they appear when the movie starts and then fade to 0% alpha so that the user knows that they are there.
When embedding a movie in Flash the traditional way,(in the Flash authoring environment)there is
the option to make the skin invisible on start of movie play. Is it possible to make your player skin only on mousover?

I really like your controls. They are far better than what we are working with before. I also like the addition of the
FF and RW, as well as the start over option. Plus, your control looks better. The only other observation I have is the
weight of the player. It is 60k as opposed to 16k on the previous player + skin. I suspect the majority of the added
weight to the player is due to the Gallery graphic for the preloader. Is it possible to get the weight of the player
down, even if the preloader just uses text or turning the Gallery image into a vector? If needed, I can convert the logo
into the vector. The latest Illustrator has some sweet tracing tools that work better than Flash's native bitmap tracer.

Anyway, I think this is on a great track and that you have done, once again, excellent work on this.
I want to thank you for your efforts. I don't think I would be in the process of converting hours and hours
of home movies into FLV format if you hadn't worked to figure this out.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-05-01 03:49

localization: if you have any text in the player, make the text a parameter to the player (or maybe an optional override).. that way G2 localization can specify the translated string.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2006-05-01 04:50

Banta,
I was not really happy with the size myself, got it down to 36k. Also changed the bufferclip a bit, and only buffering 10 seconds now.
The controls are now hidden onload by default.
Some other scaling issues resolved too.

Mindless,
we could pass an array. $lang(play,pause,stop,replay......) right?
I was just wondering where the localization files are, what they look like, and example coding.

- Wayne

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-05-01 14:22

http://codex.gallery2.org/index.php/Gallery2:Localization
locale source files are in modules/*/po dirs, they get compiled and go in the locale subdirs. in a tpl file you use {g->text to translate, in php code you load a module with GalleryCoreApi::loadPlugin and use $module->translate.
or maybe rather than pass actual strings as flash params, add a single URL as a param where you can read all the translated strings.. one per line or something.

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Mon, 2006-05-01 18:56

Nice player. I would like to suggest being able to seek later in the video, and have it pause/rebuffer, and continue from that point. Similar to google.

As im playing with it, watching one of your movies, it would be useful to be able to skip to the middle of the movie and start playing from that point.

Also i think the mouseover for the controls popping up and leaving needs work. seems if i mouse on, they turn on, then i mouse off, nothing happens. then i mouse over again they'll turn off. they should only be visible when your hovering, then as soon as you leave they should fade out.

looking great though, I can't wait to start converting my videos over. Might I suggest Riva FLV encoder (its free) to users who wish to encode their videos locally before upload. (though it would be really nice to see a server side processor.)

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Mon, 2006-05-01 20:08

Getting Closer!
File size is definately better!

Controls hidden at start is also better! Mouseover effects need a couple of tweaks.
The controls need to be visible only on mouseover. If the mouse is over the movie,
the controls are visible. If the mouse is off the movie the controls are not visible.

When scrubbing, the controls disappear shortly after the scrub, even though the mouse is
still over the movie. Ideally, the controls will not disappear unless the mouseoff event.

At the end of a movie, the gallery logo cycles. Is it possible to put a play icon (>) on
the graphic so that clicking the movie will envoke the replay command? I know that you can
right click and get the replay menu, but alot of users are not aware that you can right click
a swf and get a custom menu. A simple play button would be great. This is minor, but would
be nice if possible.

Thanks for your good work!

 
Eka_Mei

Joined: 2006-01-03
Posts: 132
Posted: Tue, 2006-05-02 02:32

This sound too good to be true. Gallery is going to support Video properly, finally! O.o
I can't think of anything else Gallery can't handle well now beside Document files. Perhaps the summer of code idea about the CMS will get that done as well. I deeply appreciate your effort (Suprsidr, Banta, mindless, etc) on this so far. Keep it up!

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Fri, 2006-05-05 02:17

Could someone please tell me how to get this working for Flv format?
Thanks

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-05-05 14:40

you can try putting together the code snippets from above, or you can wait a bit longer and try a nightly snapshot.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2006-05-07 13:52

Ok, after much testing, and decision making, I think this player is ready.

- controlbar now show for 2 seconds onload just to hint as to where they are.
- controlbar mouseover hotspots optimized
- bufferclip now looks beautiful - thanks neven :)
- removed tooltips and custom context menu for smaller file size(19KB), and no longer need for localization (do we really need all that extra code?)
- replay button now appears at end of clip

TODO: full screen button?

Please test it out for me, and let me know what you think.

doomdead,

Quote:
As im playing with it, watching one of your movies, it would be useful to be able to skip to the middle of the movie and start playing from that point.

The scrubberBar has that functionality already. But this is progressive dl, not true streaming. So you would have to wait for enough of the movie to load. Otherwise you would need a streaming server. Flash Media server currently sells for $2,000+.

 
Eka_Mei

Joined: 2006-01-03
Posts: 132
Posted: Sun, 2006-05-07 20:23

How about a button that will let people download the video file easily? At least, make that optional for the webmaster to implant?

 
Julien2

Joined: 2006-04-12
Posts: 8
Posted: Sun, 2006-05-07 21:24

I am very interested to try it but... how does it work ?
I followed these steps :
1) Replace GalleryAnimationItem.class with the new one
2) Put flvplayer.swf, skin.swf and thumb_flv.jpg in modules/core/data
3) Create new modules/flv and modules/flv/classes directories. I put module.inc in the first directory and FlvToolkit.class in the second.
4) The same steps for swf module
5) I installed and activated flv and swf module under the G2 console. Everything all right.
6) I created a new mime type : video/x-flv for .flv extension

When I try to view my flash video, nothing append. There is no thumbnail in the album (there is a hyperlink instead), and when i click on it, there is another hyperlink for download the video...

Is there a thing i forgot ?

That's it !! :) it works
So, for it works I did that :
1) Edit modules/core/CoreModuleExtras.inc, look for GalleryAnimationItem.. the 2nd place you find this you'll see a list of mime types just below it.. add the type for flv (video/x-flv).
2) Also add that mime type to modules/core/classes/helpers/GalleryMimeTypeHelper_advanced.class if needed.
3) Bump the core module version to apply your changes:
3.1) modules/core/module.inc, find the setVersion line and increment the last digit by one
3.2) modules/core/CoreModuleExtras.inc, look for "README:" and you'll find some instructions on adding a new version.. basically look for "case 'end of upgrade path'" and just above that add case '1.0.30': or whatever is the OLD core version (if you just changed module.inc to 1.0.31 then you want case 1.0.30)
3.3) just below your new case statement put code to add your new mime type (the change in MimeTypeHelper_advanced only adds the type in new installs).. you can copy the content from case '1.0.1' and just adjust the extension/mime type.
3.4) search for the next "case 'end of upgrade path'" and add the same "case" line here.. don't need any content after it.

...thanks mindless

 
astapelfeld

Joined: 2006-03-22
Posts: 4
Posted: Mon, 2006-05-08 09:20

@suprsidr:

great work!

I just think it would be better if the controls are shown when the mouse pointer is anywhere over the player and not only on the area where the controls appear.
I've also found a minor bug: when the video ends and you use the "replay" button from the controlbar, the big "replay" button that appears when the video ends never disappears.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2006-05-08 22:13
Quote:
I've also found a minor bug: when the video ends and you use the "replay" button from the controlbar, the big "replay" button that appears when the video ends never disappears.

Good catch, I'll get that fixed tonight.

Quote:
I just think it would be better if the controls are shown when the mouse pointer is anywhere over the player and not only on the area where the controls appear.

Ah, yeah..... humm. I also got a request for a pause/play action when you click the video, so I think I can work that in. There still has to be a hotspot surrounding the movie to hide the controlBar.

So if there are no more bugs, or requests, I'm going to post the final player tonight so mindless can include it :)

-W

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2006-05-09 00:44

Ok, so here it is.... player_final
Added play/pause action to the screen, fixed the bug, and increased the controlBar rollon to 10px from the edge all around (meaning the rolloff is 10px outer rim).

Happy flv'n
-Wayne

 
Julien2

Joined: 2006-04-12
Posts: 8
Posted: Wed, 2006-05-10 21:04

Hi,

I tested the latest version of the player and GalleryAnimationItem.class and I have several remarks :
1) I have none thumb image in my album for the flash video. In the thumbnail manager, I tried to add 2 new mime types for the video image. I tried with Firefox and IE
2) The video doesn't appear with IE whereas it works with Firefox. I noticed in the HTML source code that width and height equals ""
3) I tried 2 differents videos. One works. The other doesn't very well, it doesn't very fluid, my CPU charge is very high = 100% (P III 450Mhz, RAM = 768 Mo)
I made these flash videos from AVI taken with my camera. I encoded to FLV with Riva FLV Encoder 2.0

 
astapelfeld

Joined: 2006-03-22
Posts: 4
Posted: Wed, 2006-05-10 22:11

maybe the ffmpeg module is not working and you have to set the height/width manually?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2006-05-10 23:33

Riva FLV Encoder uses ffmpeg to encode flv's. Ffmpeg does not inject metedata into the flv movies, so it goes to say that the ffmpeg toolkit cannot detect size, or length.... Some of my flv's are also encoded using ffmpeg, and I noticed the scrubberBar does not move during play(no metedata) not to mention the thumbnail issue.

I use sorenson squeeze, but its kinda expensive and the spark codec is kinda poor. And I also use Flash's own encoder, but it uses the On2 codec which ffmpeg does not support.
So the hunt is on for a cheap/free/open source encoder to recommend to our users until this summer when ffmpeg adds support for On2(fingers crossed).
Any suggestions?

Quote:
The video doesn't appear with IE whereas it works with Firefox. I noticed in the HTML source code that width and height equals ""

You can edit your movie and manually add dimensions.

-W

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2006-05-11 00:14

The core changes are in place in svn and I have the flashvideo module just about put together. It uses suprsidr's player by default but in the PHP file it has some instructions to use FlowPlayer or FLVPlayer instead (G2 admin must go get the player and then uncomment a few lines in the PHP class). Thanks suprsidr, should have this in place very soon!!

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Thu, 2006-05-11 02:00

I have Flash 8 and it gives you the option of using "flash 8 on2 vp6" or "flash 7 sorenson/on2." Will using Flash 7 work?
About having no metadata, I found a metadata injector on this site http://www.flvplayer.com. hopefully it works with riva encoder...I havnt tested it because I can't figure out how to set up Flv for gallery yet. I will have to try the directions in the post above.

Thanks for making this happen!

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-05-12 17:07

Flashvideo module now in svn! Update from svn now to try it, or get tomorrow's nightly snapshot.

 
Eka_Mei

Joined: 2006-01-03
Posts: 132
Posted: Fri, 2006-05-12 17:50

Does the module requires modification to the core? or does it works for 2.11 at the moment?

I won't mind to upgrade to the 2.2 svn to try it though, just wondering.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-05-12 18:30

it requires core api 7.9, which means you need current svn.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2006-05-12 18:48

Just tested it out. Good day to play hookey from work. :)
Did a full update to 2.2-svn

Well,
I had to take thumbnail creation away from ffmpeg(edit ffmpegtoolkithelper.clas). On windows ffmpeg does not work properly, I get timout errors everytime.
So with that disabled I was allowed to upload movies again. But I cannot upload custom thumbnail, can only use default.
Everything else looks quite spiffy to me :)

Is there a way to make the flashvideo plugin take ownership of exsisting flv's?
I had to delete the ones that I had up there and re-upload.

-Wayne