Last active
June 12, 2020 14:33
-
-
Save ryanfb/6bc0f62c123c5fd9441d6d91db5ba8d8 to your computer and use it in GitHub Desktop.
Set MP3 id3v2 duration from actual MP3 duration
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 | |
for i in *.mp3; do | |
duration=`echo "$(( $(sox "$i" -n stat 2>&1|fgrep 'Length'|cut -d':' -f2|xargs) * 1000 ))"| awk '{printf("%d\n",$0+=$0<0?0:0.9)}'` | |
echo "$i: $duration" | |
id3v2 --TLEN "$duration" "$i" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment