[Experimental] Module for uploading unsupported videos

rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2010-09-24 01:42

This module, "videos" will allow users to store unsupported video formats (avi, mpg, etc) in Gallery 3.

As these types of files are unsupported by the core gallery code, I can't guarantee that a change in Gallery won't completely break it, so use at your own risk.

This installs just like any other module -- upload the "videos" folder to you modules directory, then activate the module from the web interface.

This module contains a modified version of Gallery's "Server add" module, that allows for adding video files to an album (so you basically ftp the file to the server, then log in as an admin to add it to an album via the Add -> Add videos menu). If you've never used the server add module, you can read about it here. Users will then see a "Click here to download video" link instead of the normal flash player when viewing these videos (as Gallery's flash video player can't handle these formats).

This has been tested against Gallery 3 RC2 Git as of commit 1a0d76c43e3545771ae3, and may/may not work with anything earlier then that. Also, this has only been tested in conjunction with the NoFFMPEG module (which is probably required if your web server doesn't have FFMPEG installed). I have no idea how it'll work on web servers that actually have FFMPEG, as I can't test this.

---
Report Problems/Suggestions Here | Get latest version | Documentation | Coffee Fund | My Library | My GitHub

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2010-09-24 04:37

COOOLeeOh!

Quote:
I have no idea how it'll work on web servers that actually have FFMPEG, as I can't test this.

Works just fine and ffmpeg even generates a thumb :-) Tested with a AVI file.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2010-09-26 23:30

And thanks for doing the docs as well:
http://codex.gallery2.org/Gallery3:Modules:videos
It was on my things to do list, but not no more :-)

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-09-29 19:30

I've just posted an updated version of this module (see first post, or my github to download).

