Videos on mobile

61 views
Skip to first unread message

Darby Vicker

unread,
Feb 14, 2021, 2:57:49 PM2/14/21
to Gallery 3 Users
Hello,

First, I'd like to say thanks a ton for the updates.  It was my holiday project to migrate my  gallery  to something new to enable videos to work again since flash is dead.  I was super happy to see the new activity.  I've been using gallery since version 1 and was not looking forward to migrating.  I have 371 albums and over 18,000 pictures and videos.  

I successfully upgraded to 3.1.3 and, in general, everything seems to be working well.  I'm just using this for family pictures and videos.  After recompiling ffmpeg on my web server, I was able to upload a new mp4 video and the thumbs were extracted fine and playback works fine on the desktop in multiple browsers.  But I can't get videos to play on any mobile devices.  Any ideas on this would be appreciated.  I've tried multiple browsers.  I've tried the wind and wind wide themes.  Not sure if this is a theme issue or something else.  

I can start another thread for this but I'm also going to have questions about the best way to replace all the flash videos with and updated format (mp4, webm or whatever).  I have all the original videos and can script something to convert the originals to a new format, but what is going to be the best way to upgrade gallery with the new format?   I can simply replace the flv files in var with the new format.  But am I going to have to do surgery on the database as well?  

Thanks,
Darby

JR

unread,
Feb 14, 2021, 8:19:38 PM2/14/21
to gallery...@googlegroups.com

Darby,

You're on the right track with both questions: the mp4 format is *supposed* to be compatible with all devices. And most of the time it is, except there are always a few companies/device that insist on ignoring such standards and coming up with their own preferred format for video and audio -- this can happen more often on mobile devices. But that's a device specific issue -- nothing to be done about it as far a Gallery 3 goes -- and usually there's a way to configure the mobile device to play .mp4, even thought it might take some digging to find out how to do it.

But as a default for your new 3.1.3 version of Gallery 3 it only makes sense to  go with .mp4 since that is the closest we have to a universal format. The flv format is dead and actually not allowed on many platforms. Same thing with the old .avi and quicktime formats. If you want to give us a link to your site we can test it with our mobile devices.

If it turns out there are a couple of mobile devices that will simply not play .mp4 no matter how configured, I suppose you could create the video in .mp4 and also in one or two other formats (with webm being the most common mobile format) and offer a separate link to each one.

You should not have to do any "surgery" to the database as far as I know. You simply delete the old video file first and then upload the new mp4 version in its place.

-- J.R.

--
WHEN USING AN EMAIL PROGRAM to reply to this message, click REPLY TO LIST or REPLY TO ALL so your reply goes out to everyone in the group. If you click REPLY or REPLY TO SENDER Google will *only* send your reply to the original author (not recommended).
 
To post a NEW MESSAGE to the group, send an new email to:
gallery...@googlegroups.com
 
To view or sign in to this group on the web, use this URL:
https://groups.google.com/forum/#!forum/gallery-3-users
---
You received this message because you are subscribed to the Google Groups "Gallery 3 Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gallery-3-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gallery-3-users/5bec483c-ee6d-4468-af25-d98688ddecdfn%40googlegroups.com.

Darby Vicker

unread,
Feb 15, 2021, 12:59:23 AM2/15/21
to Gallery 3 Users
Yeah, I chose mp4 and webm because it looks like that was the most widely supported across all the browsers, OS's, etc..  Here is a link to my site with a test video in each format.  


Most of the browser and OS combinations I've tried on a regular computer work fine for both formats.  I had my dad test with an android phone (I'm assuming with Chrome but forgot to ask) earlier today and he said it worked for him so that's good.  But iOS seems to be the problem child.  Neither format will play for me on my iPhone XR.  Same for a very recent gen iPad.  A little googling tells me that MP4 should play just fine on iOS.  Perhaps its the specific format I'm using to encode?  Below are the format details as reported by ffprobe.  

Wow, that would be great if all I have to do is replace the flv with an mp4 and everything just worked on the gallery side.  But that doesn't appear to be the case.  I tried that with the video at the link below (IMG_0355).  I just get a blank video and a download link.  I think because its still expecting the flv?  



Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0081.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:42.82, start: 0.000000, bitrate: 2353 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x540, 2216 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]

JR

unread,
Feb 15, 2021, 4:02:31 AM2/15/21
to gallery...@googlegroups.com

Darby,

I just looked at the testing videos on your site and *both* the .mp4 and the .webm played perfectly on my LG smartphone using the Firefox, Chrome and Duck-Duck-Go browsers running on the Android 7.0 operating system (which is several years old now). It does not surprise me that iOS seems to be giving problems. Not to get Apple fans down on me, but it seems whenever a format compatibility problem crops up, the iOS is right there at the forefront presenting headaches..

But there does not seem to be anything wrong with your setup or configuration, since your site's videos work just fine on my Windows desktop machines, my Linux laptops and and my LG smartphone tested with 3 different browsers.

I may not have been clear about "replacing" the old .flv file with a .mp4 file. You must do this through the Gallery3 user interface -- first, deleting the .flc file from the album and only then using the Gallery built-in upload tool to put the .mp4 file in its place. That way the database ends up with an .mp4 file specification in the correct places in the database table.

Darby Vicker

unread,
Feb 15, 2021, 11:49:25 AM2/15/21
to Gallery 3 Users
J.R., thanks a lot for the testing - very helpful.  Yeah, I get frustrated with Apple not playing well with others too.  I'll see if I can mess around with some ffmpeg settings for converting the videos into a format that works well with iOS.  

So that's what I meant about surgery on the database.  I have 1800 videos and manually deleting them and re-adding them via the interface isn't a good option.  Once I replace the flv's in var/albums, I think I can just dump the SQL database, replace all occurrences of 'flv' with 'mp4' and restore the database.  There are probably some SQL commands to achieve the same thing.  But if there are tools or modules out there for doing something like this to a gallery, I'd be all ears.  

Any suggestions for a theme that looks good on desktop and mobile?  The wind themes tend to overlay a bunch of stuff over the picture and/or video on the phones I've tested.  

Brad Dutton

