Adding portrait video support to 7.2.x

No one takes the time to turn their phone 90 degrees before taking a video anymore. When they try to upload the portrait video to 7.2.x it fails every time.

 

Tested with portrait videos shot and uploaded directly from: iPhone 6S, Galaxy Note5, and Galaxy S6; with stock and custom ffmpeg.

 

Quick fix to add portrait - 9:16 aspect ratio support.


1. Add Video Size Option 360x640

 

Edit: /flash/modules/video/inc/constants.inc.php

 

find: (around line 16)

 

if(!defined("VIDEO_SIZE_16_9")) define("VIDEO_SIZE_16_9", "640x360");

 

Just below add:

 

if(!defined("VIDEO_SIZE_9_16")) define("VIDEO_SIZE_9_16", "360x640");

 


2. Video Aspect Ratio Detection

 

Edit: /flash/modules/video/inc/functions.inc.php

 

Find: (around line 194)

 

    if(convertVideoFile($sFile, $sTmpl)) {
        $aSize = getimagesize($sFile);
        @unlink($sFile);
        $iRelation = $aSize[0]/$aSize[1];
        $i169Dif = abs($iRelation - 16/9);
        $i43Dif = abs($iRelation - 4/3);

        if($i169Dif > $i43Dif) return VIDEO_SIZE_4_3;
        else return VIDEO_SIZE_16_9;


Change it to:

 

    if(convertVideoFile($sFile, $sTmpl)) {
        $aSize = getimagesize($sFile);
        @unlink($sFile);
        $iRelation = $aSize[0]/$aSize[1];
        $i169Dif = abs($iRelation - 16/9);
        $i916Dif = abs($iRelation - 9/16);
        $i43Dif = abs($iRelation - 4/3);

        if($i43Dif > $i916Dif) return VIDEO_SIZE_9_16;
        else if($i169Dif > $i43Dif) return VIDEO_SIZE_4_3;
        else return VIDEO_SIZE_16_9;

 

3. Add Portrait Thumbnail Support For Videos

 

Find: (around line 318)

 

        if (isset($a['square']) && $a['square'] && isset($a['w']) && $a['w'])
            $sResize = "-vf crop=out_w=in_h -s {$a['w']}x{$a['w']}";

 

Just below add:

 

        if (isset($a['h']) > $a['w'] && isset($a['w']) && $a['w'])
            $sResize = "-vf crop=out_h=in_w -s {$a['w']}x{$a['w']}";

 


Quote · 23 Dec 2015

 

No one takes the time to turn their phone 90 degrees before taking a video anymore.

It is because the majority of people using these devices are idiots.  I wonder how many of them have gone to the theatre and watched vertical films or have televisions that are taller than they are wide.

Geeks, making the world a better place
Quote · 4 Jan 2016

Thank you for the fix, it was incorporated with some slight changes:

https://github.com/boonex/dolphin.pro/issues/220

Rules → http://www.boonex.com/terms
Quote · 21 Jan 2016
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.