Skip to content

Instantly share code, notes, and snippets.

@niski84
Created April 12, 2021 06:54
Show Gist options
  • Save niski84/22b9d191ae3a7953c23fa76ff36258d4 to your computer and use it in GitHub Desktop.
Save niski84/22b9d191ae3a7953c23fa76ff36258d4 to your computer and use it in GitHub Desktop.
ffmpeg cut clip from middle of video - supports mp4
# start and beginning and only go to -t time
ffmpeg -y -i "song.mp4" -t 00:03:10.00 -c copy dystopiaStart.mp4
# start at -ss and go to the end
ffmpeg -y -ss 00:19:27.00 -i "song.mp4" -c copy dystopiaEnd.mp4
# concat both clips :: update: does not work for mp4 files
#ffmpeg -i "concat:dystopiaStart.mp4|dystopiaEnd.mp4" -c copy Ffmpeg_test2.mp4
# concat demuxer method without re-encode
# create manifest with file paths and pass that in:
echo "file ./dystopiaStart.mp4" > ffmpeg_tmp_lst.txt
echo "file ./dystopiaEnd.mp4" >> ffmpeg_tmp_lst.txt
ffmpeg -f concat -safe 0 -i ffmpeg_tmp_lst.txt -c copy ffmpegtest3.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment