Skip to content

Instantly share code, notes, and snippets.

@SanariSan
Last active January 3, 2024 23:03
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 SanariSan/c14e481d0f53095e8a27f4fcf3e5d703 to your computer and use it in GitHub Desktop.
Save SanariSan/c14e481d0f53095e8a27f4fcf3e5d703 to your computer and use it in GitHub Desktop.
ffmpeg cut video, subtitles, convert format

Cut video (possibly directly to mp4)

ffmpeg -ss 00:01:00 -to 00:02:00 -i ./in.mkv -c copy out.mkv

Cut external subs

ffmpeg -i in.srt -ss 01:00 -to 02:00 out.srt

Burn subs into video

ffmpeg -i out.mkv -vf subtitles=out.srt -c:a copy -y final.mkv

Convert mkv to desired format

ffmpeg -i final.mkv -codec copy final_mp4.mp4

Convert flv to mp4

ffmpeg -i final.mkv -c:v libx264 -crf 19 -strict experimental final_mp4.mp4

Todo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment