Embedded Video Improvement

mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-05-12 19:50

if you get gallery2 (current svn/2.2), upload some flvs and then install/activate flashvideo, it will work for those. flv's uploaded on 2.1.x or older don't get used (G2 only knows them as GalleryUnknownItem).

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2006-05-12 23:06

How cool am I?
Been working the past few days on a fullscreen button for our player.
And Eureeka! I think I've got it.

See it in action here.

If anyone is interested, or if we want to update the exsisting player let me know.

Also, ffmpeg does work with the older sorenson spark codec on windows, so for now I will just have to encode my gallery items with that.

I do get an error in thumbnail manager while trying to change the default thumb though:

Quote:
Fatal error: Call to undefined function: getrenderer() in d:\inetpub\wwwroot\wiseguys_setup\public_html\gallery2\modules\core\classes\GalleryTemplateAdapter.class on line 337

But I'm sure someone is already working on that.

Mindless,
Great job putting together this new module ooops I mean plugin. Kudos!

-Wayne

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-05-12 23:48

nope, hadn't caught that yet.. now fixed, thanks.

(and "module" is correct.. in G2 terminology modules and themes are all "plugins")

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Fri, 2006-05-12 23:51

Wayne,
This is great! I think it would be a worth wile addition. And the full screen button is unobtrusive, so it doesn't get in the way of anything at all.

Love it! Can we just replace the player we have now with this one and it will work? or is there something that needs to be coded for it to function? Post it ! I want to try.

The files I encode using ffmpeg, as describes earlier in this thread, produce thumbnails when uploading them to Gallery. Also, you can add code to tell which frame you want. For instance, I have mine set to 35, so, everytime I upload a movie, it makes the thumbnail from frame 35. It is not an all around sollution but, it is better than a blank that I got most of the time from frame 1. If anyone is interested, let me know and I'll find the code that does that.

Good job !

__________
Banta

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2006-05-13 00:23

Here's the newest version. You need to replace the one you have, or rename it in the code:

Quote:
$pw = "100%";
return sprintf('<script type="text/javascript">
// <![CDATA[
<!--
function divResize(ID,nw,nh) {
document.getElementById(ID).style.height=nh+"px";
document.getElementById(ID).style.width=nw+"px";
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(screen.availLeft,screen.availTop);
}
//-->
//]]>
</script>
<div id="videoDiv" style="width:%spx;height:%spx">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="%s" height="%s" id="%s"%s%s>
<param name="movie" value="%s"/>
<param name="FlashVars" value="%s"/>
<param name="quality" value="high"/>
<param name="scale" value="noscale"/>
<param name="salign" value="lt"/>
<embed src="%s" flashvars="%s" type="application/x-shockwave-flash"
width="%s" height="%s" quality="high" scale="noscale" salign="lt"
pluginspage="http://www.macromedia.com/go/getflashplayer"/>
<noembed>%s</noembed>
</object></div>',

$width, $height, $pw, $pw,
!empty($params['id']) ? $params['id'] : 'movie',
!empty($params['class']) ? ' class="' . $params['class'] . '"' : '', $extraAttr,
$playerUrl, $flashVars, $playerUrl, $flashVars, $pw, $pw, $fallback);
}

Notice I changed the cab version for flash to 8, my players use code that only works in v.8. But some of it does work in 7, so users should be able to at least view the movies. Linux users are not so lucky though still stuck at v.7 can only hope v.8 comes out soon for them.
So if you are concerned about flash versions you can set it at 7, should still work for those who have 8 installed.

-Wayne

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2006-05-13 15:35

Hey Banta, I just noticed I forgot to add the </div> after </object>.
Was wondering why it looked so screwed up on linux ;)

-W

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Sun, 2006-05-14 19:54

OK,
I've become lost in translation. I was out of it for a week and now I am confused. The method was before to add..

The wat I was doing it was to add to the file GalleryAnimationItem.class code that started with..

case 'video/x-flv':
and ended with...
$fallback);

But now the code you state to adjust above looks different and I am confused on where this is to go.
I have not updaded to current svn/2.2 or anything. I was just continuing to use my current 2.1 developer installation.

What do I have to do and where should I put the new code. Sorry, I musta got lost, somewhere down the line.

Thanks for your help..... Again!
_)_________
Banta

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2006-05-14 21:47

This work has been integrated into Gallery. That means you should undo all local modifications you made (GalleryAnimationItem, etc) and update to current svn or nightly snapshot. If you want the full-screen change from above you can then apply it to modules/flashvideo/classes/FlashVideoRenderer.class.

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Sun, 2006-05-14 22:01

Unfortunately, upgrading is out of the question if you are using an integration.
Hopefully someone can find some time to do up a quick how-to guide for 2.1.1a.

Pretty please

 
mindless
mindless's picture

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

why is upgrading out of the question? there are the usual risks of pre-release code, but I don't see why it wouldn't work with existing 2.1 integration modules.

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Sun, 2006-05-14 23:21

I lost the use of the sidebar when I upgraded.
Everthing else worked without fault...including the flashvideo module.

 
Eka_Mei

Joined: 2006-01-03
Posts: 132
Posted: Mon, 2006-05-15 04:57
spankee wrote:
I lost the use of the sidebar when I upgraded.
Everthing else worked without fault...including the flashvideo module.

Lost the use of side bar? What are you intergating?

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Mon, 2006-05-15 05:14

It's integrated into Xoops.

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Tue, 2006-05-16 01:20

I just upgraded to last nights nightly, and in IE i get a thumb, and firefox i get 'download movie'.... scanned the forums and not coming up with much help. can someone point me into the right direction? sure would love to use flvs.

i dont have any other movie types already uploaded.

Gallery version = 2.2-svn core 1.1.4
PHP version = 4.4.2 cgi-fcgi
Webserver = Microsoft-IIS/6.0
Database = mysqlt 4.1.13a-nt, lock.system=flock
Toolkits = Thumbnail, ImageMagick, Ffmpeg, Gd, NetPBM, ArchiveUpload, Exif
Acceleration = full/86400, full/86400
Operating system = Windows NT SERVER 5.2 build 3790
Default theme = matrix
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2006-05-16 01:52

Here's the deal. Your movie has no dimensions.
If You "edit movie", and give the dimensions, it will display properly.

FFmpeg is supposed to handle movies with .mov,.wmv,.flv...... extensions, but on windows it does not opperate properly.(I have many ffmpeg builds to test)

Although if your movie uses a codec that ffmpeg does not recognise, you will still get an unkown error.

I'm in close contact with the ffmpeg boyz' and we are working to resolve this. I'm hoping to have a new build shortly.

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Tue, 2006-05-16 02:17

sweet, thanks suprsidr, i will test that out asap. im sure it goes without saying but, remember to post a link for us all to get the new build.

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Tue, 2006-05-16 02:20

ok. i did what you said, but my flv movie already had 480x360 as the movie dimensions. now what?
and, if what you said is correct, why/how? (i used riva to encode and uploaded to the site) 800kb flv file.

http://www.robplatt.com/main.php?g2_itemId=83654

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Tue, 2006-05-16 02:20

hmm, i am using url rewrite....??

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2006-05-16 02:56

From what I see on your site, It looks like none of the necessary changes have been made. Did you update to 2.2-svn or the latest nighly?

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Tue, 2006-05-16 03:13

Gallery version = 2.2-svn core 1.1.4............got last nights 'nightly build' off jesse's page....... flv WAS registered in my mime types. so i know i got somewhat of your progress.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-05-16 06:09

G2 shows the thumbnail when you don't have "view original" permission and you don't have "view resize" permission or there are no resizes (movies won't have any resizes..)..

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Tue, 2006-05-16 15:59

ok under the mime type, viewable was off, i tried it on as well and didnt see any change in the thumbnail behavior. also, the thumb only shows in IE, firefox displays the download link.

 
Banta

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

OK, I installed the nightly snapshot and everything is working nicely.

I have a couple of questions.

1). Using thumbnail manager, should I be able to select the time offset of which I would like the thumbnail to be? Right now, I get ' Seconds (Max = 0.000) ' for my movie clips. Selecting an offset time produces this error... 'There was a problem processing your request.'
I am using IIS and ffmpeg module is working, as I get frame 1 for the thumb of newly uploaded files.

2). What is the trick to get this to work with existing uploads in the Gallery? For instance, I have 20 movie clips. Upon installing the new Snapshot, the clips only had a 'Download' link. When I add a new clip or, delete and re-upload an old clip, it works as expected. I though I read that it can be done, but, it perhaps I was mistaken.

suprsidr
Kudos once again for your work on the player. It is working very nicely and looks great! Very impressive work on this one guys.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2006-05-16 19:12

Doomdead,
You may have to add the mime type to your server too.

Banta,
Thanks :) and the only way to change those is either to re-upload or dig through your db and change them manually.( I asked the same question above )
And you movies are showin a duration of 0 seconds. FFmpeg aparently is not detecting duration on windows. same problem here.

-Wayne

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Tue, 2006-05-16 20:57

OK, Thanks.

To get around the first frame as thumbnail issue, I modify the file \modules\ffmpeg\classes\FfmpegToolkit.class

find the code..

	case 'convert-to-image/jpeg':
	    $args = array('-f', 'mjpeg', '-t', '0.001', '-y', $tmpFilename);
	    if (isset($context['ffmpeg.offset'])) {
		array_unshift($args, '-ss', $context['ffmpeg.offset']);
		unset($context['ffmpeg.offset']);
	    }

and chage it to...

	case 'convert-to-image/jpeg':
	    $args = array('-f', 'mjpeg', '-t', '0.001', '-y', $tmpFilename);
	    if (isset($context['ffmpeg.offset'])) {
		array_unshift($args, '-ss', $context['ffmpeg.offset']);
		unset($context['ffmpeg.offset']);
	    }else { 
	    array_unshift($args, '-ss', '26.5'); 
	    } 

This will create a thumb approx. 26 seconds into the movie upon initial upload. Change the number to whatever is appropriate

HTH
__________
Banta

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Thu, 2006-05-25 19:30

I am using 2.1 and when you play short clips of say 4 seconds the gallery2 animation does not stop until the video ends.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2006-05-25 20:16

The player buffers 10 seconds of the movie before playing. So it starts playing as soon as the buffer is full, in your case never.
I'll see what I can do. Fixing something like that may break others in the player.
Never thought of a clip of 4 sec. as a movie.

-s

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Thu, 2006-05-25 22:19

have it play at 10 seconds or if buffer length => movie length....

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Fri, 2006-05-26 00:05

I have also noticed in Firefox the status bar continues to show "transferring data from..."
I am not sure if actually is transferring, I don't know how to check.

I have a lot of .flv's transcoded from .mov that are real short from a digital camera.
Hopefully you can get that sorted out.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2006-05-26 02:44

Spankee, try this one, and let me know if it works, I have no small clips to test with.
I added:

Quote:
if(obj.code == "Play") {
replay_orb._visible = false;
bufferclip._visible = false;
}

Hope this does the trick :)

oh yeah, as long as there are listeners active, ff shows data activity.

-s

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Fri, 2006-05-26 06:18

No, that did not work. It still shows through the whole clip.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2006-05-26 11:23

Spankee, if its not too personal, could you post one of your short clips for me to test with.

-s

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Fri, 2006-05-26 19:49

I did not have a short one available, but I was able to create one.
It should be about 4 seconds. The size is 320x 240, umm but I guess that doesn't really matter.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2006-05-26 22:58

See if this does the trick for you. Its hard to tell as my server is on my lan, and everything loads instantly.
So I cannot tell if it breaks the functionality on large clips.
But, the bufferclip only shows for about a sec.

-s

 
spankee

Joined: 2004-06-12
Posts: 51
Posted: Fri, 2006-05-26 23:30

It seems to working for me--large and short clips.

Thanks

 
unknownserv

Joined: 2006-05-27
Posts: 1
Posted: Sat, 2006-05-27 09:46

Where can I download this entire module?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2006-05-27 14:39

Its available in the nightly snapshots, or svn. But it will not work with 2.1 or lesser. You would have to upgrade to the latest core(which is not considered a stable release).

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2006-05-29 11:10

Thought those that are following this thread may be interested in the MP3Audio module for inline play of mp3s.
http://gallery.menalto.com/node/49776

-s

 
rl

Joined: 2006-06-05
Posts: 11
Posted: Mon, 2006-06-05 04:25

This post is in regards to adding video/x-flv mime type support to G2.

I tried all this up until this point and I got some sort of version error. When I bumped the version number I went from 1.1.0.1 to 1.1.0.2. One of the errors I got was related to the fact that there was no case statement for 1.1.0.1. I backed out the changes and I guess I will wait for native suppport in some future release.

Thanks for all your efforts getting this to work. I just had trouble with the version that I have.

Rich

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-06-05 07:36

just get a current nightly snapshot.. you don't need any of the patches/code listed in this topic anymore.

 
rl

Joined: 2006-06-05
Posts: 11
Posted: Wed, 2006-06-07 02:43

