laravel-ffmpeg
laravel-ffmpeg copied to clipboard
Why it's not possible to convert .mp4 with "X265"?
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?
@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');