Skip to content

Instantly share code, notes, and snippets.

@alza-bitz
Last active March 11, 2018 00:35
Show Gist options
  • Save alza-bitz/8f609e605001b9564e5e5be3adfcfb4e to your computer and use it in GitHub Desktop.
Save alza-bitz/8f609e605001b9564e5e5be3adfcfb4e to your computer and use it in GitHub Desktop.
Analysis of Music Files
#!/bin/sh
# This script will create a Collection.csv file with the following format:
# "/path/to/music/file",type,rate,duration,bitrate
# Note: ffmpeg needs to be installed (for ffprobe command)
# 1. number of files of each type (mp3 160, 192, vbr, 320; aac 192, 256)
# 2. average duration of tracks (of files of each type)
# 3. from 1. and 2. and using http://www.theaudioarchive.com/TAA_Resources_File_Size.htm
# can derive estimated size of collection in different formats, e.g. 320kbps mp3, or flac
# See https://trac.ffmpeg.org/wiki/FFprobeTips for streams to show
find /path/to/your/music/collection -type f \( -iname '*.mp3' -o -iname '*.m4a' -o -iname '*.flac' \) -printf '"%p",' -exec \
ffprobe -v quiet -select_streams a:0 -show_entries stream=codec_name,codec_time_base,duration,bit_rate -of csv=p=0 {} \; > Collection.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment