fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.64k stars 874 forks source link

Screenshots should accept FPS parameter and optimize resulting ffmpeg command #559

Open jonathan-fulton opened 8 years ago

jonathan-fulton commented 8 years ago

Currently, generating screenshots creates an ugly ffmpeg command. For instance, doing 1 screenshot / second for a 6 minute video (count = 360) passed ~3000 arguments to ffmpeg when I debugged. It also seemed to error out randomly mentioning something about bit_rate, width, height, etc.

Based on https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video it should be possible to use FPS as follows:

ffmpeg -i input.flv -vf fps=1 out%d.png

This worked blazingly fast. 1-2 seconds vs minutes for using node-fluent-ffmpeg when it didn't error out.

njoyard commented 8 years ago

Screenshots is just an example recipe, it is helpful for a few shots but when you have specific needs you should not use it. Build the ffmpeg command yourself using other fluent-ffmpeg methods :)

njoyard commented 8 years ago

Also note that you can write the command line you cite with fluent-ffmpeg ;)

jainanshul commented 6 years ago

I am trying to the same but not sure how to use the output or save functions to write multiple image files.

scyilk commented 5 months ago

+1, I'm trying to get every frame of a mp4 video and save them as PNGs in readable streams.

ffmpeg -i input.mp4 out%03d.png

I want to do this in fluent-ffmpeg