Created
July 13, 2020 00:46
-
-
Save evmn/716e0423cc993735998c53c46b331a91 to your computer and use it in GitHub Desktop.
mp3 files that will be used in Openshot
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
#!/bin/bash | |
# Output file will be used in Openshot | |
# Input format: 11-22.33.mp3, means this mp3 start at video time 11 min 22.33 sec | |
# Output as 682.33.mp3 | |
for audio in *.mp3 | |
do | |
min=`echo $audio | cut -d- -f 1` | |
sec=`echo $audio | cut -d- -f 2 | cut -d. -f 1` | |
tai=`echo $audio | cut -d- -f 2 | cut -d. -f 2-` | |
# echo "minute: $min" | |
# echo "second: $sec" | |
# echo $tai | |
total_sec=`expr $min \* 60 + $sec` | |
newname=$(printf "%03d.%s" ${total_sec} ${tai}) | |
printf "%s -> %s\n" $audio $newname | |
mv $audio $newname | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment