Skip to content

Instantly share code, notes, and snippets.

@xvzftube
Created December 12, 2020 19:56
Show Gist options
  • Save xvzftube/7dc934fb98262cefd7d8598855e140ef to your computer and use it in GitHub Desktop.
Save xvzftube/7dc934fb98262cefd7d8598855e140ef to your computer and use it in GitHub Desktop.
# 1. Copy from beginning to -t time (seconds) or time (00:00:00)
ffmpeg -i file_name.mp4 \
-t 00:00:00 \
-c copy \
new_file_name_1.mp4
# 2. Copy from time -ss (00:00:00) to end
ffmpeg -i file_name.mp4 \
-ss 00:00:00 \
-c copy \
new_file_name_2.mp4
# 3. Copy from time -ss (00:00:00) to -to (00:00:00)
ffmpeg -i file_name.mp4 -ss 00:00:00 \
-to 00:00:00 \
-c copy \
new_file_name_3.mp4
# concatonate videos
# files.txt is a list of of the files to concat
# files.txt example:
# file 'file 1.mkv'
# file 'file 2.mkv'
ffmpeg -f concat -safe 0 -i files.txt -c copy output.webm
# get duration of video
ffmpeg -i file.webm 2>&1 | grep 'Duration' | cut -d ',' -f 1
# Accurate frame cutting
# http://www.markbuckler.com/post/cutting-ffmpeg/
ffmpeg -i file_name.webm -ss 00:00:00 -strict -2 -to 00:00:00 new_file_name.webm
# Remove audio when cutting
ffmpeg -i file_name.webm -ss 00:00:00 -strict -2 -to 00:00:00 -an new_file_name.webm
# Record audio only
ffmpeg -f alsa -i default audio.wav
# add audio and video together
ffmpeg -i video.webm -i audio.ogg -map 0:v -map 1:a -c copy audio_video.webm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment