Skip to content

Instantly share code, notes, and snippets.

@evmn
Created July 13, 2020 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evmn/716e0423cc993735998c53c46b331a91 to your computer and use it in GitHub Desktop.
Save evmn/716e0423cc993735998c53c46b331a91 to your computer and use it in GitHub Desktop.
mp3 files that will be used in Openshot
#!/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