2

I am using PHP-FFMpeg (a php wrapper for FFMpeg exacutable library) for making a very basic video editor. I am facing two issues right now. Below are description of those issues:

1.) Currently, I am adding subtitles to the video by using code below:

shell_exec('ffmpeg\bin\ffmpeg.exe -i uploads\abc.mp4 -i uploads\abc.srt -scodec mov_text -metadata:s:s:0 language=eng uploads\converted\exportx1.mp4');

Now, Its kinda my own custom code for adding subtitles in the video. I want to find a way (as I am working with Laravel Framework) to implement this functionality through package mentioned above (if anyone have enough experience with this package).

There is an option in the package that provides us with the facility of adding custom filters. I am trying with this code using that package:

$ffmpeg = FFMpeg\FFMpeg::create(array(
        'ffmpeg.binaries'  => 'ffmpeg\bin\ffmpeg.exe',
        'ffprobe.binaries' => 'ffmpeg\bin\ffprobe.exe',
        'timeout'          => 3600,
        'ffmpeg.threads'   => 2,
    ));
    $video = $ffmpeg->open('uploads\abc.mp4');

    $video
        ->filters()
        ->custom('-i uploads\abc.srt -scodec mov_text -metadata:s:s:0 language=eng')

$video
        ->save(new FFMpeg\Format\Video\WebM(), 'uploads\converted\exportx1.webm')

But its giving me this error.

2.) My second issue is that the shell_exec code (the first one) is adding the subtitles but I have to select them manually. I want them to be selected by default so that I don't have to perform another operation.

Any kind of help would be appreciated.

Xeeshan
  • 21
  • 4

0 Answers0