2
I would like to know how I could save a clip(video) in MP4 by the Ffmpeg-PHP library without the audio, as it will not be necessary and I would also like to decrease the file size.
I’m using the following logic:
$frame = $segundos/6;
for($i = 1 ; $i <= 5 ; $i++){
$format = new \FFMpeg\Format\Video\X264();
$format->setAudioCodec('libmp3lame');
$clip = $video->clip(\FFMpeg\Coordinate\TimeCode::fromSeconds($frame*$i), \FFMpeg\Coordinate\TimeCode::fromSeconds(2.5));
$clip->filters()->resize(new \FFMpeg\Coordinate\Dimension(320, 240), \FFMpeg\Filters\Video\ResizeFilter::RESIZEMODE_INSET, true);
$clip->save($format,TEMPDIR.DS.'thumb.'.$filename.'_'.$i.'.mp4');
}
$video->concat([TEMPDIR.DS.'thumb.'.$filename.'_1.mp4',
TEMPDIR.DS.'thumb.'.$filename.'_2.mp4',
TEMPDIR.DS.'thumb.'.$filename.'_3.mp4',
TEMPDIR.DS.'thumb.'.$filename.'_4.mp4',
TEMPDIR.DS.'thumb.'.$filename.'_5.mp4'])
->saveFromSameCodecs(TEMPDIR.DS.'thumb.'.$filename.'.mp4', TRUE);
But I have not seen anything in the documentation about saving without something audio, because to save the clip is required to set an Audiocodec if not encoding error.
Does not work, error: Uncaught Error: Call to Undefined method Ffmpeg Format Video X264::addFilter()
– Henri Azevedo