unread,
Feb 15, 2021, 1:23:01 PM2/15/21
to Gallery 3 Users
I wrote a bit of a hack several years ago to create "resized" mp4 video files regardless of original video type. These mp4 files should playback natively in all modern browsers. There are  2 parts to the changes, the first is a module (movie_resized, it's bundled in gallery 3.1.x) to playback the "resized" mp4 video:
The second part is the perl script (I should at least rewrite this into PHP...) that creates resized mp4 files (also bundled):
If you use this at minimum you should set $CHOWN_USER = 'yourwebuser:yourwebgroup' so the file permissions of the gallery files match the rest of the gallery.

Additionally the resized videos can made smaller for better streaming (adjust the bitrate to your preference). The native playback allows proper aspect ratio playback, e.g. portrait videos will display as such. I always cringed when I saw my wife's iPhone portrait videos squeezed into landscape.

Here is an example:

Darby Vicker

unread,
Feb 15, 2021, 3:40:25 PM2/15/21
to gallery...@googlegroups.com
Thanks Brad.  I'll check it out.  

If anyone has ffmpeg options for converting a video known to work with iOS, please let me know.  

You received this message because you are subscribed to a topic in the Google Groups "Gallery 3 Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gallery-3-users/uQNASDSy7GI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gallery-3-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gallery-3-users/20b18429-222d-43f6-a9d0-b877be8fd485n%40googlegroups.com.

Brad Dutton

unread,
Feb 15, 2021, 4:31:15 PM2/15/21
to Gallery 3 Users

JR

unread,
Feb 15, 2021, 6:00:58 PM2/15/21
to gallery...@googlegroups.com

Darby,

I had a similar problem and yes, using the Gallery 3 user interface to manually delete thousands of .flv files and then to manually upload the all the .mp4 and .webm replacements is a daunting prospect indeed. But so is doing the kind of surgery in the database you are talking about. There are about 26 tables in the database and they are intimately inter-connected. I have done some manual work in there along the lines you're talking about and unless you are an sql-query slinging wizard, doing mass-changes to all the different necessary fields in the many different tables is also a very daunting and time-consuming prospect -- with the added danger that if you miss one little inter-connection or make a mistake changing something that your entire gallery installation could stop working.

So, of course you have to do complete backups first and may well find at some point in the surgery that the patient dies and you have to resurrect it and start over again from scratch. The biggest challenge is: I do not know of anyplace where all the inter-connections between the different fields and tables are documented. You're going in without a map. To that end I would make one important suggestion:

Create a very short video clip in .mp4 format and give it a very short, unique name -- a name easy to pull-up in a query search that will not return any other result - like zzz1.mp4 -- Then create a completely new top-level album and use the Gallery interface to upload that clip nothing else to that new album. You have just created all the new entries in the various database tables for zzz1.mp4 . Then, after backing up the database in at least two separate places, you can go into it and start doing sql-queries on *just* zzz1.mp4. This will allow you to identify where all the entries relating to just that one clip are and how they inter-connect. Essentially you have created a map that can now be used on a larger scale to modify every place in the database where you will have to modify those thousands of .flv files.

At least then you'll know what has to be modified -- and the extra benefit is that you will now know (perhaps) the type of sql-queries you will need to write which could (maybe) quickly modify those thousands of entries in one or two passes.

Maybe there are some sql-query wizard out there who can give a few pointers?

-- J.R.

Darby Vicker

unread,
Feb 16, 2021, 1:24:18 AM2/16/21
to Gallery 3 Users
Brad - thanks for the pointer to the ffmpeg flags. 

I was curious to know if the gallery code was somehow getting in the way of the mp4 video playback on iOS.  When gallery first shut down, I played around with writing a super basic gallery replacement.  I didn't get very far with that but did mock up some pages that allowed me to play around with htrm5 <video> and try some of the video formats (mp4, webm, ogg, etc.).  I recall the videos playing well on all the platforms I tested back then, including on iOS.  So I did a quick test of that again, using the exact same test videos I setup in gallery.  


That page is basically a dead simple, hand-written html file that displays the video via an html5 <video> tag.  This works great, including on iOS - video playback starts right away.  So I do think there is something about the gallery-generated page that iOS is not happy about.  In fact, after seeing the above work, I went back to the gallery page and messed with those test videos more and if I tap on the video enough times (3 or 4), I can indeed get the video to play on iOS.  So this is really more about the php/htrml than it is the video format.  If I get a chance, I'll see if other themes work better with iOS or if maybe some of the modules I'm using are contributing to this.  At this point, just knowing it will play on pretty much all platforms is nice to know, even if iOS is being a pain.  

I really can't stomach the idea of manually deleting and uploading 1800 videos.  I just took a look at one of my latest gallery SQL dumps and I see what you mean.  Quite complicated.  I will probably try a simple substitute of all .flv to .mp4 and see what happens.  If it outright breaks something, I'll restore and will be forced to do something more elegant.  But any has better ideas, I'm all ears.  

Brad Dutton

unread,
Feb 16, 2021, 2:41:21 AM2/16/21
to Gallery 3 Users
As I never use the existing video playback mechanism I didn't realize it uses flash still!

I guess we should replace that with the html5 video tag? Videos that aren't in the proper format won't play back, but on the other hand flash doesn't work any more. Does anyone have any recommendations on another video playback plugin or should we swap in the html5 tag?

Thanks,
Brad

JR

unread,
Feb 16, 2021, 3:03:40 AM2/16/21
to gallery...@googlegroups.com

Brad,

Yikes. This is a good catch and I'm guessing the reason it never popped up on the radar before is because a lot of users don't use Gallery3 for videos. I would recommend using the html5 tag for now, which I believe will work fine with .mp4 and .webm files, and we see how that works while looking for a better option. Got to get Flash off the pages.

-- J.R.

Darby Vicker

unread,
Feb 16, 2021, 11:13:48 AM2/16/21
to Gallery 3 Users
The <video> tag is used just above the line you posted Brad.  So I guess this is using a combination of html5 <video> and flash.  I agree, getting rid of flash part for now is the biggest thing.  

Darby Vicker

unread,
Feb 17, 2021, 12:31:28 AM2/17/21
to Gallery 3 Users
I just did a little experiment on my gallery installation.  I'm not a web developer (but do code) but it looks to me like the <video> section in movieplayer.html.php (lines 2-7) is sufficient.  So I just removed that entire <script> section (lines 7-18).  This seems to work great.  I tested multiple browsers on my desktop and both Chrome and Safari on my iPhone.  iOS playback works much better now.  Obviously, I"ll defer to you guys for the right solution here but it may be that easy.  

JR

unread,
Feb 18, 2021, 2:22:45 AM2/18/21
to gallery...@googlegroups.com

Darby,

How cool is that? As an immediate solution you can't get any closer, at least for now. As a simple user-implemented DIY patch for those putting videos on their gallery site who are already running 3.1.3 it seems to do the job and get rid of the Flash. And I would hope it could be easily added to the existing 3.1.3 download package so there would be no pressing need to release a version 3.1.4 at this point.

-- J.R.

Reply all
Reply to author
Forward
0 new messages