Try that in a .bat file on Windows:
Quote:
@echo off
setlocal enabledelayedexpansion
:: === Set input file here ===
set "input=My Vacation Video.mp4"
set "output_prefix=segment_"
set "counter=0"
:: === Get total duration in seconds ===
for /f "usebackq tokens=*" %%a in (`ffprobe -v error -show_entries format^=duration -of default^=noprint_wrappers^=1:nokey^=1 "%input%"`) do set "duration=%%a"
:: === Round down to full minutes ===
for /f "tokens=1 delims=." %%b in ("!duration!") do set /a "minutes=%%b / 60"
:: === Create output folder ===
mkdir segments >nul 2>&1
:: === Loop to extract 10s from every minute ===
for /l %%i in (0,1,!minutes!) do (
set /a "start=%%i * 60"
set "outfile=segments\!output_prefix!!counter!.mp4 "
echo Extracting from second !start! to !start!+10 into !outfile!
ffmpeg -y -ss !start! -i "%input%" -t 10 -c:v libx264 -c:a aac -preset veryfast -crf 23 "!outfile!"
set /a counter+=1
)
:: === Create concat list ===
echo Creating concat list...
del concat.txt >nul 2>&1
(for %%f in (segments\%output_prefix%*.mp4) do echo file '%%f') > concat.txt
:: === Concatenate all segments into final output ===
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final_output.mp4
echo.
echo Done! Final file: final_output.mp4
pause
|
It's not perfect, but it should get you started.
You only need to replace your filename on that line:
Quote:
|
set "input=My Vacation Video.mp4"
|