laravel-ffmpeg icon indicating copy to clipboard operation
laravel-ffmpeg copied to clipboard

Problem with Videos without Audio

Open ojsoft opened this issue 4 years ago • 2 comments

When using exportForHLS() with a Video that has no Audio at all, you will run into a problem (I guess on every export, but i did not test that). ffmpeg does not get along with that.

new X264() has a lot of audio formats. One has to be set, I tried even copy in the hope that this just copies nothing without a mistake, but the same error occurs.

With: ffprobe -i PATH -show_streams -select_streams a -loglevel error I can test by hand wether I have a video without audio, but I found no way to call the exportForHLS in any successful way evan with this knowledge then. Right now I can only skip it then.

There should be an audio format called 'none' or 'null' that can be passed to the X264 class or any format class to specify that there is no audio, so that ffmpeg gets no audio conversion task from this package.

Why is it important to support videos without audio?

Because of living photography videos. They always come without audio. There are a kind of better animated gif replacement, a mixture between video and an image. See Cinemagraph Pro, this software produces only Videos without Audio.

With very best regards,

Oliver

ojsoft avatar Feb 24 '21 23:02 ojsoft

I haven't tried it myself, but you could try a custom video format with no audio codec, that extends the existing X264 class. Something like this:

use FFMpeg\Format\Video\X264;

class CustomX264 extends X264
{
    public function __construct($videoCodec = 'libx264')
    {
        $this->setVideoCodec($videoCodec);
        $this->audioCodec = null;
        $this->audioKiloBitrate = null;
    }

    public function getAvailableAudioCodecs()
    {
        return [];
    }
}

pascalbaljet avatar Feb 26 '21 21:02 pascalbaljet

Good idea indeed, but I tried to do it this way and am still facing the same problem. Something more fundamental seems to rely on audio being available.

ojsoft avatar Feb 27 '21 14:02 ojsoft