FFmpeg: Difference between revisions

Jump to navigation Jump to search
Line 78: Line 78:


Note: you can use <code>-c copy</code> to trim without re-encoding, but FFmpeg can only cut to the nearest keyframe, so the output may not be exactly the same length as specified.
Note: you can use <code>-c copy</code> to trim without re-encoding, but FFmpeg can only cut to the nearest keyframe, so the output may not be exactly the same length as specified.
===Batching===
The following is a batch script (text file with .bat file extension) that converts all .mp4 files in the specified folder to .avi:
<pre>@echo off
setlocal enabledelayedexpansion
:: Set source video folder, as absolute path or relative to this script
set src="videos"
:: Set destination folder
set dst="videos/converted"
for /R %src% %%F in (*.mp4) do (
    :: Put your FFmpeg command here
    ffmpeg -i "%%F" -vcodec copy "%dst%\%%~nF.avi
)
pause
</pre>