FFmpeg实用手册
常用命令
危险
本章节内容未完成。 以下内容未经测试,谨慎参考。
合并视频
ffmpeg -protocol_whitelist "file,http,crypto,tcp,https,tls" -f concat -safe 0 -i 输入文本 -c copy 输出视频.mp4
转换视频格式
@echo off
setlocal enabledelayedexpansion
REM Check if a directory was provided as the first argument
set "directory=%~1"
REM Check if the recursive flag was provided as the second argument
set "recursive=%~2"
REM If no directory argument was provided, prompt the user to enter one
if "%directory%"=="" (
set /p directory="Enter the directory path: "
)
REM If no recursive flag was provided, set it to recursive by default
if "%recursive%"=="" (
set "recursive=recursive"
)
REM Check if the directory exists
if not exist "%directory%" (
echo The directory "%directory%" does not exist.
exit /b
)
echo Converting files in %directory% ...
REM Define the list of video formats to convert from
set "formats=.flv .avi .mov .wmv .mp4"
REM Check if recursive search is enabled
if "%recursive%"=="recursive" (
REM Loop over the defined video formats
for %%a in (%formats%) do (
REM Loop over all files with the current format recursively and convert them to .mp4
for /r "%directory%" %%f in (*%%a) do (
echo Converting "%%f" to "%%~dpnf.mp4"
ffmpeg -i "%%f" -c:v h264_nvenc -preset:v medium -c:a aac "nvenc-%%~dpnf.mp4"
)
)
) else (
REM Loop over the defined video formats
for %%a in (%formats%) do (
REM Loop over all files with the current format in the specified directory and convert them to .mp4
for %%f in ("%directory%\*%%a") do (
echo Converting "%%f" to "%%~dpnf.mp4"
ffmpeg -i "%%f" -c:v h264_nvenc -preset:v medium -c:a aac "nvenc-%%~dpnf.mp4"
)
)
)
echo Conversion complete.
pause