0

This commands works perfectly:

ffmpeg -loop 1 -i flyer.jpg -c:v libx264 -t 15 -pix_fmt yuv420p -vf scale=1080:720 out.mp4

Trying to do the same with Laravel FFMPEG

FFMpeg::fromDisk('images')
    ->open('flyer.jpg')
    ->export()
    ->addFilter('-loop', 1)
    ->addFilter('-c:v', 'libx264')
    ->addFilter('-t', '15')
    ->addFilter('-pix_fmt', 'yuv420p')
    ->addFilter('-vf', 'scale=1080:720')
    ->save('timelapse.mp4');

Seems that all filters are correctly applied but "-t 15" is not.

The problem is that in order to work, the -loop parameter should be specified before the -i parameter.

This works: ffmpeg -loop 1 -i flyer.jpg -c:v libx264 -t 15 -pix_fmt yuv420p -threads 12 -vf [in]scale=1080:720 out.mp4

This doesn't work: ffmpeg -i flyer.jpg -loop 1 -c:v libx264 -t 15 -pix_fmt yuv420p -threads 12 -vf [in]scale=1080:720 out.mp4

So I should I proceed with FFMPEG Laravel? This topic was brought up in github: https://github.com/protonemedia/laravel-ffmpeg/issues/349

But no answers.

Thanks.

John Smith
  • 1,848
  • 3
  • 13
  • 24

1 Answers1

0

You need to set input options not filters (or output options). Not knowing anything about PHP/Laravel, I suspect you need to use either openWithInputOptions() to open the input file or setInputOptions() to set -loop 1 input option.

kesh
  • 4,515
  • 2
  • 12
  • 20
  • Where should I set the setInputOptions()? I can't find that method. FFMpeg::fromDisk('images')->setInputOptions() not available. – John Smith Jun 07 '22 at 05:44
  • As I said, I'm not familiar with Laravel/PHP, so I don't know. But `setInputOptions` is defined as a part of a `trait HasInputOptions`. Can you inject this trait to your Disk object? – kesh Jun 07 '22 at 13:33