Skip to content

Instantly share code, notes, and snippets.

@petscheit
Last active October 21, 2020 20:23
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 petscheit/534b595009501a231ca85e4facd7b0dd to your computer and use it in GitHub Desktop.
Save petscheit/534b595009501a231ca85e4facd7b0dd to your computer and use it in GitHub Desktop.
# -------------------------------------------------------------------------
# convert .mov file into segments of .mp4 files. I use it to create 60 sec video for my insta cooking channel with one command
# vsplit "original.mov" segment_span_in_seconds # "$(( 1*59 ))"
# this is inefficient but it works and I don't want to dig deeper into ffmpeg
# -------------------------------------------------------------------------
vsplit() {
SRC="$1"
ffmpeg -i "$SRC" -qscale 0 output.mp4
ffmpeg -i output.mp4 -c:v libx264 -crf 22 -map 0 -segment_time ${2} -g 9 \
-sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*9)" \
-reset_timestamps 1 -f segment "segment_%03d.mp4"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment