标题: [文本处理] 求助批处理批量视频转GIF哪里不对? [打印本页]
作者: jiangyver 时间: 2024-10-16 10:29 标题: 求助批处理批量视频转GIF哪里不对?
- @echo off
- setlocal enabledelayedexpansion
-
- set ffmpegPath=D:\ffmpeg-master-latest-win64-gpl-shared\bin\ffmpeg.exe[quote]软件路径[/quote]
- set inputFolder=%~dp0
- set outputFolder=%inputFolder%GIFs
-
- if not exist %outputFolder% mkdir %outputFolder%
-
- for %%i in (%inputFolder%.mp4) do (
- echo Converting %%i...
- %ffmpegPath% -i %%i -ss 000000 -t 000500 -vf scale=320-1flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse %outputFolder%%%~ni.gif
- echo Converted %%i to %outputFolder%%%~ni.gif
- )
-
- echo All MP4 files have been processed.
复制代码
作者: Five66 时间: 2024-10-16 18:44
试试将12行滤镜链里的- scale=320-1flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse
复制代码
换成- "scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse[out]" -map "[out]"
复制代码
作者: fzp070 时间: 2024-10-18 13:39
稍微调整了下,在我这可以转换gif文件。320的图太小了,换成了720。楼主试试看吧- @echo off
- color 3f
- title FFmpeg批量视频转GIF
- setlocal enabledelayedexpansion
-
- set ffmpegPath=D:\ffmpeg-master-latest-win64-gpl-shared\bin\ffmpeg.exe&rem 软件路径
- set inputFolder=%~dp0
- set outputFolder=%inputFolder%GIFs
-
- if not exist "%outputFolder%" mkdir "%outputFolder%"
-
- for %%i in ("%inputFolder%*.mp4") do (
- echo 转换【%%~ni.mp4】...
- if exist "%outputFolder%\%%~ni.gif" echo.&echo ---注:视频已有GIF文件,程序退出!--- &goto end
- "%ffmpegPath%" -i "%%i" -y -ss 000000 -t 000500 -vf scale=720:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse "%outputFolder%\%%~ni.gif">nul 2>nul
- echo.&echo 已转换 "%%~ni.mp4" to "%%~ni.gif"
- )
-
- echo.&echo 所有 MP4 文件均已处理。
- :end
- TIMEOUT /T 5 /NOBREAK
- exit
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |