0

I have a php script which is creating a list of images (usually around 400) to feed to ffmpeg via an exec command, it breaks. Is there another way to send multiple images?

Sample code below

$imgs4vid = "'dir/img1.jpg' 'dir/img2.jpg' 'dir/img3.jpg' 'dir/img4.jpg' 'dir/img5.jpg' etc.."

exec("ffmpeg -r 1/5 -pattern_type glob -i ".$imgs4vid." -c:v libx264 -r 30 -pix_fmt yuv420p ".$vid_name.".mp4 2>&1", $output);
var_dump($output);

I have a way to do with -f concat -i (generatoe a list of files and put her)

Seems like a long way to do it though, must be an easier solution?

Thanks

John J
  • 195
  • 1
  • 1
  • 11

1 Answers1

1

You can use patterns for input (and output) file names:

ffmpeg -i /dir/img%d.jpg -s 640x480 -vcodec mjpeg /tmp/out.avi
Vadim Kalinsky
  • 928
  • 8
  • 18
  • But how would you make the pattern work when you want to select date from and to (images are date stamped) – John J Feb 12 '14 at 19:57
  • You can use "-pattern_type glob", but the input sequence name should be pattern like those we use in shell commands. "-pattern_type glob -i 2013-10-05*.jpg", something like this. For more sophisticated filtering I would rename them to sequential numbers (i1.jpg, i2.jpg and so on) or make symlinks in some temporary directory. (check this out: http://stackoverflow.com/a/13732394/1322291) – Vadim Kalinsky Feb 12 '14 at 22:43