kh_split.bat

Browser view only. Use the download link if you want to save the file.

Back to Toolbox
@echo off
set version=1.1

if x%1x==xx goto error1
if x%2x==xx goto error1
if not exist %1 goto error2
if not exist ffmpeg.exe goto error3

set outfile1=out1%~x1
set outfile2=out2%~x1
if not x%3x == xx set outfile1=%3%~x1
if not x%4x == xx set outfile2=%4%~x1

echo.
echo. %~n0 %version%.
echo.
echo. %1 -&lt %outfile1% / %outfile2%  (cut at %2)
echo.


ffmpeg -y -i %1 -c:v copy -t %2 %outfile1%
ffmpeg -y -i %1 -c:v copy -ss %2 %outfile2%

goto done

:error1
echo.
echo Usage: %~nx0 [video file to split] [split point]
echo.
echo.       Split point is in form h:m:s, such as 1:18:03
echo.
echo.       Output is out1.ext and out2.ext, where ext is 
echo.       the same extension as the video filename.
echo.
echo.       You should choose the split point as the 1st second of
echo.       the second video.  Better to see a 1/4 second switch on
echo.       the very last second of the first, than the very first
echo.       second of the second video.
echo.
goto end

:error2
echo File %1 not found here
goto end

:error3
echo FFMPEG.EXE not found here
goto end

:done
:end