Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
0
answers
153
views
Failing to extract image from MP3
I have MP3 files with ID3 images of type "Other". I have tried a variety of methods to extract the images, including the suggestions at https://unix.stackexchange.com/q/41287/34677 To whit: ``` $ exiftool -a -u -g1 33-Kesh_Jig.mp3 $ ffmpeg -i 33-Kesh_Jig.mp3 qwert.png $ eyeD3 --write-images=. 33-Kes...
I have MP3 files with ID3 images of type "Other". I have tried a variety of methods to extract the images, including the suggestions at https://unix.stackexchange.com/q/41287/34677 To whit:
$ exiftool -a -u -g1 33-Kesh_Jig.mp3
$ ffmpeg -i 33-Kesh_Jig.mp3 qwert.png
$ eyeD3 --write-images=. 33-Kesh_Jig.mp3
$ eyeD3 --write-images=/tmp 33-Kesh_Jig.mp3
$ eyeD3 --write-images=tmp 33-Kesh_Jig.mp3
$ ffmpeg -i 33-Kesh_Jig.mp3 -an -c:v copy file.jpg
$ ffmpeg -i 33-Kesh_Jig.mp3 -an -c:v copy file.png
$ exiftool -a -G4 "-picture*" 33-Kesh_Jig.mp3
$ exiftool -picture -b 33-Kesh_Jig.mp3 > other.png
$ eog other.png
$ most other.png
$ exiftool -W %d%f_%t%-c.%s -b -preview:all DIR
$ exiftool -W %d%f_%t%-c.%s -b -preview:all /tmp
$ exiftool -W %d%f_%t%-c.%s -b -preview:all /tmp 33-Kesh_Jig.mp3
$ most 33-Kesh_Jig_Picture.dat
(most
is simply a pager that automatically detects binary data and displays it in a hex dump format.)
Either I get no file at all, or I get a file which contains IHDR
and Adobe XMP text strngs in it. When the file is played with VLC, the image shows up correctly. So it does not appear to be corrupt.
ffprobe
has an error Unknown attached picture mimetype: , skipping.
but exiftool -a -u -g1 33-Kesh_Jig.mp3
reports:
Picture MIME Type :
Picture Type : Other
Picture Description : ‰PNG. .
Picture : (Binary data 707734 bytes, use -b option to extract)
Ubuntourist
(191 rep)
May 28, 2024, 05:41 PM
4
votes
2
answers
2508
views
Copy FLAC tags to MP3 files?
I have a number of FLAC files that I'm converting into MP3 files with the following: flac -cd file.flac | lame ... - file.mp3 Is there a utility which will copy Vorbis (FLAC and OGG) metadata, convert it to appropriate ID3 tags, and tag an MP3 with the same tags as the FLAC file?
I have a number of FLAC files that I'm converting into MP3 files with the following:
flac -cd file.flac | lame ... - file.mp3
Is there a utility which will copy Vorbis (FLAC and OGG) metadata, convert it to appropriate ID3 tags, and tag an MP3 with the same tags as the FLAC file?
Naftuli Kay
(41346 rep)
Jan 2, 2015, 04:14 AM
• Last activity: Feb 28, 2023, 03:15 PM
10
votes
4
answers
3785
views
Mass .flac --> .mp3 transcoding: How to write a shell script that preserves ID3 tag information?
In recent weeks I've gone from a fairly 'hands-on' approach to .flac --> .mp3 transcoding, to one that's far more 'set & forget'. The first step was to stop using a GUI front end (Audacity with a LAME plug-in) and instead use the method I outlined [here][1]. The second step was to find a bash shell...
In recent weeks I've gone from a fairly 'hands-on' approach to .flac --> .mp3 transcoding, to one that's far more 'set & forget'.
The first step was to stop using a GUI front end (Audacity with a LAME plug-in) and instead use the method I outlined here .
The second step was to find a bash shell script that would tell that command loop to work recursively, allowing directories with many subdirectories containing .flac files to be transcoded in one simple step. That answer was provided by a user at askubuntu.com.
Now I wish to learn how to further refine things so that ID3 tag information is preserved. The methods linked to above strip ID3 tag data, leaving the bare minimum (i.e. only the title field remains).
Can anyone teach me how to write such a shell script?
***
The shell script has been updated thus:
#!/bin/bash
file="$1"
flac -cd "$file" | lame --preset fast extreme - "${file%.flac}.mp3"
id3cp "$file" "${file%.flac}.mp3"
Doing
find . -name '*.flac' -exec ~/bin/flac2mp3 '{}' \;
in ~/Desktop/stack gives the following output:
01 - Amon Tobin - Chomp Samba.flac: done
LAME 3.98.4 64bits (http://www.mp3dev.org/)
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding to ./01 - Amon Tobin - Chomp Samba.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III VBR(q=0)
Parsing ./01 - Amon Tobin - Chomp Samba.flac: done. Copying to ./01 - Amon Tobin - Chomp Samba.mp3: done
id3info
for the original .flac and resultant .mp3 gives, respectively:
*** Tag information for 01 - Amon Tobin - Chomp Samba.flac
(i.e. nothing);
*** Tag information for 01 - Amon Tobin - Chomp Samba.mp3
*** mp3 info
MPEG1/layer III
Bitrate: 128KBps
Frequency: 44KHz
The .flac definitely has tag information. I can verify this by opening up EasyTAG. EasyTAG refers to this as 'FLAC Vorbis Tag' but 'ID3 Tag' for the .mp3. Is this the problem?
boehj
(2660 rep)
Mar 27, 2011, 11:39 AM
• Last activity: Nov 12, 2022, 08:58 PM
34
votes
5
answers
29078
views
How can I *completely* wipe an MP3's metadata?
I'm using "beets" to organize my mp3s. One album I bought from Amazon as mp3s is incorrectly marked as NOT a compilation when indeed it IS a compilation. I organize my files differently based on whether or not an album is a compilation. No matter what I attempt to do to these mp3s, the changes I app...
I'm using "beets" to organize my mp3s. One album I bought from Amazon as mp3s is incorrectly marked as NOT a compilation when indeed it IS a compilation. I organize my files differently based on whether or not an album is a compilation. No matter what I attempt to do to these mp3s, the changes I apply to the ID3 tags do not stick.
For example:
mp3info -d ../amazon_album/* # This WIPES the tags
mp3info ../amazon_album/01-01 - Track 1.mp3
../amazon_album/01-01 - Track 1.mp3 does not have an ID3 1.x tag.
But then when I open the file in any media player, ALL of the information is still there!
So then I tried:
mp3info -a "LOL" ../amazon_album/*
mp3info ../amazon_album/01-01 - Track 1.mp3
File: ../amazon_album/01-01 - Track 1.mp3
Title: Track:
Artist: LOL
Album: Year:
Comment: Genre:
Yet, in any media player, it still retains all of the original information. Because of this, I'm not able to change the album to a "Compilation" which means I can't organize it in Beets the way I want.
I've confirmed that it's not a file permissions issue. Am I doing something wrong? Is there another way to accomplish this in Linux? Or is there a way I can "trick" beets into treating it as a compilation (so that it uses my compilation path)?
CptSupermrkt
(1512 rep)
Dec 15, 2013, 08:47 AM
• Last activity: Jan 31, 2022, 12:44 PM
18
votes
4
answers
19121
views
command line tool to remove selected tags from mp3 files
Using [MP3 Diags](http://mp3diags.sourceforge.net/) to clean up my mp3 collection, I've discovered that in addition to the ID3v2 tag, some files also have a Lyrics3, ID3v1, and some an APE tag. Are there command line tools out there to remove all but the ID3v2 tag?
Using [MP3 Diags](http://mp3diags.sourceforge.net/) to clean up my mp3 collection, I've discovered that in addition to the ID3v2 tag, some files also have a Lyrics3, ID3v1, and some an APE tag. Are there command line tools out there to remove all but the ID3v2 tag?
mrtasktat
(281 rep)
May 22, 2012, 09:38 PM
• Last activity: Mar 19, 2021, 04:42 AM
4
votes
3
answers
6320
views
Encoding of a zip file
When I extract some file (mp3) with japanese or korean characters within its filename on Windows, they appear normally, but when I extract it on Linux (Ubuntu/Mint) they appear as something like this 5thƒAƒ‹ƒoƒ€w1“x “¡“c–ƒˆßŽq 03 ‘²‹Æ ????? The question is: 1. How to fix those al...
When I extract some file (mp3) with japanese or korean characters within its filename on Windows, they appear normally, but when I extract it on Linux (Ubuntu/Mint) they appear as something like this
5thƒAƒ‹ƒoƒ€w1“x
“¡“c–ƒˆßŽq
03 ‘²‹Æ
?????
The question is:
1. How to fix those already extracted files?
2. How to fix the id3 tags also when I don't know what's the correct text/characters?
3. How to make extraction defaults as Windows' character encoding?
Kokizzu
(10481 rep)
Apr 3, 2013, 05:59 AM
• Last activity: Oct 11, 2020, 04:51 PM
1
votes
1
answers
1546
views
ffmpeg not copying FRONT_COVER image metadata during conversion
When doing an mp3 → mp3 (or flac → mp3) conversion, `-map_metadata` can be used to copy metadata from the input file to the output file: ```bash ffmpeg -hide_banner -loglevel warning -nostats -i "${source}" -map_metadata 0 -vn -ar 44100 -b:a 256k -f mp3 "${target}" ``` However, when I use this, I no...
When doing an mp3 → mp3 (or flac → mp3) conversion,
-map_metadata
can be used to copy metadata from the input file to the output file:
ffmpeg -hide_banner -loglevel warning -nostats -i "${source}" -map_metadata 0 -vn -ar 44100 -b:a 256k -f mp3 "${target}"
However, when I use this, I notice that it doesn't copy all the metadata correctly. Using the tool [eyeD3
](https://eyed3.readthedocs.io/en/latest/) , I inspecting the input and output files see this:
$ eyeD3 input.mp3
input.mp3 [ 4.15 MB ]
--------------------------------------------------------------------------------
Time: 01:46 MPEG1, Layer III [ 320 kb/s @ 44100 Hz - Stereo ]
--------------------------------------------------------------------------------
ID3 v2.3:
title: Track title
artist: Artist Name
album: Album Name
album artist: Various Artists
composer: Composer Name
recording date: 2019
eyed3.id3:WARNING: Non standard genre name: Soundtracks
track: 17/37 genre: Soundtracks (id None)
disc: 1/1
FRONT_COVER Image: [Size: 86555 bytes] [Type: image/jpeg]
Description:
PRIV: [Data: 42 bytes]
Owner Id: Google/StoreId
PRIV: [Data: 40 bytes]
Owner Id: Google/StoreLabelCode
--------------------------------------------------------------------------------
$ eyeD3 path/to/output.mp3
/tmp/test.mp3 [ 3.26 MB ]
--------------------------------------------------------------------------------
Time: 01:46 MPEG1, Layer III [ 256 kb/s @ 44100 Hz - Stereo ]
--------------------------------------------------------------------------------
ID3 v2.4:
title: Track title
artist: Artist Name
album: Album Name
album artist: Various Artists
composer: Composer Name
recording date: 2019
eyed3.id3:WARNING: Non standard genre name: Soundtracks
track: 17/37 genre: Soundtracks (id None)
disc: 1/1
PRIV: [Data: 40 bytes]
Owner Id: Google/StoreLabelCode
PRIV: [Data: 42 bytes]
Owner Id: Google/StoreId
--------------------------------------------------------------------------------
Specifically, it's not copying the FRONT_COVER
image correctly - somehow it's being dropped along the way.
**How can I ensure that the FRONT_COVER Image
is copied during the conversion process?**
starbeamrainbowlabs
(317 rep)
Aug 16, 2020, 12:03 PM
• Last activity: Aug 16, 2020, 05:38 PM
0
votes
1
answers
336
views
mid3v2 Error on Attempt to Set Picture Tag
When trying to set picture tag for MP3 file using mid3v2, I get the following error message: mid3v2 [OPTION] [FILE]... mid3v2: error: no such option: --picture Yet, the documentation states this is a valid option. Any ideas on what the problem may be? I'm using mid3v2 1.3 which uses Mutagen 1.31. Th...
When trying to set picture tag for MP3 file using mid3v2, I get the following error message:
mid3v2 [OPTION] [FILE]...
mid3v2: error: no such option: --picture
Yet, the documentation states this is a valid option. Any ideas on what the problem may be?
I'm using mid3v2 1.3 which uses Mutagen 1.31. The command is:
mid3v2 --song "Song Title" --album "Album Name" --year "2020" --artist "Artist Name" --track "1" --picture "/images/106.jpg" "/mnt/cifs/Radio Programming/Programs/pp212.mp3"
If I leave out the --picture option, tag gets written.
Regards,
Anthony
user5919866
(3 rep)
Jul 1, 2020, 03:36 PM
• Last activity: Jul 28, 2020, 01:38 PM
3
votes
1
answers
239
views
abcde writes wrong play times to MP3 files
I don't know any solution to my problem. I don't even know the cause and have a hard time trying to find it. I am ripping my Audio CDs using abcde, which is, basically, working well. It is configured to create both FLAC and MP3 output files as I want to have a lossless archive of my CDs in case they...
I don't know any solution to my problem. I don't even know the cause and have a hard time trying to find it.
I am ripping my Audio CDs using abcde, which is, basically, working well. It is configured to create both FLAC and MP3 output files as I want to have a lossless archive of my CDs in case they get damaged or lost. The MP3 files are for daily use.
Now to the problem: While the FLAC files get the correct play times written in their metadata, all of my MP3 files get wrong durations written in their tags.
Here is an example exiftool reading (while it's basically for image files, it works with pretty much metadata formats, and yes, ID3 tag readers show the same results):
$ exiftool -Duration *
======== 01 - Rock or Bust.flac
Duration : 0:03:03
======== 01 - Rock or Bust.mp3
Duration : 0:25:02 (approx)
======== 02 - Play Ball.flac
Duration : 0:02:47
======== 02 - Play Ball.mp3
Duration : 0:02:15 (approx)
======== 03 - Rock the Blues Away.flac
Duration : 0:03:24
======== 03 - Rock the Blues Away.mp3
Duration : 0:02:45 (approx)
======== 04 - Miss Adventure.flac
Duration : 0:02:57
======== 04 - Miss Adventure.mp3
Duration : 0:23:18 (approx)
======== 05 - Dogs of War.flac
Duration : 0:03:35
======== 05 - Dogs of War.mp3
Duration : 0:29:40 (approx)
======== 06 - Got Some Rock & Roll Thunder.flac
Duration : 0:03:22
======== 06 - Got Some Rock & Roll Thunder.mp3
Duration : 0:02:42 (approx)
======== 07 - Hard Times.flac
Duration : 0:02:44
======== 07 - Hard Times.mp3
Duration : 0:02:14 (approx)
======== 08 - Baptism by Fire.flac
Duration : 0:03:30
======== 08 - Baptism by Fire.mp3
Duration : 0:27:25 (approx)
======== 09 - Rock the House.flac
Duration : 0:02:42
======== 09 - Rock the House.mp3
Duration : 0:02:44 (approx)
======== 10 - Sweet Candy.flac
Duration : 0:03:09
======== 10 - Sweet Candy.mp3
Duration : 0:25:18 (approx)
======== 11 - Emission Control.flac
Duration : 0:03:41
======== 11 - Emission Control.mp3
Duration : 0:30:57 (approx)
22 image files read
I just don't get the clue, why this is happening. Does anyone know a solution to this?
**Solution**
Thanks to Phreds hint on missing VBR headers, I discovered the reason for this to happen.
As it turns out, lame's
--nogap
option was activated in .abcde.conf. It's mentioned neither in the lame manpage nor in the .abcde.conf
comments (my version, at least), that enabling this option disables the Xing header. In the abcde manpage, however, this behaviour is mentioned regarding the -g
flag.
Corresponding variable in .abcde.conf
is NOGAP
WolleTD
(133 rep)
Dec 24, 2014, 01:39 PM
• Last activity: Apr 5, 2019, 11:36 PM
2
votes
3
answers
3128
views
What libraries are there for reading/editing ID3s of mp3?
I need a library to allow me to read and edit ID3 Tags from C++ in Linux. Suggestions?
I need a library to allow me to read and edit ID3 Tags
from C++ in Linux. Suggestions?
HandyGandy
(2239 rep)
Oct 2, 2010, 12:30 AM
• Last activity: Feb 18, 2019, 08:50 PM
1
votes
1
answers
247
views
Bad ID3 tags when transferring mp3 to another device
I created mp3 files in Linux with the `mp3wrap` application and then I applied ID3 tags on it as follows: $ for i in *.mp3; do mp3info -t ${i%.*} -l yes1 -a yes $i; done When I look at a particular mp3 file (e.g. ddi.mp3) it looks as follows: $ mp3info ddi.mp3 File: ddi.mp3 Title: ddi Track: Artist:...
I created mp3 files in Linux with the
mp3wrap
application and then I applied ID3 tags on it as follows:
$ for i in *.mp3; do mp3info -t ${i%.*} -l yes1 -a yes $i; done
When I look at a particular mp3 file (e.g. ddi.mp3) it looks as follows:
$ mp3info ddi.mp3
File: ddi.mp3
Title: ddi Track:
Artist: yes
Album: yes1 Year:
Comment: Genre:
I copied the mp3 files on my Android device. There is no audio player app showing correctly and sorting according to my ID3 tags.
It shows instead title File wrapped with Mp3Wrap
and artist/album
http://mp3splt.sourceforge.net
Is it possible to correct this ID3 information and enforce the correct ID3 tags?
xralf
(15189 rep)
Jun 15, 2015, 05:44 PM
• Last activity: Sep 20, 2018, 05:17 PM
3
votes
1
answers
6637
views
Scripting id3 tags with id3v2 and sed
I am trying to write a script to automatically add track and title info to an mp3 file's id3 tag. At this point, I have sed grabbing the info from the filename and formatting it to fit the id3v2 command, but upon hitting a multi-word title, I get the error `Couldn't stat file ' '`. If I just echo th...
I am trying to write a script to automatically add track and title info to an mp3 file's id3 tag.
At this point, I have sed grabbing the info from the filename and formatting it to fit the id3v2 command, but upon hitting a multi-word title, I get the error
Couldn't stat file ''
. If I just echo the id3v2 command that is being run, I see the command in this format:
id3v2 -t Title\ Of\ Track -T 1 1_-_Title_Of_Track.mp3
Copy/pasting that text into the terminal executes tagging properly, but of course lacks the intended automation of scripting. So here's what the script intending to automate the process looks like:
#!/bin/bash
for track in *.mp3 ; do
id3v2 $(echo ${track} | sed -e 's/^\([1-9][0-9]*\)_-_\(.*\).mp3/-t \2 -T \1/' -e 's/_/\\ /g') ${track}
done
Any insight as to why the title is treated as a single argument when manually typed but not when scripted?
Christian Gibbons
(344 rep)
Aug 21, 2018, 02:14 PM
• Last activity: Aug 22, 2018, 03:25 AM
5
votes
1
answers
1290
views
Utility for copying ID3v2 tags to ID3v1?
I'm looking for a utility which will copy existing ID3v2 tags to ID3v1 counterparts alongside the original metadata in MP3 files. I have some legacy hardware that I'm not giving up any time soon and it is incompatible with ID3v2, so I need both kinds of tags present in my files to keep everyone happ...
I'm looking for a utility which will copy existing ID3v2 tags to ID3v1 counterparts alongside the original metadata in MP3 files.
I have some legacy hardware that I'm not giving up any time soon and it is incompatible with ID3v2, so I need both kinds of tags present in my files to keep everyone happy. I've been using EasyTAG which can create both tags in its files, but I'm looking for a way to run files through a script to automate the process.
I've been using Python's Mutagen library, but it only supports ID3v2.
Naftuli Kay
(41346 rep)
Sep 2, 2015, 08:43 PM
• Last activity: Sep 20, 2017, 04:20 PM
3
votes
0
answers
1818
views
How to rename file and folder of mp3 based on ID3 tag
How to rename music files based on ID3 tag with format: `number. title` where the number doesn't exists on the id3tag but exists on the file name? And how to rename folders based on ID3 tag with format `artist - album`? I've tried [id3ren][1] but it gives underscore output for non-ascii characters....
How to rename music files based on ID3 tag with format:
number. title
where the number doesn't exists on the id3tag but exists on the file name?
And how to rename folders based on ID3 tag with format artist - album
?
I've tried id3ren but it gives underscore output for non-ascii characters.
Example input:
???? ????/01. ????.mp3
???? ????/02. ???????.mp3
Example output:
[Artist] - [Album]/01. [Title].mp3
[Artist] - [Album]/02. [Title].mp3
Where the [label]
are from ID3 tag
Kokizzu
(10481 rep)
Mar 10, 2015, 01:48 AM
• Last activity: Mar 10, 2015, 01:54 AM
7
votes
1
answers
2685
views
Mass ID3 tag editor like vorbistagedit?
My favorite tool for batch editing of vorbis comments is vorbistagedit. I can do `vorbistagedit *.ogg` and it lets me edit the metadata in all my ogg files at once in my favorite editor (emacs). I'm wondering if there is a tool that works in a similar fashion for id3 tags? I could see it opening up...
My favorite tool for batch editing of vorbis comments is vorbistagedit. I can do
vorbistagedit *.ogg
and it lets me edit the metadata in all my ogg files at once in my favorite editor (emacs).
I'm wondering if there is a tool that works in a similar fashion for id3 tags?
I could see it opening up a file that looked something like:
: file1.mp3
+ file1.mp3
TIT2=Title
TPE1=Artist
TALB=Album
: file2.mp3
+ file3.mp3
...
And I could add/edit tags as I see fit, and when I close out the $EDITOR, it writes the tags back to the files.
It wouldn't have to work exactly like that, but I think that would be my ideal. Anything would be easier than a bunch of BASH for
loops with id3v2
.
If nothing like it exists, I might end up writing my own that uses the eyeD3 library.
And please don't bother suggesting EasyTag. It's a great program, but I'm looking for something that doesn't require a GUI.
**P.S.** For those who don't want to bother reading the comments below, I simply modified vorbistagedit to support id3 tags in mp3 files. The modified script can be found on [GitHub](https://github.com/goodevilgenius/tagedit) .
Dan Jones
(253 rep)
Dec 13, 2012, 01:40 AM
• Last activity: Dec 26, 2014, 12:13 AM
5
votes
1
answers
1602
views
Replace CD number in MP3 ID3 tag
I have a library of MP3 files where in some files the "CD number" tag (TPOS) contains "CDx" values, e.g. "CD1" or "CD2". The ID3 spec says that TPOS values shall be numerical strings. Processing these files breaks some tag editors, specifically eyeD3 ignores the values. What would be a smart way to...
I have a library of MP3 files where in some files the "CD number" tag (TPOS) contains "CDx" values, e.g. "CD1" or "CD2". The ID3 spec says that TPOS values shall be numerical strings. Processing these files breaks some tag editors, specifically eyeD3 ignores the values.
What would be a smart way to replace these ID3 tags with numeric strings, via command line?
I have a solution which comes with some command line magic, I am looking for something simpler:
find . -name "*.mp3" -exec id3v2 -R {} \; |awk -F": " '/^Filename/ {f=$2};/^TPOS/ {print f, "\t", $2}'|grep CD1|awk -F" \t" '{print $1}'|xargs -L 1 -d "\n" -I{} id3v2 --TPOS "1" {}
In a nutshell: find mp3 files, extract the ID3 tags with id3v2, extract filename and TPOS with awk, grep for "CD1", cut out the filename and apply id3v2 to set the disc number to "1".
Bernd
(163 rep)
Dec 19, 2013, 09:59 PM
• Last activity: Dec 20, 2013, 05:04 PM
Showing page 1 of 16 total questions