Skip to content

Instantly share code, notes, and snippets.

@UdaraAlwis
Last active December 7, 2019 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UdaraAlwis/011ba163edc3777cef111ecbdb1505ca to your computer and use it in GitHub Desktop.
Save UdaraAlwis/011ba163edc3777cef111ecbdb1505ca to your computer and use it in GitHub Desktop.
Split or Cut Video files using ffmpeg
:: Make sure ffmpeg.exe and the video file is in the same folder
:: Download ffmpeg: https://www.ffmpeg.org/download.html
:: Command Line executable code
:: Split a given mp4 file using ffmpeg.exe
:: Method 1: From 00:00:00 To 00:00:15
ffmpeg -i video_file_name.mp4 -ss 00:00:00 -t 00:00:15 -vcodec copy video_file_name_output.mp4
:: Method 1: From 00:00:15 To End
ffmpeg -i video_file_name.mp4 -c:v copy -c:a copy -ss 00:00:15 video_file_name_output.mp4
:: Split a given mp4 files using ffmpeg.exe (loop through files)
:: From 00:00:00 To 00:00:15
for %i in (*.mp4) do ffmpeg -i "%i" -ss 00:00:00 -t 00:00:15 -vcodec copy "%~ni_output.mp4"
:: integrate to executable .bat file - use %%
for %%a in ("*.mp4") do ffmpeg -i "%%a" -c:v copy -c:a copy -ss 00:00:15 "%%~na_output.mp4"
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment