I'm using PHP-FFMpeg in a Laravel 5.2 application to stabilize videos with the help of VidStab. I have all the dependencies and everything installed correctly and I can follow the directions on the VidStab repo to stabilize my videos via the command line.
My question is how could I do this nicely (the Laravel way) from within PHP? I know I can add a custom filter to the Video object like this:
$video = $ffmpeg->open('shaky_video.mp4');
$video->addFilter(new CustomFilter('vidstabdetect=stepsize=6:shakiness=8:accuracy=9:result=transform.trf'));
But how can I execute this command without the need for $video-save()
, which I think is designed to output a video/audio file and not the trf
analysis file?
I suppose I could just run a PHP exec() command, but I would like to keep this as much object oriented PHP as I can. Any suggestions?
Thanks in advance!
I've tried this (added -f null -
to filter and then tried running save()
to execute the command), but it still creates the mp4 file instead of the trf file:
$video = $ffmpeg->open('shaky_video.mp4');
$video->addFilter(new CustomFilter('vidstabdetect=stepsize=6:shakiness=8:accuracy=9:result=transform.trf -f null -'));
$video->save(new X264(), 'stabilized.mp4');