[Solved] Play video without ffmpeg in Gallery 3

maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Fri, 2010-09-10 13:32

Edited message: now it is a sort o little tutorial :-)

Is it possible to play standard compliant flv or mp4 video files without ffmpeg in G3, but it can be a bit tricky... Here it is how it is:

1) Video must be standard compliant.
2) Video size often beyond host's upload limit.
3)
Hacking Gallery UPDATE: New module to allow upload.
4) Manual metadata input.

1) Video must be standard compliant

A video should always be standard compliant, but without ffmpeg it MUST be standard compliant. The two allowed format are the pour quality .FLV and the high quality .MP4.
The MP4 must be encoded in this way:
Video: H264 family codec (you'll probably use x264) with width and height multiple of 8 pixel.
Audio: 44100 Hz with the AAC codec.
You can use the open source Avidemux to do it ( http://avidemux.sourceforge.net/ )
Then you have to move the header info at the beginning of the file:
You can use this little free software, "Mp4 FastStart", http://www.datagoround.com/lab/index.html

Note: if your movie plays only the video or only the audio or completely blank it is probably not standard compliant.

2) Video size often beyond host's upload limit

In most cases you can be quite sure that your video size is far beyond the upload limit set by your host, so you won't be able to use the usual upload system, via browser.
No problem, just activate, configurate, and use the Server Add module for your videos.
This module comes with standard Gallery, but is not active by default.
http://codex.gallery2.org/Gallery3:Modules:serveradd

3) Hacking Gallery to allow upload
3) Update: new module to allow upload

At the moment Gallery behaves this way when you tray to upload a video:
If ffmpeg is installed Gallery uses it to get metadata of the video.
If ffmpeg is not installed Gallery refuses the video.

We have to change the second sentence with:
If ffmpeg is not installed Gallery gets the video and saves some fake metadata.
There's a new module to achieve it:
http://codex.gallery2.org/Gallery3:Modules:noffmpeg

4) Manual metadata input
As said above, we have given the file some fake metadata, because Gallery cannot get the real ones without ffmpeg. We must now input manually the right metadata concerning video size...
Install the module VideoDimension
http://codex.gallery2.org/Gallery3:Modules:videodimensions
Then edit each video and fill the width and height fields with the right dimensions in pixel.

Note: Among the missing metadata there's also the thumbnail... You will get nothing but a default movie icon. This problem will be solved when someone creates the “Custom Thumbnail Module” like the one for Gallery 2, there's no solution at the moment.

------------------------------------------
My Gallery sites:
http://www.zorring.org/
http://tracks.vagabondo.net/

 
rlparadise

Joined: 2009-12-27
Posts: 65
Posted: Fri, 2010-09-10 16:11

Some clarification, ffmpeg is not used to play videos at all in G3. It is only used to automatically generate thumbnails and read the metadata in the file to pull out width and height. After the video file is uploaded, it is no longer used.

With a test mp4 file, it should take little time to figure out your problem. Since this is a public video, it rules out any possible issues with the file proxy. Can you confirm a couple of things:

- Does the mp4 movie play on your home computer?

- If an mp4 file has its metadata at the end of the file (somewhat common) it will not stream in Flowplayer. Read this comment for more details on how to fix an mp4 to move the metadata to the front: http://gallery.menalto.com/node/97138#comment-350312. That said, your file does not appear to play at all in G3 (even after ample time to download the whole file).

- I haven't used G2 in years but it does use a different Flash Player. I assume you also tried adding the flv file from the G2 install to G3 and see if it would play? G3 supports mp4, flv and m4v extensions.

- Are you using RC2 (released a few months ago) or git/LATEST (the most recent code)?

 
maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Fri, 2010-09-10 16:47

Hi rlparadise, thank you for your answer.

Yes, the mp4 plays in my pc perfectly, as it plays in G2.
It has metadata moved at the beginning with "mp4 fast-start".
It should be really standard compliant: x264 video, 44100Hz Aac audio.

I'm using latest G3 from git.

The test-movie-file can be downloaded here:
http://g3.zorring.org/var/albums/some-movies/In-the-forest.mp4
Here it plays in G2:
http://www.zorring.org/Lussino-Croazia/In-the-forest.flv.html
(note that in G2 it has .flv extension, because G2 doesn't recognise .mp4 extension, but it is not a FLV, it is exactly the same mp4 :-) )

Bye

 
rlparadise

Joined: 2009-12-27
Posts: 65
Posted: Fri, 2010-09-10 17:30

Thanks for the information. I'll look at it tonight. It sounds like you know all about mp4 video. As you may know Adobe Flash can be picky about the type of MP4 files it will play. However, your rename trick (for the flv file) confirms that the mp4 should work fine.

Cannot think of anything else other than what I've told others in the past. You can always download/install Flowplayer into a temp directory on your server. Then reference the URL above and confirm that it plays. It's always possible (although unlikely) that the mp4 got corrupted during transfer somehow. If it won't play in the temp directory, you can troubleshoot it. If it does play in your temp directory, then obviously the embed code in g3 needs to be looked at. You can configure the movie player parameters in G3 at:

modules/gallery/views/movieplayer.html.php

If you plan to do anything with video on your site, I recommend considering adding floridaves fix:

http://sourceforge.net/apps/trac/gallery/ticket/1154

This mod prevents your video from stretching to fill the screen and instead scales the video based on its aspect ratio.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 6136
Posted: Fri, 2010-09-10 17:51
 
maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Fri, 2010-09-10 21:59

Thank you everybody,

It seams that the reason was really what rlparadise said: It's always possible (although unlikely) that the mp4 got corrupted during transfer somehow..
Because now it works... And I haven't done nothing particular.

On Monday I'll edit this message so that it can be a sort of tutorial for people without ffmpeg.

Bye

 
Shemo725

Joined: 2008-04-18
Posts: 404
Posted: Fri, 2010-09-10 23:19
maravizzo wrote:

On Monday I'll edit this message so that it can be a sort of tutorial for people without ffmpeg.

Bye

this would be wonderful. unfortunately my web host doesn't support ffmpeg because it's a shared hosting and having to manually add my own thumbnail is quite annoying.

 
maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Mon, 2010-09-13 08:12

Hi Shemo,

Here it is the tutorial, but concerning thumbnails there's nothing you can do, as said above:

Gallery cannot get the real metadata without ffmpeg. Among the missing metadata there's also the thumbnail... You will get nothing but a default movie icon. This problem will be solved when someone creates the “Custom Thumbnail Module” for Gallery 3 like the one for Gallery 2, there's no solution at the moment.

 
maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Mon, 2010-09-13 10:35

For rlparadise and suprsidr

I've discovered that the problem of playing movie is browser-dependant!
(so it belongs the way gallery implements the palyer)
Try this clip: http://g3.zorring.org/some-movies/Battle-01
It works perfectly with Chrome or Explorer but it keeps waiting forever with Firefox!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 6136
Posted: Mon, 2010-09-13 12:15

It looks like the flowplayer script is not implementing the <embed> version and only using <object>
I thought mozilla required <embed>
I'd ask over @ flowplayer forums.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
agarg
agarg's picture

Joined: 2007-11-16
Posts: 64
Posted: Tue, 2010-11-09 03:28

Is it better to wait for the next G3 version instead of this hack? Any chance it might break something else?

Anil Garg
My Picture Gallery

 
maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Tue, 2010-11-09 10:11

Now rWatcher has written a module that insert those lines of code... So you don't need to hack it any more at step 3, just install the module. Don't worry anyway, it doesn't break anything :-)
I'm editing the first post with the link of this module.

------------------------------------------
My Gallery sites:
http://www.zorring.org/

 
jalescanor

Joined: 2010-11-23
Posts: 2
Posted: Tue, 2010-11-23 22:24

I have a problem, I tried to install ffmpeg, to no avail.
After that I installed the no-ffmpeg module to the gallery. It's just copying the files to the 'modules' dir right?
And then activated it. It says its activated but everytime y try to upload a video it will do like if its uploading it,
but it wont appear in the gallery. Also it's not on the folder.

Gallery 3
PHP 5.3.3

Anyone can think of something?

 
jalescanor

Joined: 2010-11-23
Posts: 2
Posted: Tue, 2010-11-23 22:29

Also forgot to say. ffmpeg module does NOT appear on my module list. Does it matter?

 
maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Thu, 2010-11-25 14:34
jalescanor wrote:
but everytime y try to upload a video it will do like if its uploading it, but it wont appear in the gallery. Also it's not on the folder.

maybe it is about upload limit, see point 2 on top the page.

jalescanor wrote:
Also forgot to say. ffmpeg module does NOT appear on my module list. Does it matter?

no-ffmpeg is module, while ffmpeg is not!
ffmpeg is a software and need to be installed in the right location in your server (and often a usual ftp user is not allowed to have access there)

------------------------------------------
My Gallery sites:
http://www.zorring.org/
http://tracks.vagabondo.net/

 
bryan145

Joined: 2010-10-24
Posts: 81
Posted: Sat, 2010-11-27 22:46

I have a video that's 21.5 MB in size, which rendered the built-in uploader useless (although I got it to upload an mp4 file). The problem is, when I use server add to pull large files from the directory I specified, it keeps saying no pictures found. I verified that the 21.5 MB mp4 file is indeed on the server. Am I doing something wrong?