![FFmpeg 使用批量修剪保留字幕](https://linux22.com/image/1588121/FFmpeg%20%E4%BD%BF%E7%94%A8%E6%89%B9%E9%87%8F%E4%BF%AE%E5%89%AA%E4%BF%9D%E7%95%99%E5%AD%97%E5%B9%95.png)
我正在尝试剪辑一堆视频,下面的脚本可以工作,但它没有保留字幕。有没有办法保留字幕?
@Echo Off
SetLocal
Set "ext=mkv"
Set "opts=-v quiet"
Set "opts=%opts% -print_format "compact=print_section=0:nokey=1:escape=csv""
Set "opts=%opts% -show_entries "format=duration""
If Exist *.%ext% (If Not Exist "Trimmed\" MD Trimmed)
For %%a In (*.%ext%) Do Call :Sub "%%~a"
Exit/B
:Sub
For /f "Tokens=1* Delims=." %%a In (
'C:\ffmpeg\bin\FFProbe %opts% %1') Do (Set/A "ws=%%a-8.25" & Set "ps=%%b")
rem If %ws% Lss 20 GoTo :EOF
Set/A hh=ws/(60*60), lo=ws%%(60*60), mm=lo/60, ss=lo%%60
If %hh% Lss 10 Set hh=0%hh%
If %mm% Lss 10 Set mm=0%mm%
If %ss% Lss 10 Set ss=0%ss%
C:\ffmpeg\bin\FFMpeg -i %1 -ss 00:01:54 -to %hh%:%mm%:%ss%.%ps:~,3% -c:v copy -c:a copy "Trimmed\%~1"