In this version I've finished coding support for a .flv "resized" version of the video. In the event that an appropriately named .flv file is found in Gallery's var/resizes folder, Gallery will load the resize in flowplayer instead of displaying the download link (the original video can still be downloaded via the DownloadFullsize module: http://codex.gallery2.org/Gallery3:Modules:downloadfullsize).

The flash video must be encoded by the user, and then manually uploaded to the server -- there's no support for server-side encoding. The .flv video can be uploaded along with the original video, in which case the modified server add will automatically find and copy it to the resizes folder. The .flv file can also be uploaded directly to the resizes folder later.

In order for Gallery to locate the .flv video, it's file name must be originalname.extension.flv. So for example, if your video is "testvideo.avi", the flash video would be "testvideo.avi.flv".

Also, the list of "accepted" file extensions is controlled by a module variable, which can be edited from the Settings -> Advanced screen (it's the "videos" / "allowed_extensions" value).

 
daveman

Joined: 2009-10-09
Posts: 25
Posted: Thu, 2010-10-07 18:19

Is there a way to have and avi or other unsupported video file converted to an flv file on the fly so that a user can then strem the video rather than download it?

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2010-10-07 20:06
daveman wrote:
Is there a way to have and avi or other unsupported video file converted to an flv file on the fly so that a user can then strem the video rather than download it?

Not with this module, you'd have to manually encode and upload the flv file along with the avi to allow a user to stream the video.

 
gearyg

Joined: 2004-12-19
Posts: 17
Posted: Wed, 2010-11-03 18:41

https://github.com/gallery/gallery3-contrib/tree/master/modules/videos/

This link seems dead at the moment - is this videos thing for an old version, or just link death?
The noffmpeg link is also deat at github

Thanks in advance - sounds like just the kind of module I need for full 3.0. I don't have ffmpeg on the system but want to upload videos.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2010-11-03 18:56

www.gallerymodules.com

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-11-03 20:21

The links changed when they re-structured gallery3-contrib for 3.0/3.1. The new link would be:
https://github.com/gallery/gallery3-contrib/tree/master/3.0/modules/videos/

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2011-04-22 04:35

Minor Update -- I've implemented Ticket #1154 ( http://sourceforge.net/apps/trac/gallery/ticket/1154 ), which is a fix for playing video's at the correct aspect ratio when flowplayer is in fullscreen mode. Otherwise nothing has changed.

 
exDfg

Joined: 2009-06-09
Posts: 39
Posted: Wed, 2010-11-17 01:56

Hello rWatcher,

First, congratulations on such an useful module.
There is just one problem. If your albums are private, the thumbnails get broken.
This used to happen on older versions of G3 with FLV as you can see here: http://gallery.menalto.com/node/89076
I wasnt able to find how it was fixed, but I am quite sure it would be the same fix since if you change the relative_path on the DB directly, it works perfectly.

I hope you can fix this.

Thank you

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-11-17 19:48
exDfg wrote:
Hello rWatcher,

First, congratulations on such an useful module.
There is just one problem. If your albums are private, the thumbnails get broken.
This used to happen on older versions of G3 with FLV as you can see here: http://gallery.menalto.com/node/89076
I wasnt able to find how it was fixed, but I am quite sure it would be the same fix since if you change the relative_path on the DB directly, it works perfectly.

I hope you can fix this.

Thank you

Thanks for the link, that actually explains everything :)

According to the link, the bug was fixed in this commit:
http://github.com/gallery/gallery3/commit/f83db99d39cc65b212f894c7e4ed66a52625f3c8

That commit pushes a fix out to the modules/gallery/controllers/file_proxy.php to look for .jpg thumbs for videos. I've attached a modified version of that file which should extend the fix for videos with file extensions supported by this module. Just rename the attached file to file_proxy.php and copy it into your modules/gallery/controllers folder and everything should work.

 
exDfg

Joined: 2009-06-09
Posts: 39
Posted: Wed, 2010-11-17 09:37

Thank you so much.

I wasnt able to find how they fixed it.
Maybe the gallery devs could include this fix in the core if you ask them, right?

Have a nice day and once more thanks for all the amazing work.

 
exDfg

Joined: 2009-06-09
Posts: 39
Posted: Wed, 2010-11-17 10:29

Hello,

Sorry to bother again but if you use a FLV file as a resize, the stream doesnt work and I am guessing that it is for the same logic (file_proxy breaks it).
What would be the lines to be changed on file_proxy?

Thank you so much again.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-11-17 19:49

Thats more complicated...

This should fix it. Let me know if you find any other issues.

 
exDfg

Joined: 2009-06-09
Posts: 39
Posted: Wed, 2010-11-17 21:59

Hello rWatcher,

It was perfectly fixed.
This module is just perfect, it allows you to have the FLV video streamed as gallery normally does but it also allows you to provide a link for your users or just as backup for yourself of the original video.

Thank you so much for taking the time to build the module and improve it to work on private albums as well.

I hope gallery devs can include by default these changes on the core.

 
waynemcdougall

Joined: 2010-12-30
Posts: 1
Posted: Fri, 2010-12-31 09:23

I'm having trouble with this module. I'm running Version: 3.0.x branch (git) - the one linked from the main website without the Deleting album bug.

My symptom are that everything works perfectly except the file isn't copied into the folder. If I choose just one video, I get "Successfully added one file" but nothing appears. If I copy the whole directory structure, I get the folders but no files. I can Server Add pictures from these same folders.

If I look in the Albums, there are no video files, so it's not copying them, and then Gallery3 not displaying them. I've tried file names like test.mov and test.mpg and test.MOV and that doesn't work, so it's not a problem with the file name. Nothing comes up in either the Gallery3 log or the Apache2 logs.

I do have ffmpeg available on the server (which is running on Linux Ubuntu with all the latest updates for the Hardy desktop edition). I'm happy to carry out any tests. I'm stumped.

ADDENDUM: I've found that if I add FLV to the list of acceptable video types, then this module will add them. So I suspect the latest version of Gallery 3.0 has extra validation in the Movie saving section that silently drops unexpected extensions.

 
macin

Joined: 2011-01-25
Posts: 7
Posted: Tue, 2011-01-25 13:05

Same problem here... Any ideas?

 
sterlingII

Joined: 2010-01-23
Posts: 6
Posted: Sat, 2011-02-26 15:43

I too have this same issue attempting to load .wmv files. The video add sees the files but they do not load. Gallery 3.1. The "view log" says: Skipping invalid file: /home/content/c/m/m/cmmtc/html/gallery2/g2data/albums/foo/Harry Russell Sage.wmv
Adding photos / albums (1 of 1)

 
yozik

Joined: 2011-02-27
Posts: 3
Posted: Sun, 2011-02-27 05:46

I believe it's because modules/gallery/models/item.php is checking extension and mime type

I added avi extension and mime type and was able to upload an avi file, only thing is there was no thumbnail created nor a way to view the file

I'm looking into how to get at lest a thumbnail generated

EDIT:
nm seems like the missing thumbnails was a browser caching issue

--
Yozik

 
danneh3826
danneh3826's picture

Joined: 2007-08-18
Posts: 290
Posted: Sun, 2011-02-27 16:58

the only way to get around the extension checking at the minute is to extend the item model and override the validation function, basically taking this check back out. it's claimed to be a security feature, but i think it's hardcodedness is more of a flaw/bad design than a fix. i did suggest in a comment to the 3.0.1 launch post on the front page of this site about ways to resolve this, by adding some kind of api that modules can hook into allowing various other extensions to be uploaded. but i've not had any response to it, which basically leaves module developers the only option but to "remove" this "security" fix.

Dan

danneh.org :: Gallery3

 
cmisip

Joined: 2011-02-20
Posts: 22
Posted: Tue, 2011-03-01 22:31

This is a helpful bit of information. I removed the check from item.php and added m2ts extension to the videos module and now I can upload unsupported .m2ts videos into gallery 3.

I am going to try to do the same for server_add module. Hopefully, then I wouldn't have to rename my input files to .flv or .mp4

Thanks
Chris

 
RogueTrooper

Joined: 2008-03-20
Posts: 34
Posted: Fri, 2011-03-18 00:07

I'm having this same problem, could someone post a corrected item.php or point me where to fix it? And are the mime types just added in the Maintenance/Advanced area?

Thanks a bunch!

-RT

 
RogueTrooper

Joined: 2008-03-20
Posts: 34
Posted: Fri, 2011-03-18 23:37

Mimetypes as in Apache mimetypes, right? Added those, but I still need the item.php fixes...

Anyone?

-RT

 
yozik

Joined: 2011-02-27
Posts: 3
Posted: Sat, 2011-03-19 00:42

here's what I have in item.php

somewhere around line 790

if ($this->is_movie() && !preg_match("/^(flv|mp4|m4v|avi|mpg|mpeg|mov|wmv|asf|mts)$/i", $ext)) {

somewhere around line 880

case "mime_type":
if ($this->is_movie()) {
$legal_values = array("video/flv", "video/x-flv", "video/mp4", "video/avi", "video/msvideo", "video/x-msvideo", "video
/mpeg", "video/quicktime", "video/x-ms-wmv", "application/octet-stream", "video/x-ms-asf" );

 
RogueTrooper

Joined: 2008-03-20
Posts: 34
Posted: Sat, 2011-03-19 17:42

Awesome!

That's what I was looking for!

I then had to change the Settings/Advanced/Video to the following

a:8:{i:0;s:3:"avi";i:1;s:3:"mpg";i:2;s:4:"mpeg";i:3;s:3:"mov";i:4;s:3:"wmv";i:5;s:3:"asf";i:6;s:3:"mts";i:7;s:3:"mp4";}

Then I'm able to read to folder and add videos with no problem!

Thanks a bunch for the help!!

-RT

 
yozik

Joined: 2011-02-27
Posts: 3
Posted: Sat, 2011-03-19 17:57

oh yeh you need to change there too ;-)

np

 
monacoblue

Joined: 2011-04-17
Posts: 1
Posted: Mon, 2011-04-18 11:02

Thanks for a great module.

But when using Gallery 3.01 upload is successful but I get no thumbs (nothing is displayed, so file is not accessible). When going back to 3.0 everything works perfectly, but 3.0 cannot use latest themes.

Any fix would be greatly appreciated :)

Best M.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2011-04-22 04:36

This is a complete re-write of the videos module, which should work perfectly with Gallery 3.0.1. Please report any issues here.

 
flightman

Joined: 2011-05-30
Posts: 2
Posted: Tue, 2011-05-31 14:36

Hello,

yesterday, I tried the above mentioned version of the videos module for Gallery 3.0.1 since I had had some problems with another version downloaded from somewhere else before. However, the problems remain also with this version: completely blank screen of my gallery when the module is present (i.e. the directory and all of its content is uploaded in .../modules/). Does anybody have any idea how to find out what is wrong?

fli.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Tue, 2011-05-31 15:30

Is there anything in Gallery's var/logs folder?

 
flightman

Joined: 2011-05-30
Posts: 2
Posted: Sat, 2011-06-04 10:48

Unfortunately, there are no records.

On the page with gallery I only see "Videos needs configuration. Configure it now!". Rest of page is empty. The code of the page looks like:
<head>
## a head is defined here ...
</head>
<body >
<div id="doc3" class="yui-t7 g-view">
<ul id="g-site-status"><li class="g-warning">Videos needs configuration. <a href="/gallery3/index.php/admin/videos">Configure it now!</a></li></ul> <div id="g-header" class="ui-helper-clearfix">
<a id="g-logo" class="g-left" href="

 
wicked271

Joined: 2011-06-23
Posts: 5
Posted: Thu, 2011-06-23 07:27

Hi, does this module still work? I just tried to install it and it shows only the logo and there's an alert on top of it that says "Videos needs configuration. Configure it now!". That's it. Tne rest of the page is blank. Even when I click on the "configure it now" link, nothing happens. I deleted the whole videos folder but the alert is still on top of the page.

Using Gallery 3.0.1 and used the video module rWatcher posted above (Posted: Fri, 2011-04-22 12:36 ). Also tried the download from this site: http://www.gallerymodules.com/

Would really appreciate any help. Would like to use Gallery not only for my photos but also for my videos.

Thanks!

 
nmns

Joined: 2011-06-27
Posts: 1
Posted: Mon, 2011-06-27 01:51

same problem here~

help me~~

 
inpulse
inpulse's picture

Joined: 2009-08-02
Posts: 38
Posted: Mon, 2011-08-29 21:32

What can be done about the thumbnail not showing up? I am able to upload using serveradd, but it appears as the movie clapboard. How do I upload a thumbnail, even if it's just a jpg to replace it?

 
klinion

Joined: 2009-02-26
Posts: 180
Posted: Tue, 2011-10-04 18:21

Great module, thanks. Is it possible please, to allow all registered users to upload and not just admin. I've looked a lot in the code but unable to identify any code that can be changed,
Thanks,
Ken

www.talkingwalk.com/gallerywalk

 
klinion

Joined: 2009-02-26
Posts: 180
Posted: Tue, 2011-10-04 18:20

Moved question

 
bhuffman

Joined: 2012-03-18
Posts: 2
Posted: Sun, 2013-01-20 21:46

I am trying to use this with 3.0.3 and can't add files. I've activated the module, added a path, and when go to "Add videos" and the window comes up to select the movies, they don't show up. I just see "empty" Any suggestions?
Thanks,
Brian

 
shadlaws

Joined: 2012-03-14
Posts: 183
Posted: Fri, 2013-02-22 23:03

UPDATE: recent upgrades to Gallery have made this module obsolete. If you're currently using it, we recommend that you deactivate it. For more information, please see the documentation page at http://codex.galleryproject.org/Gallery3:User_guide:Obsolete_modules.