Skip to content

Create ability to define additional filters per stream in the HLSPlaylistExporter #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

chancezeus
Copy link

As specified in title/commit message I needed the ability to add filters per format (scale/framerate).

For this purpose I added the option to add (multiple) filters to the addFormat function (these per stream filters work exactly the same as the addFilter method on the media object).

As more people might be interested I submit this pull request for you to review and/or merge (if wanted/needed).

@pascalbaljet
Copy link
Collaborator

Thanks for the PR! I like the feature but this would be a breaking change. I'll try to find some time to refactor this into a non-breaking change and then add it as a feature.

@pascalbaljet
Copy link
Collaborator

As of version 1.2.0 the addFormat method of the HLS exporter takes an optional second parameter which can be a callback method. This allows you to add different filters per format:

$lowBitrate = (new X264)->setKiloBitrate(250);
$highBitrate = (new X264)->setKiloBitrate(1000);

FFMpeg::open('steve_howe.mp4')
    ->exportForHLS()
    ->addFormat($lowBitrate, function($media) {
        $media->addFilter(function ($filters) {
            $filters->resize(new \FFMpeg\Coordinate\Dimension(640, 480));
        });
    })
    ->addFormat($highBitrate, function($media) {
        $media->addFilter(function ($filters) {
            $filters->resize(new \FFMpeg\Coordinate\Dimension(1280, 960));
        });
    })
    ->save('adaptive_steve.m3u8');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants