Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build video thumbnails sheet using pipe (ffmpeg + imagemagick)? [closed]

How can I build video thumbnails sheet using pipe (ffmpeg + imagemagick) on windows without using temporary files?

like image 655
Azevedo Avatar asked Oct 24 '25 19:10

Azevedo


1 Answers

UPDATE:

Here is an update version of this post I wrote.


The script bellow creates a folder named .\thumbnails and store in it all video thumbnails, with the same name of the video file.

Fully configurable! No temporary files used! (uses pipe!)

Requires: ffmpeg and imagemagick.

enter image description here

set impath=C:\programs\imagemagick
set folder=C:\My videos
set frame=320x180
set tile=10x1
set vframes=10
set fps=1/20
    REM 1/60 -> 1 shot every 60s
set filesize=300
    REM max file size in Kb
set filetypes=*.mp4

pushd "%folder%"
if not exist thumbnails md thumbnails

for /f "usebackq delims=" %%f in (`dir /b %filetypes%`) do (
 if not exist "thumbnails\%%~nf.jpg" (
    ffmpeg.exe -threads 2 -y -i "%%f" -an -qscale:v 1 -vf fps=%fps% -vframes %vframes% -f image2pipe -vcodec ppm - ^
    | %impath%\convert - -resize %frame% -background transparent -gravity center -extent %frame% -sharpen 1x2 -quality 100%% miff:- ^
    | %impath%\montage - -tile %tile% -geometry %frame% -background black -quality 100%% -define jpeg:extent=%filesize%kb "thumbnails\%%~nf.jpg"
 )
)
like image 185
Azevedo Avatar answered Oct 26 '25 16:10

Azevedo