Author Topic: Get track length and write to TLEN ID3 tag  (Read 1272 times)

thecomfychair

  • Newbie
  • *
  • Posts: 9
I would like all my audio files to have their length embedded into their ID3 tags. ID3 V2 has the TLEN field for this purpose, but it's often not populated by encoders.
Is it possible for MusicBee to take the calculated track length in milliseconds and write it to the TLEN tag?

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34344
You cant do that directly in MusicBee but you might be able to it with the Advanced Tag Tools plugin

thecomfychair

  • Newbie
  • *
  • Posts: 9
Advanced Tag Tools gets 90% of the way, except the time is in mm:ss instead of milliseconds.

Do you know if it's possible to add a function to process the value of a tag? That way I could convert it with some simple multiplication and addition.

For anyone wanting to know how I got this far:
1. Create a new custom tag for Length in the Tags(1) tab in Preferences, making sure it is of type "Length"
2. Install the Additional Tagging and Reporting Tools plugin
3. Right-click on the track you want to add the tag to, and go to Additional Tagging Tools > Copy Tag...
4. Set 'Copy tag Time to tag Length', and check that the New Tag Value in the preview window contains a time value
5. Click 'Proceed'

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
...the time is in mm:ss instead of milliseconds.
Do you know if it's possible to add a function to process the value of a tag?
$Mul($Add($Mul($Split(<Time>,:,1),60),$Split(<Time>,:,2)),1000)

Does that formula give you expected results? (when using it in a virtual tag)
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack

thecomfychair

  • Newbie
  • *
  • Posts: 9
Quote
$Mul($Add($Mul($Split(<Time>,:,1),60),$Split(<Time>,:,2)),1000)

This worked perfectly, thank you very much!

For anyone else who wants to recreate the entire process:
1. Create a new custom tag called 'Length' in the Tags(1) tab in Preferences, making sure it is of type "Length"
2. Create a new virtual tag called "Time ms" and add the above formula. In the Main Player 'Tracks' view, the results can be verified by adding a new column for the 'Time ms' tag. A track that is 6:15 long gives the value 375000, which is correct.
2. Install the Additional Tagging and Reporting Tools plugin
3. Select the track(s) you want to add the tag to. Right-click and go to Additional Tagging Tools > Copy Tag...
4. Set 'Copy tag Time ms to tag Length', and check that the New Tag Value in the preview window contains the track length in milliseconds.
5. Click 'Proceed'. The new Length tag is now written to the ID3 TLEN field.

You can verify that the process has worked by right-clicking a track, then going to Edit>Tag Inspector and finding the TLEN tag code.

Beat

  • Newbie
  • *
  • Posts: 1
Hi , I just tried to execute the procedure from @thecomfychair.
All works and I created the Time ms successfully and installed the plugin.

However somehow MusicBee does not have any tag Length or TLEN, I get an error as invalid naming template.

What is the problem?
Thanks, Beat

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
For anyone else who wants to recreate the entire process:
1. Create a new custom tag called 'Length' in the Tags(1) tab in Preferences, making sure it is of type "Length"
That's step 1 of the guide.
How to create a custom tag
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack