robinst / taglib-ruby

Ruby interface for the TagLib C++ library, for reading and writing meta-data (tags) of many audio formats
https://robinst.github.io/taglib-ruby/
MIT License
256 stars 26 forks source link

Copying all tags from one file to another #125

Open brauliobo opened 1 year ago

brauliobo commented 1 year ago

Hi, I would like to copy all tags from an mp3 file to an m4a (aac) file, including private tags and cover embedded images. How to do it in Ruby? I'm already using taglib-ruby at https://github.com/brauliobo/media-downloader-bot

FFMpeg -map_metadata 0 ignore private tags and embedded images.

I've tried exiftool but it also failed:

braulio @ bhavapower ➜  media-downloader-bot git:(main) ✗  exiftool -TagsFromFile in.mp3 -All:All  out.m4a 
Warning: No writable tags set from in.mp3
    0 image files updated
    1 image files unchanged
braulio @ bhavapower ➜  media-downloader-bot git:(main) ✗  exiftool in.mp3
ExifTool Version Number         : 12.60
File Name                       : in.mp3
Directory                       : .
File Size                       : 4.8 MB
File Modification Date/Time     : 2012:07:13 10:59:09-03:00
File Access Date/Time           : 2023:03:04 16:07:03-03:00
File Inode Change Date/Time     : 2023:04:23 10:10:30-03:00
File Permissions                : -rw-------
File Type                       : MP3
File Type Extension             : mp3
MIME Type                       : audio/mpeg
MPEG Audio Version              : 1
Audio Layer                     : 3
Audio Bitrate                   : 128 kbps
Sample Rate                     : 44100
Channel Mode                    : Joint Stereo
MS Stereo                       : On
Intensity Stereo                : Off
Copyright Flag                  : False
Original Media                  : True
Emphasis                        : None
ID3 Size                        : 12416
Picture MIME Type               : image/jpeg
Picture Type                    : Front Cover
Picture Description             : 
Picture                         : (Binary data 8023 bytes, use -b option to extract)
WM Media Class Primary ID       : D1607DBC-E323-4BE2-86A1-48A42A28441E
WM Media Class Secondary ID     : 00000000-0000-0000-0000-000000000000
Genre                           : Kiirtan
Album                           : Sweet Joy
Track                           : 1
Artist                          : Ainjali
Title                           : 
Year                            : 
Comment                         : 
Duration                        : 0:04:56 (approx)
brauliobo commented 1 year ago

I've managed to copy everything with kid3-cli:

kid3-cli -c 'select in.mp3' -c copy -c 'select out.m4a' -c paste -c save