Last active
May 29, 2022 21:45
-
-
Save Bobronium/ff572f25332dbcf41e922ad632259a08 to your computer and use it in GitHub Desktop.
Cut out fragment of a video with burned subtitles for Telegram
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
input_file=in.mp4 | |
output_file="${input_file%%.*}"-fragment."${input_file##*.}" | |
subs_file= # can be srt file or mkv container with subtitles | |
start_from= | |
stop_at= | |
duration= | |
# delete lines below that contain empty optional variables from above before use | |
# if duration is specified, '-to' or 'stop_at' is ignored | |
ffmpeg \ | |
-ss "$start_from" -copyts \ | |
-i "$input_file" \ | |
-ss "$start_from" \ | |
-to "$stop_at" \ | |
-t "$duration" \ | |
-vf subtitles="$subs_file" \ | |
-c:v libx264 \ | |
-crf 26 \ | |
-ac 2 \ | |
"$output_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment