Last active
April 22, 2024 22:38
-
-
Save corbindavenport/03764b176bc7be79fd507e698987b55e to your computer and use it in GitHub Desktop.
Bash script to generate MP3 file and chapters text file for a podcast episode
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
# More information: https://blog.corbin.io/post/748500250878263296/figuring-out-podcast-chapter-markers | |
# This requires FFMPEG/FFPROBE and JQ to be installed | |
# On a Mac with Homebrew installed: brew install jq ffmpeg | |
echo "Audio file: " | |
read audio | |
echo "Video file: " | |
read video | |
echo "Encoding audio file..." | |
ffmpeg -i "$audio" -map_chapters 0 -ac 1 -b:a 128k -f mp3 ~/Desktop/output.mp3 | |
echo "Writing chapters file..." | |
json_data=$(ffprobe -i "$audio" -show_chapters -sexagesimal -of json -loglevel error) | |
echo "$json_data" | jq -r '.chapters[] | "\(.start_time | split(".")[0]) \(.tags.title)"' > chapters.txt | |
echo "Files saved on Desktop!" | |
open ~/Desktop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment