-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathHLS_transport_streams.php
49 lines (38 loc) · 1.53 KB
/
HLS_transport_streams.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
<?php
/**
* =========================================================
* Single file MP4 output + ad
* =========================================================
* The example below uses the H264 streams created in Media Encoding.
*
* The example below creates five single track TS streams
* (4 video, 1 audio) and HLS playlists, which describe the streams.
*/
use Shaka\Options\Streams\HLSStream;
require_once '../init.require.php';
$stream1 = HLSStream::input($h264_baseline_360p)
->streamSelector('audio')
->segmentTemplate($output_path . 'audio/$Number$.aac');
$stream2 = HLSStream::input($input_text)
->streamSelector('text')
->segmentTemplate($output_path . 'text/$Number$.vtt');
$stream3 = HLSStream::input($h264_baseline_360p)
->streamSelector('video')
->segmentTemplate($output_path . 'h264_360p/$Number$.ts');
$stream4 = HLSStream::input($h264_main_480p)
->streamSelector('video')
->segmentTemplate($output_path . 'h264_480p/$Number$.ts');
$stream5 = HLSStream::input($h264_main_720p)
->streamSelector('video')
->segmentTemplate($output_path . 'h264_720p/$Number$.ts');
$stream6 = HLSStream::input($h264_high_1080p)
->streamSelector('video')
->segmentTemplate($output_path . 'h264_1080p/$Number$.ts');
$export = \Shaka\Shaka::initialize()
->streams($stream1, $stream2, $stream3, $stream4, $stream5, $stream6)
->mediaPackaging()
->HLS($output_path . 'h264_master.m3u8', function ($options){
return $options->adCues('600;1800;3000');
})
->export();
echo $export;