Skip to content
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

Why it's not possible to convert .mp4 with "X265"? #507

Open
Diogo2550 opened this issue Oct 20, 2023 · 1 comment
Open

Why it's not possible to convert .mp4 with "X265"? #507

Diogo2550 opened this issue Oct 20, 2023 · 1 comment

Comments

@Diogo2550
Copy link

I added the value "libx265" to the return array of the "X264" class and it was possible to convert to X265. Is there any reason why this functionality is not present?

@imrantune
Copy link

@Diogo2550 , you might want to give this a try:

<?php

namespace YOURNAMESPACE;

use FFMpeg\Format\Video\X264;

/**
 * A custom class for encoding videos with the H.265 (x265) codec, based on the X264 class.
 */
class X265 extends X264
{
    /**
     * Constructor to set audio and video codecs.
     *
     * @param string $audioCodec The audio codec to use. Defaults to 'aac'.
     * @param string $videoCodec The video codec to use. Defaults to 'libx265' for H.265 encoding.
     */
    public function __construct($audioCodec = 'aac', $videoCodec = 'libx265')
    {
        parent::__construct($audioCodec, $videoCodec);
    }

    /**
     * Get the available video codecs, in this case, only 'libx265'.
     *
     * @return array An array containing the available video codecs.
     */
    public function getAvailableVideoCodecs()
    {
        return array('libx265');
    }
}

Now, to use this custom class, you can instantiate it with the desired codecs like so:
new X265('aac','libx265');

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

No branches or pull requests

2 participants