Piwigo / piwigo-videojs

Videojs port for piwigo. Play your videos on your web gallery!
http://piwigo.org/ext/extension_view.php?eid=610
GNU General Public License v3.0
65 stars 46 forks source link

No access to mediainfo or ffmpeg #50

Closed megcat closed 8 years ago

megcat commented 9 years ago

I use piwigo through a hosting company, and since it's shared hosting I apparently don't have access to mediainfo or ffmpeg. I have therefore created my poster images manually as your wiki describes, and I do see the image, but it is squished into a square rather than remaining the full size of the image and movie. Is that on purpose or can I change it? I also had to manually edit the main.inc.php file to create a fake default width and height, since it was erroring out on a divide-by-zero traceback since both width and height are reading incorrectly as 0.

Also, the thumbnails piwigo creates are just a default image of a film reel - is there any way I can manually create those as well, so that I can see what my movies are from the thumbnail rather than having to click on every movie to see what it is?

I'm thinking that this whole plugin isn't going to be worth trying to use without those two pieces of software, but I want to try every angle before giving up!

Thanks!

xbgmsharp commented 9 years ago

As per documentation, MediaInfo and FFmpeg are external program of PWG and of the plugin. You don't need those external tools to play the video. However on the picture page (when playing) the video details are retrieve from the database.

MediaInfo is use to detect the width and height of the video. Did you upload the poster and the video at the same time, then run a sync? If so PWG should have populate the database with the width and height. https://github.com/xbgmsharp/piwigo-videojs/blob/master/include/function_sync2.php#L89

If the width and height are not present in the database, I try to to guess the video size. So it should not divide by 0. Maybe you could help to find a better solution. Where is it erroring out on a divide-by-zero traceback? https://github.com/xbgmsharp/piwigo-videojs/blob/master/main.inc.php#L174

        if ( !isset($width) || !isset($height))
        {
                // If guess was unsuccessful, fallback to default 16/9 resolution 720x480
                // This is the case for ogv video for example.
                $height = 480;
                $width  = round(16 * 480 / 9, 0);
        }

The PWG thumbnails are derivate from the poster. If after uploading the poster and the video, PWG should have populate the database to have all field correct to generate the PWG thumbnails. In the database you need to set the pwg_representative field. https://github.com/xbgmsharp/piwigo-videojs/blob/master/include/function_sync2.php#L165

To sum up follow those step in the documentation. https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#manually-add-video-and-poster PWG should populate the width and height and pwg_representative fields. If not there is a bug somewhere.

Hope this helps.

megcat commented 9 years ago

I found that place in the code where you guess the width and height, but it was still 0 height and width right after, I don't think it was getting into that code block because height and width variables existed, but were 0. I added a new if statement right after that set the width and height if width==0 or height==0 and that stopped the traceback (it was in main.inc.php in template->assign, where ROUND is set.) It now has the correctly sized window for the movie, but the movie is still squished into a square like the poster image.

// add size if none exists
if ( $width == 0 || $height == 0)
{
     // If metadata unavailable, fallback to default iPhone movie res
     $height = 320;
     $width  = 568;
}

I did upload the video and the poster using the manual instructions, and ran a pwg sync, but I may have uploaded the video before the poster, does that matter? I waited to run the sync until both were uploaded. It seems like pwg still did not populate the database with width and height, and is definitely not using the poster image for the thumbnails. The movie itself is squished, but it does play! So it seems like maybe the bug I'm running into is on the pwg side? You think it should be figuring out the width and height to populate the db even though MediaInfo is unavailable? videojs

megcat commented 9 years ago

Figure it out! Well, mostly. I didn't realize there was a difference between piwigo's "virtual" albums and actual albums in the file server "galleries" folder, so after that light bulb went off I re-uploaded everything to the actual folder, and now thumbnails and window size are all working. The movie itself is still squished into the square you see in the image I previously posted, but I assume that's because of the lack of MediaInfo, right?

Thanks.

xbgmsharp commented 9 years ago

You can use virtual album but you need to create the folder pwg_representative in the video folder. I try to make the documentation more clear. MediaInfo is use to read and import metadata information into PWG database. I use MediaInfo because it specify the rotation details from the iPhone video. I previously used GetID3 but it is buggy and does not provide as much information. I will add your check to ensure there is always a default width and height for video.

Regarding your squish video, what is your video resolution? Is it 320x568? I believe you inverse the value, the default full screen size of the iPhone 5 is 320 x 568 px (w x h). Your video seen to be recorded with no rotation so height is bigger.

Also in the next block of code, the video might be resize, depending on your upscale downscale options. https://github.com/xbgmsharp/piwigo-videojs/blob/master/main.inc.php#L192

In the last part, I calculate the ratio to make the template responsive. https://github.com/xbgmsharp/piwigo-videojs/blob/master/main.inc.php#L382 What would the correct ratio according to your video?

You can see the different iPhone screen size on this link. http://www.kylejlarson.com/blog/2015/iphone-6-screen-size-web-design-tips/

xbgmsharp commented 9 years ago

I committed 2 fixed:

Without reading the correct and valid width and height from the metadata, it is hard to guess a correct resolution (w x h) or (h x w) for the ratio.

xbgmsharp commented 9 years ago

One question, does your hosting would allow exiftool command? I am thinking of replacing MediaInfo by Exiftool.

alex3137 commented 9 years ago

I had similar problems (sizing issues, divided by 0 error...) because my mediainfo version was too old (0.58 from Debian stable repo).

I updated mediainfo from backports (v0.70 I think) and now everything is working fine !

xbgmsharp commented 8 years ago

Thanks for the tip. Closing the issue, default size setup on new release v2.8.a