diff --git a/audible-strip-drm b/audible-strip-drm index 59f134c..d07eff8 100755 --- a/audible-strip-drm +++ b/audible-strip-drm @@ -9,11 +9,15 @@ IFS=$'\n\t' # So once you have it, you can save it and then re-use it for instant future decryption using ffmpeg. # This gets it from my password manager -gettoken Keys/AUDIBLE_ACTIVATION_BYTES +export AUDIBLE_ACTIVATION_BYTES=$(pass show Keys/AUDIBLE_ACTIVATION_BYTES) + for i in *.aax; do m4a_file="${i%%.*}.m4a" if [ ! -e "$m4a_file" ]; then - ffmpeg -loglevel panic -y -activation_bytes ${AUDIBLE_ACTIVATION_BYTES} -i "$i" -c:a copy -vn "$m4a_file" + ffmpeg -loglevel panic -y -activation_bytes ${AUDIBLE_ACTIVATION_BYTES} -i "$i" -c:a copy -movflags +faststart -vn "$m4a_file" + # See https://github.com/captn3m0/Scripts/blob/master/fix-audible-m4a for this script + # Dependencies are: bento4 (https://aur.archlinux.org/packages/bento4/) + # bash, and sed fix-audible-m4a "$m4a_file" fi done \ No newline at end of file diff --git a/fix-audible-m4a b/fix-audible-m4a index 3af209a..b815f6b 100755 --- a/fix-audible-m4a +++ b/fix-audible-m4a @@ -12,7 +12,6 @@ mp4extract-bento4 moov/trak/mdia/minf/stbl/stsd/mp4a/esds \ magic=$(sed -re 's/^.*0580808002(....).*$/\1/' $t) if [ "$magic" != "1212" ]; then - echo "no need to fix" rm "$t" exit 0 fi diff --git a/split-audio-by-chapters b/split-audio-by-chapters index e474ac9..11499e2 100755 --- a/split-audio-by-chapters +++ b/split-audio-by-chapters @@ -55,7 +55,9 @@ while read -r first _ _ start _ end; do # -vn = no video stream # -metadata title= put in a chapter title # -acodec copy = copy the audio stream + # +faststart = Relocating this moov atom to the beginning of the file can facilitate playback before the file is completely downloaded by the client. ffmpeg -hide_banner -loglevel panic \ + -movflags +faststart \ -vsync 2 -sn -dn -vn -i "$1" -ss "${start%?}" -to "$end" -metadata title="$CHAPTER_TITLE" -dn -vn -sn -acodec copy "$FILENAME"