Add ID3 tags to LAME encoding for downsampling

Got an idea? Missing something? Post your feature request here.

Moderator: moderators

Add ID3 tags to LAME encoding for downsampling

Postby aplus01 » Mon May 10, 2010 2:37 pm

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!
Last edited by aplus01 on Mon May 17, 2010 7:57 pm, edited 1 time in total.
User avatar
aplus01
 
Posts: 14
Joined: Thu Apr 15, 2010 1:52 pm

Postby sindre_mehus » Mon May 10, 2010 4:19 pm

Thanks for the excellent suggestion! I've added it to my list of things to do (which unfortunately is very long...)

Cheers,
Sindre
Subsonic developer
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Postby aplus01 » Mon May 10, 2010 4:44 pm

Excellent! Looking forward to the next release!
User avatar
aplus01
 
Posts: 14
Joined: Thu Apr 15, 2010 1:52 pm

Does this work?

Postby dan_i » Mon May 17, 2010 2:55 pm

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).
dan_i
 
Posts: 13
Joined: Thu Mar 25, 2010 6:36 pm

huh

Postby dan_i » Mon May 17, 2010 3:04 pm

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..
dan_i
 
Posts: 13
Joined: Thu Mar 25, 2010 6:36 pm

Postby aplus01 » Mon May 17, 2010 7:50 pm

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?
Last edited by aplus01 on Mon May 17, 2010 7:56 pm, edited 1 time in total.
User avatar
aplus01
 
Posts: 14
Joined: Thu Apr 15, 2010 1:52 pm

Postby aplus01 » Mon May 17, 2010 7:54 pm

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.
User avatar
aplus01
 
Posts: 14
Joined: Thu Apr 15, 2010 1:52 pm

Postby dan_i » Tue May 18, 2010 3:56 am

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...
dan_i
 
Posts: 13
Joined: Thu Mar 25, 2010 6:36 pm

Postby sindre_mehus » Mon May 31, 2010 8:20 am

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.
Subsonic developer
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Postby makkonen » Fri Aug 06, 2010 7:47 pm

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.
makkonen
 
Posts: 12
Joined: Mon May 03, 2010 5:47 am

Postby parallax » Wed Sep 22, 2010 5:59 pm

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 :)
parallax
 
Posts: 2
Joined: Wed Sep 22, 2010 5:53 pm

Postby Palmski » Thu Nov 25, 2010 10:16 am

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 - -
Palmski
 
Posts: 7
Joined: Fri Jul 09, 2010 8:31 am

Postby parallax » Fri Nov 26, 2010 6:40 pm

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.
parallax
 
Posts: 2
Joined: Wed Sep 22, 2010 5:53 pm

Postby Palmski » Sat Nov 27, 2010 8:40 am

Thanks for the confirmation, I'll have to double check my tagging is correct.
Palmski
 
Posts: 7
Joined: Fri Jul 09, 2010 8:31 am

Postby aplus01 » Wed Dec 01, 2010 7:51 pm

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

Image
User avatar
aplus01
 
Posts: 14
Joined: Thu Apr 15, 2010 1:52 pm

Next

Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 8 guests