Giter Site home page Giter Site logo

quasarstream / shaka-php Goto Github PK

View Code? Open in Web Editor NEW
85.0 6.0 27.0 3.39 MB

๐ŸŽž Shaka PHP is a library that uses Shaka Packager for DASH and HLS packaging and encryption, supporting Common Encryption for Widevine and other DRM Systems.

License: MIT License

PHP 100.00%
shaka-player shaka-packager shaka video dash hls video-streaming php php7 google

shaka-php's People

Contributors

aminyazdanpanah avatar kfeng0806 avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

shaka-php's Issues

Problem with the SSL CA cert (path? access rights?).

Command :
packager 'in=/home/studygurueducati/public_html/sgadmin/public/uploads/lessons/2_1566303201.mp4,stream=audio,init_segment=/home/studygurueducati/public_html/sgadmin/public/output/2_1566303201/audio/init.mp4,segment_template=/home/studygurueducati/public_html/sgadmin/public/output/2_1566303201/audio/$Number$.m4s' 'in=/home/studygurueducati/public_html/sgadmin/public/uploads/lessons/2_1566303201.mp4,stream=video,init_segment=/home/studygurueducati/public_html/sgadmin/public/output/2_1566303201/video/init.mp4,segment_template=/home/studygurueducati/public_html/sgadmin/public/output/2_1566303201/video/$Number$.m4s' '--enable_widevine_encryption' '--key_server_url' 'https://license.uat.widevine.com/cenc/getcontentkey/widevine_test' '--content_id' '7465737420636f6e74656e74206964' '--signer' 'widevine_test' '--aes_signing_key' '1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9' '--aes_signing_iv' 'd58ce954203b7c9a9a9d467f59839249' '--mpd_output' '/home/studygurueducati/public_html/sgadmin/public/output/2_1566303201/output.mpd'

Error :
0820/083216:ERROR:http_key_fetcher.cc(225)] curl_easy_perform() failed: Problem with the SSL CA cert (path? access rights?).
[0820/083216:ERROR:packager_util.cc(107)] Widevine encryption key source failed to fetch keys: 7 (HTTP_FAILURE): curl_easy_perform() failed: Problem with the SSL CA cert (path? access rights?).
[0820/083216:ERROR:packager_main.cc(518)] Failed to initialize packager: 3 (INVALID_ARGUMENT): Failed to create key source.

Code :

        $stream1 = Stream::input($input_path)
                ->streamSelector('audio')
                ->initSegment($output_path . '/audio/init.mp4')
                ->segmentTemplate($output_path . '/audio/$Number$.m4s');

        $stream2 = Stream::input($input_path)
                ->streamSelector('video')
                ->initSegment($output_path . '/video/init.mp4')
                ->segmentTemplate($output_path . '/video/$Number$.m4s');

   
        $export = Shaka::initialize()
                ->streams($stream1, $stream2)
                ->mediaPackaging()
                ->DRM('widevine', function ($options) {
                    return $options->keyServerUrl('https://license.uat.widevine.com/cenc/getcontentkey/widevine_test')
                            ->contentId('7465737420636f6e74656e74206964')
                            ->signer('widevine_test')
                            ->aesSigningKey('1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9')
                            ->aesSigningIv('d58ce954203b7c9a9a9d467f59839249');
                })
                ->DASH($output_path . '/output.mpd')
                ->export();

streamSelector(0) is ignored

Describe the bug
I realized that if I assign to streamSelector the zero value (0), this is ignored in the command for packager, which does not report any information about the stream to select.

To Reproduce
Steps to reproduce the behavior:

  1. Set streamSelector to zero, for example:
HLSStream::input($source_file)
	->streamSelector(0)
	->initSegment($output_path . 'video/init.mp4')
	->segmentTemplate($output_path . 'video/$Number$.m4s')
	->playlistName('video/main.m3u8')
	->iframeplaylistName('video/iframe.m3u8')
  1. Run the script
  2. The code generates the error 2 (Misuse of shell builtins)
  3. Analyzing the bug log you can see that there is no information about the stream in the command:
'./packager-osx' 'in=test.mp4,playlist_name=video/main.m3u8,iframe_playlist_name=video/iframe.m3u8,stream=1,init_segment=video/init.mp4,segment_template=video/$Number$.m4s'

Expected behavior
Enter the stream information in the command, for example:

'./packager-osx' 'in=test.mp4,playlist_name=video/main.m3u8,iframe_playlist_name=video/iframe.m3u8,stream=1,stream=0,init_segment=video/init.mp4,segment_template=video/$Number$.m4s'

Exit Code: 1(General error)

i'm using linux server and getting error of Exit Code: 1(General error) because of packager .exe file
How do i need give path of exe file while using linux server because in my local windows server it is working fine.

Process timeout

Hello,
I am facing The process xxx exceeded the timeout of 60 seconds. error when converting a long video.
The Symfony Process package has default timeout limit to 60s

PHP Fatal error

Describe the bug
Sto usando shaja-php per convertire dei file MP4 con multiple lingue in HLS, ma lanciando lo script ottengo:

PHP Fatal error: Uncaught Shaka\Exception\ProcessException: The command "'./packager-linux' 'in=../../uploads/2020/07/csc-1861m-video.mp4,playlist_name=video/main.m3u8,iframe_playlist_name=video/iframe.m3u8,stream=video,init_segment=../../uploads/2020/07/csc-1861m-video.mp4.hsl/video/init.mp4,segment_template=../../uploads/2020/07/csc-1861m-video.mp4.hsl/video/$Number$.m4s' 'in=../../uploads/2020/07/csc-1861m-video.mp4,hls_name=Italian,hls_group_id=audio,playlist_name=../../uploads/2020/07/csc-1861m-video.mp4.hsl/audio-it/main.m3u8,stream=1,init_segment=../../uploads/2020/07/csc-1861m-video.mp4.hsl/audio-it/init.mp4,segment_template=../../uploads/2020/07/csc-1861m-video.mp4.hsl/audio-it/$Number$.m4s' 'in=../../uploads/2020/07/csc-1861m-video.mp4,hls_name=Spanish,hls_group_id=audio,playlist_name=../../uploads/2020/07/csc-1861m-video.mp4.hsl/audio-es/main.m3u8,stream=2,init_segment=../../uploads/2020/07/csc-1861m-video.mp4.hsl/audio-es/init.mp4,segment_template=../../uploads/2020/07/csc-1861m-video.mp4.hsl/audio-es/$Number$.m4s in /home/generate/web/generate.staging.effata.it/public_html/wp-content/plugins/generate-hls/vendor/aminyazdanpanah/php-shaka/src/Process/Process.php on line 83

Expected behavior
I wish I could figure out where the errors are, how do I get more debugging information?

EXIT CODE: 1 error

Now i got vps and got sudo access and i did manage to install shaka-packager on linux hosting and also now i'm able to find file but now i'm getting exit code 1 error again as below can you please guide me with this issue ?

ERROR:

The command "'/bin/packager' 'in=/home/studygurueducati/public_html/sgadmin/public/uploads/lessons/2_1566032973.mp4,stream=audio,init_segment=/home/studygurueducati/public_html/sgadmin/public/output/2_1566032973/audio/init.mp4,segment_template=/home/studygurueducati/public_html/sgadmin/public/output/2_1566032973/audio/$Number$.m4s' 'in=/home/studygurueducati/public_html/sgadmin/public/uploads/lessons/2_1566032973.mp4,stream=video,init_segment=/home/studygurueducati/public_html/sgadmin/public/output/2_1566032973/video/init.mp4,segment_template=/home/studygurueducati/public_html/sgadmin/public/output/2_1566032973/video/$Number$.m4s' '--enable_widevine_encryption' '--key_server_url' 'https://license.uat.widevine.com/cenc/getcontentkey/widevine_test' '--content_id' 'KEY' '--signer' 'widevine_test' '--aes_signing_key' 'KEY' '--aes_signing_iv' 'KEY' '--mpd_output' '/home/studygurueducati/public_html/sgadmin/public/output/2_1566032973/output.mpd'" failed. โ—€

Exit Code: 1(General error)

Working directory: /home/studygurueducati/public_html/sgadmin/public

PHP 8 support

Is your feature request related to a problem? Please describe.
I want to use this package in a PHP 8 project

Describe the solution you'd like
Added PHP 8 support

Describe alternatives you've considered
None

utcTimings DASH options example

Dear @aminyazdanpanah
I used your shaka-php to create encrypted and fragmented DASH stream. everything went well until I tried to play with shaka-player. it stucks after playing the first 10 seconds. and it repeatedly requested manifest file after that. I found the problem is utcTimings but cannot find any example of utcTimings. When I tried to seek through the player got (video:3) cannot find segment: currentPeriod.startTime=0 lookupTime=2114018157.57793

$stream_audio = DRMStream::input('video_360p.mp4')
    ->streamSelector('audio')
    ->initSegment('audio_1.m4s')
    ->segmentTemplate('audio_$Number$.m4s')
    ->drmLabel('AUDIO');

$stream_360 = DRMStream::input('video_360p.mp4')
    ->streamSelector('video')
    ->initSegment('sd_0_1.m4s')
    ->segmentTemplate('sd_0_$Number$.m4s')
    ->drmLabel('SD');

$stream_480 = DRMStream::input('video_480p.mp4')
    ->streamSelector('video')
    ->initSegment('sd_1_1.m4s')
    ->segmentTemplate('sd_1_$Number$.m4s')
    ->drmLabel('SD');

$stream_720 = DRMStream::input('video_720p.mp4')
    ->streamSelector('video')
    ->initSegment('hd_1.m4s')
    ->segmentTemplate('sd_$Number$.m4s')
    ->drmLabel('HD');

$export = Shaka::initialize()
    ->streams($stream_audio, $stream_360, $stream_480, $stream_720)
    ->mediaPackaging()
    ->DRM('raw', function ($options) {
        return $options
            ->keys('label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead');
    })
    ->DASH('dash_stream.mpd', function ($options) {
        return $options
            ->baseUrls('http://localhost:3700')
//          ->utcTimings()   #help wanted here
            ->segmentDuration(10);
    })
    ->export();

My timezone: Africa/Addis_Ababa (GMT+3)
thanks

so trying to learn to use this I keep getting an error on postman to test it and no file created.

Describe the bug
from postman

Type: TypeError
Message: Argument 1 passed to Shaka\Options\DRM\Raw::keys() must be of the type string, null given, called in \videouploads.php on line 1543
File:\vendor\aminyazdanpanah\php-shaka\src\Options\DRM\Raw.php
Line: 95

Notice: Undefined variable: keymine in \includes\videouploads.php on line 1543

So here is the issue I'm having broken down.
I don't want to read the key from file.
I want it as a variable.

                     $export = \Shaka\Shaka::initialize($config)
		->streams($stream1, $stream2)
		->mediaPackaging()
		->DRM('raw', function ($options) {
			 return $options->keys(file_get_contents('raw.key'));
		})
		->DASH($output_path . 'h264.mpd')
		->export();

so I change this as folllow. But I get the error above. I have declaired it NULL i have used isset. it still tells me the variable is Undefined variable. I can even echo it out.

                               return $options->keys($keymine);

How do I fix this?

Oh they key I use, is the same key cut from the file. I copy past the whole key line. so
$keymine = 'label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,'';

Just like in the file.
I want to do this so I can rotate the keys without needing file creation and deletion.

Does anyone have an answer?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.