Skip to content

Instantly share code, notes, and snippets.

@snoj
Last active May 3, 2019 17:43
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 snoj/527e73bac693c5e8306c50d779e3fdda to your computer and use it in GitHub Desktop.
Save snoj/527e73bac693c5e8306c50d779e3fdda to your computer and use it in GitHub Desktop.
$video = "path/to/source/file.mp4";
$video_extension = "mp4"; ##This must match what the source file has. eg. if it's flv, use that.
$output_directory = "output/directory/video"; ##destination folder for 2 hour chunks
$ffmpegEXE = "path/to/ffmpeg.exe";
for($i = 0; $i -lt 13; $i++) {
& $ffmpegEXE -i $video -ss ("{0}:00:00" -f (($i)*2)) -t "2:0:0" -c copy ("{0}_{1}.{2}" -f $output_directory, ($i+1), $video_extension);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment