checkmate101
checkmate101

Reputation: 99

Get the size of ID3v2 tags for an audio file

ffmpeg is the defacto tool for getting audio information from a file/URL. But I am a bit stumped on how to get the size of the ID3v2 tags for the same.

Example of what information ffmpeg gives when we use ffprobe:

Input #0, mp3, from 'FILENAME':
  Metadata:
    encoder         : Lavf58.29.100
  Duration: 00:04:39.14, start: 0.000000, bitrate: 320 kb/s
    Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 320 kb/s

The metadata values are given but what would be the way to calculate the size of this in bytes?

Upvotes: 1

Views: 510

Answers (2)

PeterCo
PeterCo

Reputation: 961

On windows 10 (and as @AmigoJack added in his comment that it worked perfectly in XP and 7 too), you could use FINDSTR to parse the ouptut on STDERR:

ffprobe -i "FILENAME.EXT" -v debug 2>&1 | findstr /i /b /C:"id3v2"

The used FINDSTR options are:
/i Ignores the case of the characters when searching for the string.
/b Matches the text pattern if it is at the beginning of a line.
If you ommit /b also a private tag "id3v2_priv" with leading spaces would be found
/C Uses the specified text as a literal search string.

Upvotes: 0

Gyan
Gyan

Reputation: 93299

Search the stderr output of ffmpeg -i file.mp3 -v debug for a line of the form

id3v2 ver:4 flags:00 len:137

Upvotes: 2

Related Questions