Page 1 of 2
Add ID3 tags to LAME encoding for downsampling
Posted:
Mon May 10, 2010 2:37 pm
by aplus01
The LAME encoder removes ID3 tags when it encodes them.
Can you add the switches necessary to add Track Title, Track Artist, and Track Album to the LAME encoder downsample command?
Found the switches to use on the sourceforge page for LAME:
ID3 tagging:
--tt <title> audio/song title (max 30 chars for version 1 tag)
--ta <artist> audio/song artist (max 30 chars for version 1 tag)
--tl <album> audio/song album (max 30 chars for version 1 tag)
--add-id3v2 force addition of version 2 tag
If I override the downsample command with this: (corrected ID3 tag switches)
lame --add-id3v2 --tt "Track Title" --ta "Track Artist" --tl "Track Album" -S -h -b %b %s -
Then I can see the dummy data in my media player.
Thanks!
Posted:
Mon May 10, 2010 4:19 pm
by sindre_mehus
Thanks for the excellent suggestion! I've added it to my list of things to do (which unfortunately is very long...)
Cheers,
Sindre
Posted:
Mon May 10, 2010 4:44 pm
by aplus01
Excellent! Looking forward to the next release!
Does this work?
Posted:
Mon May 17, 2010 2:55 pm
by dan_i
Okay, working off your earlier post, I _think_ if you go into Settings -> Advanced, and use this as your downsample command:
lame --add-id3v2 -tt %t -ta %a -tl "Track Album" -S -h -b %b %s -
Then it works like you (and I) want. It just uses "%t" and "%a" to pull the title and artist, respectively. Unless I'm crazy (entirely possible), it's working for me.
The one thing it doesn't cover is the album name. I wouldn't be shocked if using "%l" works to pull that, but I don't know (and haven't tested, b/c I really only pay attention to the artist and title).
huh
Posted:
Mon May 17, 2010 3:04 pm
by dan_i
Well, maybe that isn't working. I've confused myself. I could swear it worked initially, but now that downsample command just fails, and nothing plays. I guess if anyone has any different luck, let me know..
Posted:
Mon May 17, 2010 7:50 pm
by aplus01
It's probably failing because the "-tt" needs to be "--tt". Two dashes. The switches "-ta" and "-tl" also both need double dashes.
Just realized my post suggested using a single dash. Typo on my part. I wasn't able to get it working w/ just single dashes.
I'll try out using %t and %a also.
What version of subsonic are you running? A beta version or the latest release?
Posted:
Mon May 17, 2010 7:54 pm
by aplus01
Just tried out %t and %a and no dice.
It streams fine but the artist is %a and track title is %t. Looks like Sindre will need program in the capacity to plug that info in for us when subsonic downsamples.
@dan_i:
Must have been a trick of the mind when you saw the Track Title & Artist info showing up correctly. (Or maybe you weren't downsampling) I just updated to 4.0.1 (build 1529) and not seeing any of that stuff.
Posted:
Tue May 18, 2010 3:56 am
by dan_i
Yeah, I'm on the newest version... I'm thinking that I borked the downsample code in just the right way, so it just stopped downsampling, but didn't actually break it completely (like I did when I tried other things).
Oh well...
Posted:
Mon May 31, 2010 8:20 am
by sindre_mehus
aplus01 wrote:Just tried out %t and %a and no dice.
It streams fine but the artist is %a and track title is %t. Looks like Sindre will need program in the capacity to plug that info in for us when subsonic downsamples.
Yes, that's correct.
Posted:
Fri Aug 06, 2010 7:47 pm
by makkonen
I took a swing at this. Got a diff attached. It is about the absolute laziest possible solution to the problem I could see.
(No error checking, no nothing. Probably fails inelegantly if there's nothing there when it tries to pull the metadata. But it's working for me so far, for my nice, sanitized files.)
Here's the change, for the file subsonic-main/src/main/java/net/sourceforge/subsonic/service/TranscodingService.java. (Sorry, I'm not too well-versed in submitting patches.)
- Code: Select all
*** TranscodingService.java 2010-08-06 14:04:11.430636532 -0500
--- TranscodingService.java.mod 2010-08-06 14:03:55.266555633 -0500
***************
*** 256,261 ****
--- 256,266 ----
private String[] createCommand(String command, TranscodeScheme transcodeScheme, MusicFile musicFile) {
if (musicFile != null) {
command = command.replace("%s", '"' + musicFile.getFile().getAbsolutePath() + '"');
+ command = command.replace("%a", '"' + musicFile.getMetaData().getArtist() + '"');
+ command = command.replace("%l", '"' + musicFile.getMetaData().getAlbum() + '"');
+ command = command.replace("%t", '"' + musicFile.getMetaData().getTitle() + '"');
+ command = command.replace("%y", '"' + musicFile.getMetaData().getYear().toString() + '"');
+ command = command.replace("%n", '"' + musicFile.getMetaData().getTrackNumber().toString() + '"');
}
// If no transcoding scheme is specified, use 128 Kbps.
In addition to the code change, the downsample (and transcode) commands need updating. My downsample arguments look thus, now:
- Code: Select all
lame -S -h -b %b --add-id3v2 --pad-id3v2 --ta %a --tt %t --tl %l --ty %y --tn %n %s -
Edit: OK, not sure about things with no metadata (haven't had a problem there yet), but if something's got a quotation mark (") in any field, it doesn't get escaped, and lame just fails. Howzat for inelegant?
...Now to teach myself how to modify strings in java.
Posted:
Wed Sep 22, 2010 5:59 pm
by parallax
I'm having the same problem in Winamp, but I find this a bit odd since on the Feature page it says:
"Implements the SHOUTcast protocol. Players which support this (including Winamp, iTunes and XMMS) display the current artist and song, along with other metadata."
Doesn't that mean it should be a feature already?
In any case, hoping to see this patched in soon.
//new subsonic user
Posted:
Thu Nov 25, 2010 10:16 am
by Palmski
Did this issue get fixed in 4.2? I notice this on the changelog:
Bugfix: Set ID3 tags when transcoding.
but I'm still seeing the same problem in Winamp with transcoded m4a files. I'm using the transcoding strings as on the recommended settings page ie
ffmpeg -i %s -f wav - lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -
Posted:
Fri Nov 26, 2010 6:40 pm
by parallax
I just tested right now with 4.2, and it's fixed for me. I use the default transcoding parameters:
step1: ffmpeg -i %s -f wav -
step2: lame -b %b - -
I also use external Winamp as player.
Posted:
Sat Nov 27, 2010 8:40 am
by Palmski
Thanks for the confirmation, I'll have to double check my tagging is correct.
Posted:
Wed Dec 01, 2010 7:51 pm
by aplus01
Its working for MP3 in Winamp if you choose "External Player" but not working correctly if you're running "External player w/ playlist".
Is the way that ID3 tags are being created for the player option "External player" different than they way they are created for players that are "External player with playlist"?
When I set my player (using Winamp, BTW) to be "External player" the tags display correctly.
When I use "External player with playlist" the playlist loads correctly with track info but the currently playing track info is replaced with the stream information as shown in the image below