惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Register - Security
The Register - Security
云风的 BLOG
云风的 BLOG
U
Unit 42
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Docker
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Secure Thoughts
Hacker News: Ask HN
Hacker News: Ask HN
Vercel News
Vercel News
S
Security @ Cisco Blogs
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
I
Intezer
MongoDB | Blog
MongoDB | Blog
AI
AI
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
博客园 - 叶小钗
S
SegmentFault 最新的问题
N
News | PayPal Newsroom
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
H
Help Net Security
美团技术团队
博客园 - 司徒正美
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
Kaspersky official blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Vulnerabilities – Threatpost
TaoSecurity Blog
TaoSecurity Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity
J
Java Code Geeks
量子位
Martin Fowler
Martin Fowler
博客园_首页

博客园 - Caraxes

共享打印机的另一种方式 简易防火墙映射测试 手动部署MySQL Exporter实战 Windows屏幕字体锯齿化的调整 Windows轻量级WebDAV服务器搭建 解决一个mysql数据库连接打开慢的问题记录 Mysql 赋予用户访问单表SELECT权限 UNIX换行和DOS换行的批量转换 Centos Mysql 8.0.43安装 关闭windows 更新驱动程序的方法 CentOS7下OpenSSH10.0p2升级实践 特殊符号的输入 tomcat启动一次问题的处理。 如何禁用键盘左侧Win键 Windows设置分页文件到D盘无效的解决方法 npm中文站的映射 解决内网HTTP由NG转发HTTPS后,部分跳转还是HTTP的问题 Linux LVM方式管理磁盘 Vscode Debug乱码的问题修复 一个切换不同JAVA版本的方法 ffmpeg提取音频 GO应用WINDOWS下添加程序图标 Linux 证书文件查看参考 批量查看HTTPS的SSL证书的有效期脚本 Linux系统下安装Java环境 修改Jar包里面的配置文件
使用ffmpeg批量生成视频的缩略图
Caraxes · 2025-06-30 · via 博客园 - Caraxes

脚本文件内容

新建一个文本文件。重命名为:thumb.bat
内容如下:

thumb.bat
@echo off
chcp 65001
del *-thumb.png
setlocal enabledelayedexpansion

where ffmpeg >nul 2>&1
if %errorlevel% neq 0 (
    echo [错误] 未找到FFmpeg,请先安装并添加到系统路径
    pause
    exit /b 1
)

set THUMB_WIDTH=1920
set THUMB_HEIGHT=1080
set THUMB_TIME=00:05:05
set OUTPUT_SUFFIX=-thumb.png

for %%F in (*.mkv *.mp4) do (
    set "INPUT_FILE=%%F"
    set "OUTPUT_FILE=%%~nF%OUTPUT_SUFFIX%"
    
    echo 正在处理: !INPUT_FILE! → !OUTPUT_FILE!
    
    ffmpeg  -ss %THUMB_TIME% -i "!INPUT_FILE!" -vframes 1 -s %THUMB_WIDTH%x%THUMB_HEIGHT% -f image2 "!OUTPUT_FILE!" > nul
    
    if %errorlevel% equ 0 (
        echo 成功生成缩略图
    ) else (
        echo [警告] 生成缩略图失败: !INPUT_FILE!
    )
)

echo 处理完成

用法:

1、把thumb.bat放到视频文件所在目录。
2、把thumb.bat放到windows目录或其他path环境变量设置的有效目录。

cd 到视频文件目录,并运行thumb

说明:

1、需要先安装配置好ffmpeg
2、本命令会删除*-thumb.png文件。然后重新生成视频缩略图。如果不适用请自行修改脚本。
3、缩略图粗略截取05:05的视频图片,请根据需要修改。
4、视频后缀名称是thumb.png,请根据需要修改。
5、视频缩略图大小是1920x1080,请根据需要修改。