I got the latest G2 cvs release (dated 6-5-2006) and upgraded. It must be pilot error because when I upload a .flv file, I am not able to view it. I just have the save or open with option when I click on the hypertext. I have a mime type of video/x-flv enabled. Any other thoughts as to why I cannot view the flv file?

Thanks.

Rich

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2006-06-07 02:53

Your flv probably has no dimensions, navigate to your flv in gallery -> edite movie -> give it some dimensions ->save.

If you used the On2 codec to create your flv, ffmpeg does not know how to read it, or maybe you don't have ffmpeg installed/configured.

Have fun with Gallery :)

 
Banta

Joined: 2006-04-18
Posts: 35
Posted: Wed, 2006-06-07 03:38

I'm curious why we cannot play FLV's encoded using On2's encoder?

I tried but, I too get the results described by rl. FLV's encoded with other methods work fine.

Thanks in advance for any explaination you might be able to offer.

Banta

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2006-06-07 08:00

You can play em, but ffmpeg does not support that codec yet, so it cannot detect size, durration and dimensions so no thumbnail either.
The movies on my devsite here were recorded with a mix of Spark pro and On2.
You can tell the difference by the offset thumbs and the quality.
The ffmpeg team claims to be working to include support for On2 - hopefully by summers end.

-s

 
rl

Joined: 2006-06-05
Posts: 11
Posted: Thu, 2006-06-08 22:20

For some reason my configuration must be different. When I "edit" the uloaded flv file, I am not provided an option to change "dimensions" of the file. I do not have ffmpeg. I host with siteground.com (very reasonable, but no ffmpeg or shell access). Is it possible that it could be the file. Does anyone have an .flv file that I could try to see if that is it?

Thanks for the support.

Rich

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2006-06-08 23:25

Try this one here.

 
doomdead

Joined: 2003-04-06
Posts: 174
Posted: Thu, 2006-06-08 23:57

Just FYI, for whatever its worth, I encoded numerous files using Riva FLV Encoder, and uploaded them. (earlier i was having problems because no one told me there was an FLV module to activate, and i couldnt see my plugins page due to some error, once activated flv files played fine).

However, the dimensions were in gallery, I did not put them there. Riva uses ffmpeg.

 
Morbus Iff

Joined: 2006-06-09
Posts: 6
Posted: Fri, 2006-06-09 15:39

suprsidr: I was wondering if I could request a feature. I collect videos, and have a veritable smorgasbord of different video formats (divx, xvid, mpeg, avi, quicktime, flv, etc.). I was wondering if, now that we have a Flash player in svn, if there was some way we could hook that into streaming any sort of video via native conversion to FLV. The featureset in my head:

* Original video is untouched and still available for direct download.
* Flash player would embed/convert/magick the video into a streaming FLV.
* If conversion is necessary, converted version would be cached.

To some degree, I want something like Google Video - all their videos are streamed as Flash, but you have the ability to download the original source (which is an mpeg file). If this is a healthy amount of time, I'd be willing to support development financially.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2006-06-09 16:54

We actually discussed this earlier in this thread.
Conversion short of very small clips would be too cpu/time intensive.
Even Google and YouTube require you to submit your videos for conversion with some taking weeks.
I know for a full length feature film, I usually go from vob->divx->flv with the whole process taking 4-6 hrs. or longer depending on the amount of compression I setup for.

You could however schedule a watch folder for conversion with cron/scheduler although some kind of auto-upload would have to take place.

It is something I've been thinking about though. I recently saw this tool, which looks promising.

-s

 
Morbus Iff

Joined: 2006-06-09
Posts: 6
Posted: Fri, 2006-06-09 17:11

Yeah, processing on my end doesn't really help me out. I need to continue to offer the original format of the video (the "original source") as well as a "viewable online" version. It's easy for me to convert to FLV here using FFMPEG, but uploading into Gallery loses the "original source" entirely, and just isn't ideal for me.

The croning, I guess, would be interesting (though, I'd still have to hunt down the perfect command line for a number of various formats - any tips for that?), but it's still the same problem as doing it locally: the FLV should be a viewable format, but the "real" media should remain downloadable.

Perhaps the FLV streamer needs some sort of logic to associate the streaming version with the original source file. Something like "if $sourcefile exists and $sourcefile.flv exists { show flash player with flv video, but keep everything else the same } else { show $sourcefile as normal }". I'd be willing to settle for something like that. (Though, to be truly useful, I'd still need some sort of automatable conversion, be it through cron, locally, or what have you).