mirror of https://github.com/captn3m0/Scripts.git
Make sure MP4 files are stream-able
This commit is contained in:
parent
56bf33f531
commit
ffaca3fbbb
|
@ -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.
|
# 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
|
# 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
|
for i in *.aax; do
|
||||||
m4a_file="${i%%.*}.m4a"
|
m4a_file="${i%%.*}.m4a"
|
||||||
if [ ! -e "$m4a_file" ]; then
|
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"
|
fix-audible-m4a "$m4a_file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
|
@ -12,7 +12,6 @@ mp4extract-bento4 moov/trak/mdia/minf/stbl/stsd/mp4a/esds \
|
||||||
magic=$(sed -re 's/^.*0580808002(....).*$/\1/' $t)
|
magic=$(sed -re 's/^.*0580808002(....).*$/\1/' $t)
|
||||||
|
|
||||||
if [ "$magic" != "1212" ]; then
|
if [ "$magic" != "1212" ]; then
|
||||||
echo "no need to fix"
|
|
||||||
rm "$t"
|
rm "$t"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -55,7 +55,9 @@ while read -r first _ _ start _ end; do
|
||||||
# -vn = no video stream
|
# -vn = no video stream
|
||||||
# -metadata title= put in a chapter title
|
# -metadata title= put in a chapter title
|
||||||
# -acodec copy = copy the audio stream
|
# -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 \
|
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" </dev/null
|
-vsync 2 -sn -dn -vn -i "$1" -ss "${start%?}" -to "$end" -metadata title="$CHAPTER_TITLE" -dn -vn -sn -acodec copy "$FILENAME" </dev/null
|
||||||
|
|
||||||
((CHAPTER_INDEX++))
|
((CHAPTER_INDEX++))
|
||||||
|
|
Loading…
Reference in New Issue