-
Notifications
You must be signed in to change notification settings - Fork 27
/
single_file_MP4_output_with_DASH_plus_HLS.php
54 lines (43 loc) · 1.61 KB
/
single_file_MP4_output_with_DASH_plus_HLS.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* =========================================================
* Single file MP4 output with DASH + HLS
* =========================================================
* The example below creates five single file MP4 streams,
* and HLS playlists as well as DASH manifests.
*/
use Shaka\Options\Streams\HLSStream;
require_once '../init.require.php';
$stream1 = HLSStream::input($h264_baseline_360p)
->streamSelector('audio')
->output($output_path . 'audio.mp4')
->playlistName('audio.m3u8')
->HLSGroupId('audio')
->HlsName('ENGLISH');
$stream2 = HLSStream::input($h264_baseline_360p)
->streamSelector('video')
->output($output_path . 'h264_360p.mp4')
->playlistName('h264_360p.m3u8')
->iframeplaylistName('h264_360p_iframe.m3u8');
$stream3 = HLSStream::input($h264_main_480p)
->streamSelector('video')
->output($output_path . 'h264_480p.mp4')
->playlistName('h264_480p.m3u8')
->iframeplaylistName('h264_480p_iframe.m3u8');
$stream4 = HLSStream::input($h264_main_720p)
->streamSelector('video')
->output($output_path . 'h264_720p.mp4')
->playlistName('h264_720p.m3u8')
->iframeplaylistName('h264_720p_iframe.m3u8');
$stream5 = HLSStream::input($h264_high_1080p)
->streamSelector('video')
->output($output_path . 'h264_1080p.mp4')
->playlistName('h264_1080p.m3u8')
->iframeplaylistName('h264_1080p_iframe.m3u8');
$export = \Shaka\Shaka::initialize()
->streams($stream1, $stream2, $stream3, $stream4, $stream5)
->mediaPackaging()
->HLS($output_path . 'h264_master.m3u8')
->DASH($output_path . 'h264.mpd')
->export();
echo $export;