Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231575

Change subject: Add support for h265 format
......................................................................

Add support for h265 format

This add support for h265 format that uses less data to play the video.

This support 8k too. (Added in seperate patch).

Change-Id: I1730cd1e7a85d2285fe1ef1a1799ed5137963834
---
M MwEmbedModules/EmbedPlayer/EmbedPlayer.config.php
M MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
M MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
M TimedMediaHandler.php
M WebVideoTranscode/WebVideoTranscode.php
M i18n/en.json
M i18n/qqq.json
7 files changed, 113 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/75/231575/1

diff --git a/MwEmbedModules/EmbedPlayer/EmbedPlayer.config.php 
b/MwEmbedModules/EmbedPlayer/EmbedPlayer.config.php
index 324a41e..c5ad0c6 100644
--- a/MwEmbedModules/EmbedPlayer/EmbedPlayer.config.php
+++ b/MwEmbedModules/EmbedPlayer/EmbedPlayer.config.php
@@ -10,7 +10,7 @@
 
                        // The preferred media codec preference
                        // Note user selected format order
-                       'EmbedPlayer.CodecPreference' => array( 'vp9', 'webm', 
'h264', 'ogg' ),
+                       'EmbedPlayer.CodecPreference' => array( 'vp9', 'webm', 
'h265', 'h264', 'ogg' ),
 
                        // If video tag support should be disabled 
all-together, used to test
                        // fallback decoding methods and direct file links
diff --git a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js 
b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
index 1369f10..c9b35b2 100644
--- a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
+++ b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
@@ -48,6 +48,10 @@
        'video/h264',
        'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
 ], 'Native' );
+var h265NativePlayer = new mw.MediaPlayer( 'h265Native', [
+       'video/h265',
+       'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
+], 'Native' );
 var appleVdnPlayer = new mw.MediaPlayer( 'appleVdn', [
        'application/vnd.apple.mpegurl',
        'application/vnd.apple.mpegurl; codecs="avc1.42E01E"'
@@ -264,10 +268,25 @@
                                                }
 
                                        }
+                                       
+                                       // Test for h265:
+                                       if ( dummyvid.canPlayType('video/mp4; 
codecs="avc1.42E01E, mp4a.40.2"' ) ) {
+                                               this.mediaPlayers.addPlayer( 
h265NativePlayer );
+                                               // Check for iOS for vdn player 
support ( apple adaptive ) or vdn canPlayType != '' ( ie maybe/probably )
+                                               if( mw.isIOS() || 
dummyvid.canPlayType('application/vnd.apple.mpegurl; codecs="avc1.42E01E"' ) ){
+                                                       // Android 3x lies 
about HLS support ( only add if not Android 3.x )
+                                                       if( 
navigator.userAgent.indexOf( 'Android 3.') == -1 ){
+                                                               
this.mediaPlayers.addPlayer( appleVdnPlayer );
+                                                       }
+                                               }
+
+                                       }
+
                                        // For now if Android assume we support 
h264Native (FIXME
                                        // test on real devices )
                                        if ( mw.isAndroid2() ){
                                                this.mediaPlayers.addPlayer( 
h264NativePlayer );
+                                               this.mediaPlayers.addPlayer( 
h265NativePlayer );
                                        }
 
                                        // Test for ogg
diff --git a/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js 
b/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
index 9af4899..acc289b 100644
--- a/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
+++ b/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
@@ -283,6 +283,9 @@
                                        case 'h264Native':
                                                var shortName = 'h264';
                                                break;
+                                       case 'h265Native':
+                                               var shortName = 'h265';
+                                               break;
                                        case 'appleVdn':
                                                var shortName = 'appleVdn';
                                                break;
diff --git a/TimedMediaHandler.php b/TimedMediaHandler.php
index 5095156..87d9279 100644
--- a/TimedMediaHandler.php
+++ b/TimedMediaHandler.php
@@ -182,6 +182,24 @@
 
        // A full-HD high quality stream; higher end phones, tablets, smart tvs
        WebVideoTranscode::ENC_H264_1080P,
+
+       // MP4 H.265/AAC
+       // Primary format for the Apple/Microsoft world
+       //
+       // Check patent licensing issues in your country before use!
+       // Similar to WebM in quality/bitrate
+
+       // A least common denominator h.265 stream; first gen iPhone, iPods, 
early android etc.
+       WebVideoTranscode::ENC_H265_320P,
+
+       // A mid range h.265 stream; mid range phones and low end tables
+       WebVideoTranscode::ENC_H265_480P,
+
+       // An high quality HD stream; higher end phones, tablets, smart tvs
+       WebVideoTranscode::ENC_H265_720P,
+
+       // A full-HD high quality stream; higher end phones, tablets, smart tvs
+       WebVideoTranscode::ENC_H265_1080P,
 */
 );
 
diff --git a/WebVideoTranscode/WebVideoTranscode.php 
b/WebVideoTranscode/WebVideoTranscode.php
index 97b8d73..6e3f4ed 100644
--- a/WebVideoTranscode/WebVideoTranscode.php
+++ b/WebVideoTranscode/WebVideoTranscode.php
@@ -46,11 +46,17 @@
        const ENC_VP9_720P = '720p.vp9.webm';
        const ENC_VP9_1080P = '1080p.vp9.webm';
 
-       // mp4 profiles:
+       // H264 mp4 profiles:
        const ENC_H264_320P = '320p.mp4';
        const ENC_H264_480P = '480p.mp4';
        const ENC_H264_720P = '720p.mp4';
        const ENC_H264_1080P = '1080p.mp4';
+
+       // H265 mp4 profiles:
+       const ENC_H265_320P = '320p.h265.mp4';
+       const ENC_H265_480P = '480p.h265.mp4';
+       const ENC_H265_720P = '720p.h265.mp4';
+       const ENC_H265_1080P = '1080p.h265.mp4';
 
        const ENC_OGG_VORBIS = 'ogg';
        const ENC_OGG_OPUS = 'opus';
@@ -270,6 +276,7 @@
                // and apple HLS profile guide:
                // 
https://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/streamingmediaguide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html#//apple_ref/doc/uid/TP40008332-CH102-DontLinkElementID_24
 
+               // mp4 H264 transcode:
                WebVideoTranscode::ENC_H264_320P =>
                        array(
                                'maxSize' => '480x320',
@@ -317,6 +324,54 @@
                                'type' => 'video/mp4; codecs="avc1.42E01E, 
mp4a.40.2"',
                        ),
 
+               // mp4 H265 transcode:
+               WebVideoTranscode::ENC_H265_320P =>
+                       array(
+                               'maxSize' => '480x320',
+                               'videoCodec' => 'h265',
+                               'preset' => 'ipod320',
+                               'videoBitrate' => '400k',
+                               'audioCodec' => 'aac',
+                               'channels' => '2',
+                               'audioBitrate' => '40k',
+                               'type' => 'video/mp4; codecs="avc1.42E01E, 
mp4a.40.2"',
+                       ),
+
+               WebVideoTranscode::ENC_H265_480P =>
+                       array(
+                               'maxSize' => '640x480',
+                               'videoCodec' => 'h265',
+                               'preset' => 'ipod640',
+                               'videoBitrate' => '1200k',
+                               'audioCodec' => 'aac',
+                               'channels' => '2',
+                               'audioBitrate' => '64k',
+                               'type' => 'video/mp4; codecs="avc1.42E01E, 
mp4a.40.2"',
+                       ),
+
+               WebVideoTranscode::ENC_H265_720P =>
+                       array(
+                               'maxSize' => '1280x720',
+                               'videoCodec' => 'h265',
+                               'preset' => '720p',
+                               'videoBitrate' => '2500k',
+                               'audioCodec' => 'aac',
+                               'channels' => '2',
+                               'audioBitrate' => '128k',
+                               'type' => 'video/mp4; codecs="avc1.42E01E, 
mp4a.40.2"',
+                       ),
+
+               WebVideoTranscode::ENC_H265_1080P =>
+                       array(
+                               'maxSize' => '1920x1080',
+                               'videoCodec' => 'h265',
+                               'videoBitrate' => '5000k',
+                               'audioCodec' => 'aac',
+                               'channels' => '2',
+                               'audioBitrate' => '128k',
+                               'type' => 'video/mp4; codecs="avc1.42E01E, 
mp4a.40.2"',
+                       ),
+
                //Audio profiles
                WebVideoTranscode::ENC_OGG_VORBIS =>
                        array(
diff --git a/i18n/en.json b/i18n/en.json
index 80999a8..5d2c181 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -99,6 +99,14 @@
        "timedmedia-derivative-desc-720p.mp4": "HD quality MP4 (720P)",
        "timedmedia-derivative-1080p.mp4": "H264 1080P",
        "timedmedia-derivative-desc-1080p.mp4": "Full HD quality MP4 (1080P)",
+       "timedmedia-derivative-320p.h265.mp4": "H265 320P",
+       "timedmedia-derivative-desc-320p.h265.mp4": "Device-friendly MP4 
(320P)",
+       "timedmedia-derivative-480p.h265.mp4": "H265 480P",
+       "timedmedia-derivative-desc-480p.h265.mp4": "Web streamable MP4 (480P)",
+       "timedmedia-derivative-720p.h265.mp4": "H265 720P",
+       "timedmedia-derivative-desc-720p.h265.mp4": "HD quality MP4 (720P)",
+       "timedmedia-derivative-1080p.h265.mp4": "H265 1080P",
+       "timedmedia-derivative-desc-1080p.h265.mp4": "Full HD quality MP4 
(1080P)",
        "timedmedia-derivative-ogg": "Ogg Vorbis",
        "timedmedia-derivative-desc-ogg": "Ogg Vorbis",
        "timedmedia-derivative-opus": "Opus",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index fd52d08..c673e06 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -115,6 +115,14 @@
        "timedmedia-derivative-desc-720p.mp4": "{{optional}} A type of media 
format encoding",
        "timedmedia-derivative-1080p.mp4": "{{optional}}  A type of media 
format encoding",
        "timedmedia-derivative-desc-1080p.mp4": "{{optional}} A type of media 
format encoding",
+       "timedmedia-derivative-320p.h265.mp4": "{{optional}}  A type of media 
format encoding",
+       "timedmedia-derivative-desc-320p.h265.mp4": "{{optional}} A type of 
media format encoding",
+       "timedmedia-derivative-480p.h265.mp4": "{{optional}}  A type of media 
format encoding",
+       "timedmedia-derivative-desc-480p.h265.mp4": "{{optional}} A type of 
media format encoding",
+       "timedmedia-derivative-720p.h265.mp4": "{{optional}}  A type of media 
format encoding",
+       "timedmedia-derivative-desc-720p.h265.mp4": "{{optional}} A type of 
media format encoding",
+       "timedmedia-derivative-1080p.h265.mp4": "{{optional}}  A type of media 
format encoding",
+       "timedmedia-derivative-desc-1080p.h265.mp4": "{{optional}} A type of 
media format encoding",
        "timedmedia-derivative-ogg": "{{optional}} Short form of a media 
format.",
        "timedmedia-derivative-desc-ogg": "{{optional}} Media format.",
        "timedmedia-derivative-opus": "{{optional}} Short form of a media 
format.",

-- 
To view, visit https://gerrit.wikimedia.org/r/231575
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1730cd1e7a85d2285fe1ef1a1799ed5137963834
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to