Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 44
  1. #1
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652

    MP3 tag manipulation under pCP

    TL : DR
    I'm looking for a way to manipulate (strip, re-write) the tags in an MP3 file from the command line under pCP.

    Explanation
    I've been developing a shell script that takes an LMS playlist and exports the tracks as individual MP3 files for use in the car. 90% of my library is in the form of 'full album' FLAC files with separate CUE files, or individual FLAC tracks, so writing new MP3 files with my own tags is straightforward (sox -> lame).

    The other 10% is made up of files that I only have in OGG, M4A or MP3. My script has an option to either copy these over unchanged or to transcode them to MP3. For transcoding I'm using sox -> lame for OGG and faad -> lame for M4A, but there's no point in transcoding MP3 to MP3, so these are always copied over unchanged.

    In all the cases where I use lame to create MP3 files I'm writing a consistent set of tags: Title, Artist, Album and a Comment (to store the 'provenance' of the file). But in the cases where an MP3 file is copied over unchanged, it may have a variety of tags included. So for the sake of consistency I'm interested in stripping the existing tags and writing my own new tags.

    If I could use lame to write a new MP3 file without transcoding that would be a good option, but I don't think such an option exists. So I think a command line tagger is what I need, and in particular, one that is available under pCP.

    Does such a tool exist? As a supplementary requirement, I'm hoping that any such tool will also allow me to read the Artist and Album tags from the original file before stripping them out.

  2. #2
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    3,255
    We don't have any taggers in the repo, but if someone has some recommendations, we can evaluate adding.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  3. #3
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    2,523
    I use id3v2 for mp3 tags.

    I haven't added it to the repository so you'll need to install it manually for now.

    Code:
    tc@rpi4:$ ceo
    
    tc@rpi4:/mnt/mmcblk0p2/tce/optional$ wget http://ralph-irving.users.sourceforge.net/pico/pcp-id3v2.tcz
    Connecting to ralph-irving.users.sourceforge.net (216.105.38.10:80)
    pcp-id3v2.tcz        100% 
    
    tc@rpi4:/mnt/mmcblk0p2/tce/optional$ wget http://ralph-irving.users.sourceforge.net/pico/pcp-id3v2.tcz.md5.txt
    Connecting to ralph-irving.users.sourceforge.net (216.105.38.10:80)
    pcp-id3v2.tcz.md5.txt 100% 
    
    tc@rpi4:/mnt/mmcblk0p2/tce/optional$ md5sum -c pcp-id3v2.tcz.md5.txt
    pcp-id3v2.tcz: OK
    
    tc@rpi4:/mnt/mmcblk0p2/tce/optional$ tce-load -i pcp-id3v2

    Code:
    Usage: id3v2 [OPTION]... [FILE]...
    Adds/Modifies/Removes/Views id3v2 tags, modifies/converts/lists id3v1 tags
    
      -h,  --help               Display this help and exit
      -f,  --list-frames        Display all possible frames for id3v2
      -L,  --list-genres        Lists all id3v1 genres
      -v,  --version            Display version information and exit
      -l,  --list               Lists the tag(s) on the file(s)
      -R,  --list-rfc822        Lists using an rfc822-style format for output
      -d,  --delete-v2          Deletes id3v2 tags
      -s,  --delete-v1          Deletes id3v1 tags
      -D,  --delete-all         Deletes both id3v1 and id3v2 tags
      -C,  --convert            Converts id3v1 tag to id3v2
      -1,  --id3v1-only         Writes only id3v1 tag
      -2,  --id3v2-only         Writes only id3v2 tag
      -r,  --remove-frame "FRAMEID"   Removes the specified id3v2 frame
      -a,  --artist       "ARTIST"    Set the artist information
      -A,  --album        "ALBUM"     Set the album title information
      -t,  --song         "SONG"      Set the song title information
      -c,  --comment      "DESCRIPTION":"COMMENT":"LANGUAGE"  
                                Set the comment information (both
                                description and language optional)
      -g,  --genre   num        Set the genre number
      -y,  --year    num        Set the year
      -T,  --track   num/num    Set the track number/(optional) total tracks
    
    You can set the value for any id3v2 frame by using '--' and then frame id
    For example: 
            id3v2 --TIT3 "Monkey!" file.mp3
    would set the "Subtitle/Description" frame to "Monkey!".
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

  4. #4
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by ralphy View Post
    I use id3v2 for mp3 tags.

    I haven't added it to the repository so you'll need to install it manually for now.
    Perfect! Thank you.

  5. #5
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by ralphy View Post
    I use id3v2 for mp3 tags.

    I haven't added it to the repository so you'll need to install it manually for now.
    This is working perfectly in my script now. It needs a little care when reading the existing Artist and Album tags into temporary variables, because the tag names differ between id3v1 and id3v2, but it's nothing that a bit of greping and awking can't solve. And of course, it only works on MP3 files, but I think that's my main use case when making files for the car: everything that isn't an MP3 file gets encoded (FLAC) or transcoded (OGG, M4A), whereas MP3 files get copied over and tidied up.

  6. #6
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    2,523
    Quote Originally Posted by chill View Post
    This is working perfectly in my script now. It needs a little care when reading the existing Artist and Album tags into temporary variables, because the tag names differ between id3v1 and id3v2, but it's nothing that a bit of greping and awking can't solve. And of course, it only works on MP3 files, but I think that's my main use case when making files for the car: everything that isn't an MP3 file gets encoded (FLAC) or transcoded (OGG, M4A), whereas MP3 files get copied over and tidied up.
    That's great! I'll eventually push the extension to our repository.

    I'd like to suggest that you only use/write v2 tags.

    You can strip v1 tags using id3v2 -s *mp3 and force id3v2 to only write v2 tags by adding -2 to the command line.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

  7. #7
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by ralphy View Post
    I'd like to suggest that you only use/write v2 tags.
    Ah good - I very nearly posted a question about which ones to use.

    What's behind your suggestion? I'm aiming for maximum compatibility with in-car players. I think lame defaults to v1, but it's just a simple switch to change that.

  8. #8
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by chill View Post
    I think lame defaults to v1, but it's just a simple switch to change that.
    Well that was the theory. But I haven't been able to find a combination of switches that successfully writes v2 tags to the lame output, such that VLC or id3v2 understand them. So I've resorted to using id3v2 to write the v2 tags to the lame output. So my script does what I want it to, but I'm slightly bugged that I can't get lame to do the v2 tags.

    And I'd still be interested to know why only v2 tags are preferred. Is it because using both v1 and v2 in the same file can cause problems? If so, then since I'm looking for maximum compatibility with in-car players, would 'only v1' avoid the problems of having both types, assuming I can live with the tag length limitations? Is v1 deprecated to the point that newer players may not understand them?

  9. #9
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    2,523
    Quote Originally Posted by chill View Post
    Well that was the theory. But I haven't been able to find a combination of switches that successfully writes v2 tags to the lame output, such that VLC or id3v2 understand them. So I've resorted to using id3v2 to write the v2 tags to the lame output. So my script does what I want it to, but I'm slightly bugged that I can't get lame to do the v2 tags.

    And I'd still be interested to know why only v2 tags are preferred. Is it because using both v1 and v2 in the same file can cause problems? If so, then since I'm looking for maximum compatibility with in-car players, would 'only v1' avoid the problems of having both types, assuming I can live with the tag length limitations? Is v1 deprecated to the point that newer players may not understand them?
    I use --add-id3v2 and the various --tx metadata flags with lame and have never had issues with id3v2 or vlc interpreting them.

    For LMS having both v1 and v2 in the same file can cause strange collation behaviour when browsing local music if the tags are not identical. id3v2 can convert v1 tags to v2 making it easy to have just the later in the file.

    For car players I would expect v1 to be the best choice for maximum compatibility.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

  10. #10
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by ralphy View Post
    I use --add-id3v2 and the various --tx metadata flags with lame and have never had issues with id3v2 or vlc interpreting them.
    Hmm - that's what I tried. I also tried --id3v2-only, but whenever I checked the resulting file with id3v2 and VLC those tags didn't show up. I need to have another go. Are you using the version of lame that's included with pCP?

    Quote Originally Posted by ralphy View Post
    For LMS having both v1 and v2 in the same file can cause strange collation behaviour when browsing local music if the tags are not identical.
    Ah ok - I imagine that could apply to other software as well.

    Quote Originally Posted by ralphy View Post
    For car players I would expect v1 to be the best choice for maximum compatibility.
    I tried some v2-only files in my car, which has a 10-year-old MyGig player, and all the tags were interpreted correctly. I'm optimistic that the next car I buy will have a newer player (or if not, then no MP3 player at all - I do rather fancy a big old V8, before they're legislated off the road. But I digress)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •