Caloux Fld
Caloux Fld

Reputation: 31

How to Generate accurate thumbnails with FFMPEG

I am using FFmpeg for generating thumbnails map.

I need to generate a thumbnail for every second. Here is code i use on Windows:

ffmpeg -i "C:\temp\MyVideo.mp4" -vf "drawtext=fontfile=../Fonts/calibri.ttf: text=%%`
`{n}: r=25: x=(w-tw)/2: y=h-lh-122: fontsize=295: fontcolor=Red:   box=0:` `boxcolor=Black,fps=1/1" -s 400x300 -vcodec ppm -f image2pipe - | montage -  -`
    `tile 10x -geometry 200x+0+0 C:\temp\Thumbnailer.jpg`

Code Work's Fine , generate a thumbnails map with piping FFMPEG+Imagemagick (montage). In ffmpeg i burn the frame number to check accuracy.

Only problem is FFMPEG start generating at frames 12, 37, 62, 87...(video is 25 fps).

How to start generating thumbnails at first frame #1 accurate?

In FFMPEG i try options like -ss 00:00:00.0 but FFMPEG start always at frame 12. Only solution i found is to generate all frames (25fps) and post process to keep frames number 1,25,50... but very slow post process...

My FFMPEG version : ffmpeg version N-88153-ga4743d2574-Reino

Upvotes: 2

Views: 2035

Answers (1)

Gyan
Gyan

Reputation: 93319

The fps filter will select based on the timestamp rounding method used.

For your purposes, use fps=1/1:round=up

See all available methods at https://ffmpeg.org/ffmpeg-filters.html#fps-1

Upvotes: 2

Related Questions