720x1080 批量转 1920x1080(两边黑屏) 手机直播的时候录播机录出来的分辨率是 720x1080,使用 ffmpeg 转成横屏的 1920x1080。这样 xml 转 ass 弹幕的时候,就不需要另外处理了,看起来很更舒服。 macos 的写法: input_folder="" # 要转化的录播的文件夹路径 output_folder="" # 要输出的文件夹路径 # Create the output folder if it does not exist mkdir -p "$output_folder" for f in "$input_folder"/*.flv; do ffmpeg -i "$f" -vf "scale=720:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -c:a copy "$output_folder/$(basename "${f%.*}.mp4")" done windows 的写法: $input_folder = "Z:\\rec\\48743-hanser\\20240731-又来画画了!" # 要转化的录播的文件夹路径 $output_folder = "Z:\\rec\\48743-hanser\\20240731-又来画画了!" # 要输出的文件夹路径 # Create the output folder if it does not exist If (-Not (Test-Path $output_folder)) { New-Item -ItemType Directory -Path $output_folder | Out-Null } Get-ChildItem -Path $input_folder -Filter *.flv | ForEach-Object { $input_file = $_.FullName $output_file = Join-Path $output_folder ($_.BaseName + ".mp4") $ffmpeg_args = @("-i", $input_file, "-vf", "scale=720:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2", "-c:a", "copy", $output_file) & ffmpeg $ffmpeg_args } 效果 弹幕压制 windows 版 (使用 cuda) @echo off set input_folder=YourInputFolderPath set output_folder=YourOutputFolderPath for a" -vf subtitles="~na_压制.mp4" -y ) macOS 版 #!/bin/bash input_folder="/path/to/input" # Replace with your input folder path output_folder="/path/to/output" # Replace with your output folder path mkdir -p "$output_folder" # Create the output folder if it doesn't exist for f in "$input_folder"/*.mp4; do subtitle_file="${f%.*}.ass" # Assumes subtitle file name is same as video file name but with .ass extension output_file="$output_folder/$(basename "${f%.*}_压制.mp4")" # Output file name with _ass suffix ffmpeg -i "$f" -vf "ass=$subtitle_file" "$output_file" done