Last active
January 22, 2020 17:38
-
-
Save KiaraGrouwstra/7da396ea78eb5085725575470f7c4d64 to your computer and use it in GitHub Desktop.
manipulate video files using ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# extract good parts | |
ffmpeg -ss 00:00:00 -t 00:00:51 -i VID_20191216_000516.mp4 -vcodec copy -acodec copy 1.mp4 | |
ffmpeg -ss 00:01:10 -i VID_20191216_000516.mp4 -vcodec copy -acodec copy 2.mp4 | |
# convert for concat | |
ffmpeg -i 1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts | |
ffmpeg -i 2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts | |
# concatenate | |
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4 | |
# rotate | |
ffmpeg -i output.mp4 -vf "transpose=1" rotated.mp4 | |
# convert subtitles downloaded from youtube | |
pip install --user webvtt-py | |
python -c "import webvtt; webvtt.from_sbv('captions.sbv').save_as_srt()" | |
# hardcode subs | |
ffmpeg -i rotated.mp4 -vf subtitles=captions.srt out.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment