Created
September 10, 2022 21:29
-
-
Save koonix/75d6b0f5dedc405030884593df8bf6f6 to your computer and use it in GitHub Desktop.
split the given video/audio files by chapters using ffmpeg.
This file contains hidden or 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
#!/bin/sh -efu | |
# split the given video/audio files by chapters using ffmpeg. | |
for file; do | |
ffprobe -print_format csv -show_chapters -- "$file" | cut -d, -f5,7,8 | | |
while IFS=, read start end chapter; do | |
ffmpeg -hide_banner -nostdin -ss "$start" -to "$end" -i "$file" \ | |
-c copy -map 0 -map_chapters -1 -- "${file%.*}-$chapter.${file##*.}" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment