Les tags MP3, IDtag, ID3v2, etc.

LIGNE DE COMMANDES

lire les tags

ffprobe (qui vient de ffmpeg) ou avprobe.

sudo apt-get install ffmpeg
ffprobe file.mp3

Pour ne pas avoir d'autres infos (duréee, etc.), on peut combiner la sortie avec grep:

ffprobe file.mp3 2>&1 | grep -A90 'Metadata:'

Ne sortir que l'auteur :

ffprobe -loglevel error -show_entries format_tags=artist -of default=noprint_wrappers=1:nokey=1 file.mp3

Autres tags en les séparant par une virgule : format_tags=artist,title,album

sudo apt-get install ffmpeg lltag mp3info id3v2 libimage-exiftool-perl libid3-tools id3tool
keyword='du texte'
getTitleFF()   { ffprobe "$1" 2>&1 | sed -E -n 's/^ *title *: (.*)/\1/p'; }
getTitleLL()   { lltag --show-tags title "$1" | sed -nE 's/^  TITLE=(.*)/\1/p'; }
getTitleInfo() { mp3info -p %t "$1"; }
getTitleId3()  { id3v2 -l "$1" | sed -nE 's/^TIT2 \([^)]*\): (.*)/\1/p'; }
getTitleExif() { exiftool -title -b "$1"; }
getTitleId3i() { id3info "$1" | sed -n 's/^=== TIT2 \(.*\): //p'; }
getTitleTool() { id3tool "$1" | sed -n 's|^Song Title:\t||p'; }

for prog in FF LL Eyed Info Id3 Exif Id3i Tool; do
   echo "=== getTitle${prog} ==="
   time \
   for file in *.mp3; do
      if "getTitle${prog}" "$file" | grep -q "$keyword"; then
         echo "$file"
      fi
   done
done

Notes:

ID3v1 -> Title : Artist:

ID3v2 -> TIT2 (Title/songname/content description):

Results (real time):

Program  | Version    | Time / s
---------+------------+-----------
exiftool | 10.25      | 49.5 ± 0.5
lltag    | 0.14.5     | 41   ± 1.0
ffprobe  | 3.1.3-1+b3 | 33   ± 0.5
id3info  | 3.8.3      | 4.2  ± 0.1
id3v2    | 0.1.12     | 2.9  ± 0.1
id3tool  | 1.2a       | 1.7  ± 0.1

Vainqueur : id3tool. id3v2 est aussi rapide, but the getTitleId3 function would need adjustment to also work with ID3v1-tags, which may at worst slow it down by factor 2.

ffmpeg advantage: works with aac/m4a files. I will also suggest searching its FORMAT section, to avoid cases where a stream also has a title etc.:

ffprobe -loglevel error -show_entries format -i "$1" 2>&1 | sed -E -n 's|^TAG:title=(.*)$|\1|p'.

AAC encoded audio stored in a M4A-containter file has non-ID3 metadata and therefore can only be read by ffmpeg and additionally exiftool, out of the selection in my answer.

FLAC : avec ffprobe. Sinon metaflac --list from the flac package.

OGG : vorbiscomment -l from the vorbis-tools package.

sudo apt-get install mp3info
mp3info -p %a file.mp3
%a pour artist

4 different standards of mp3 tags id3v1, id3v2.2(obsolete), id3v2.3, id3v2.4.(v1 and v2 can coexist, but v2.x and v2.y cannot). I believe v2.3 is the most widely used one. According to ibiblio.org/mp3info (See Todo) v2 tags are not supported by mp3info. You might want to look at id3v2 - It can edit/add v2 and display v1 and v2. If you don't like the way it displays the tags you can write a script that runs id3v2 and processes the output appropriately. – S Prasanth Dec 11 '12 at 8:04

Thanks I'm using -R flag with grep to get the specified output.

When you print the track title with %t, it prints it clipped.

You can use eyed3. First, from a terminal, install:

sudo apt-get install eyed3

Then, run:

eyeD3 song.mp3

Combine that with grep to get specific tags in one line.

eyeD3 song.mp3 | grep artist

enlever les images (et metadata) des tags

Les images d'album sont traitées comme du flux vidéo par ffmpeg.

To omit it you can use the -vn or -map options.

exemple :  l'audio n'est pas réencodé (garde la qualité et plus rapide) :

ffmpeg -i tagged.mp3 -vn -codec:a copy -map_metadata -1 out.mp3

idem, mais avec -map au lieu de -vn-map explicitly choose the streams et -map 0:a to only select the audio stream from input 0 (premier et unique flux audio) :

ffmpeg -i tagged.mp3 -map 0:a -codec:a copy -map_metadata -1 out.mp3

-map it is very flexible.

write flac, ogg vorbis and mp3 id3v2 meta data?

ffmpeg -i out.mp3 -metadata title="le titre" -metadata artist="" -metadata album="nom album" -c:a copy out2.mp3

article complet : http://jonhall.info/how_to/create_id3_tags_using_ffmpeg

Fonctionne en UTF8 et cractères spéciaux.

---------

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *