First of you need to install the following as a plugin in audacity:
;nyquist plug-in
;version 4
;type tool
;codetype lisp
;name "Labels to Chapters"
;author "Steve Daulton"
;release 2.3.2
;copyright "Released under terms of the GNU General Public License version 2"
;control timebase "Time base" int "" 1000 100 2000
;control title "Title" string "" ""
;control encodedby "Encoded by" string "" ""
;control artist "Artist" string "" ""
;control date "Date" string "" "2020"
;control filename "Save file as" file "" "*default*/metadata.txt" "Text file|*.txt;*.TXT|All files|*.*;*" "save,overwrite"
(setf metadata
(format nil ";FFMETADATA1~%~
title=~a~%~
encoded_by=~a~%~
artist=~a~%~
date=~a~%~
encoder=Lavf58.27.103~%"
title
encodedby
artist
date))
;; Get label data from first label track
(setf labels (second (first (aud-get-info "Labels"))))
(dolist (label labels)
(setf chapter
(format nil "[CHAPTER]~%~
TIMEBASE=1/~a~%~
START=~a~%~
END=~a~%~
title=~a~%"
timebase
(round (* timebase (first label)))
(round (* timebase (second label)))
(third label)))
(string-append metadata chapter))
(setf fp (open filename :direction :output))
(format fp metadata)
(close fp)
(format nil "File written to~%~a" filename)
This is the code that converts your label track into an ffmpeg-metadata file.
- Save the code as a
.ny
whereever you want to keep it or where you usually save your audacity plugins. - Open Audacity
- Go to "Tools" -> "Nyquist Plug-in Installer..."
- Choose the file you saved in step one and confirm
- Under "Tools" -> "Add / Remove Plug-ins..." make sure the new plugin was successfully added and is enabled
- Create your audio file with the first label track serving as chapter marks
- When you are done, go to "Tools" and run the newly installed plug-in, saving the
metadata.txt
somewhere - Export the audio as an mp3 file
- Open a terminal
- Run
ffmpeg -i audio.mp3 -i metadata.txt -map_metadata 1 -codec copy -id3v2_version 3 -write_id3v1 1 audio-with-chapters.mp3
Don't simply copy the command, the file paths will differ ;)
While this solution isn't the most straightforward, you can at least edit your chapter marks in a GUI.