Skip to content

Instantly share code, notes, and snippets.

@Justin-ZS
Last active December 28, 2020 14:39
Show Gist options
  • Save Justin-ZS/9f79e62a08196425eb6e718a52b46a9f to your computer and use it in GitHub Desktop.
Save Justin-ZS/9f79e62a08196425eb6e718a52b46a9f to your computer and use it in GitHub Desktop.
[bilibili] Recover mp4 from audio.m4s and video.m4s
#!/bin/zsh
output_dir="videos"
if [[ ! -e "$output_dir" ]]; then
mkdir "$output_dir"
fi
for i in */*; do
if [[ -d $i ]]; then
idx=${i%/*}
if [[ ${#idx} -eq 1 ]]; then
idx="0${i%/*}" # 1 -> 01
fi
output_file="$output_dir/$idx.mp4"
# echo "$output_file"
ffmpeg -i "$i/audio.m4s" -i "$i/video.m4s" -c copy "$output_file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment