如何使用管道(ffmpeg + imagemagick)构建视频缩略图表? [英] How to build video thumbnails sheet using pipe (ffmpeg + imagemagick)?

查看:187
本文介绍了如何使用管道(ffmpeg + imagemagick)构建视频缩略图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用临时文件的情况下在Windows上使用管道(ffmpeg + imagemagick)构建视频缩略图表?

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

推荐答案

更新:

此处是我写的这篇文章的更新版本.

UPDATE:

Here is an update version of this post I wrote.

以下脚本将创建一个名为.\thumbnails的文件夹,并将与该视频文件同名的所有视频缩略图存储在其中.

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!)

要求:ffmpeg和imagemagick.

Requires: ffmpeg and imagemagick.

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"
 )
)

这篇关于如何使用管道(ffmpeg + imagemagick)构建视频缩略图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