Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
440 stars 60 forks source link

Doesn't work with .mp4 #255

Closed Agagamand closed 4 months ago

Agagamand commented 4 months ago

I'm trying to to add tags to a .mp4 file that contains video and audio. But ATL does not do this.

The file is for example: https://workupload.com/file/ByqP86kr6dk

nlogozzo commented 4 months ago

ATL stands for Audio Tools Library...it supports audio-only files.

nlogozzo commented 4 months ago

Although video files do contain audio, their tag structures are often different than pure audio only files because the videos themselves can also be tagged

Zeugma440 commented 4 months ago

I'm trying to to add tags to a .mp4 file that contains video and audio. But ATL does not do this.

I've just successfuly tried adding an album and a title on your file. What doesn't work exactly?

Although video files do contain audio, their tag structures are often different than pure audio only files because the videos themselves can also be tagged

@nlogozzo ATL should theoretically be able to handle OGG and MP4 videos even though there's none of them on the unit tests. For your information :

Agagamand commented 4 months ago

What doesn't work exactly?

Try this:

            Track inputTrack = new("Нужно прекращять врать.mp4");
            inputTrack.AdditionalFields["REPLAYGAIN_REFERENCE_LOUDNESS"] = $"-23 LUFS";
            inputTrack.AdditionalFields["REPLAYGAIN_ALGORITHM"] = "ITU-R BS.1770";
            inputTrack.Save();

And check the result with MP3Tag.exe

Zeugma440 commented 4 months ago

I confirm that MP3tag doesn't detect it, but MediaInfo and VLC do.

image

image

We're in a very specific domain there. My guess would be that the default namespace written by ATL is not the correct one.

Do you have a file where those fields are set and can be read from MP3Tag?

Agagamand commented 4 months ago

No. But these fields can be set through MP3Tag. What namespace does it use?

I'd also like to to draw attention to the fact that the tags that RSGain writes, MP3Tag sees.

Zeugma440 commented 4 months ago

What namespace does it use?

I wouldn't ask if I knew... and MP3tag isn't exactly a reference when it comes to writing specialized M4A/MP4 tags. I'd rather do tests with Apple apps or specific products such as RSGain.

I'd also like to to draw attention to the fact that the tags that RSGain writes, MP3Tag sees.

The RSGain readme is gigantic. Could you please provide a ready-to-run command line or a tagged file ?

Agagamand commented 4 months ago

rsgain.exe custom --tagmode=i --loudness=-23 --clip-mode=n --album --max-peak=-1,0 --true-peak --opus-mode=s "Нужно прекращять врать.mp4"

Zeugma440 commented 4 months ago

Here's what I did :

image

NB : Don't mind the ????'s; my system default charset is plain old boring Latin-1 😉

What MP3tag sees after that are not the metadata we talked about, but the resulting ReplayGain values :

image

MediaInfo finds the same information :

image

Are you sure you're not mistaking the input parameters for ReplayGain calculation with the output values of that calculation?

Agagamand commented 4 months ago

What MP3tag sees after that are not the metadata we talked about, but the resulting ReplayGain values

Is there a difference? The input ReplayGain calculation parameters are not written to "AdditionalFields"?

Zeugma440 commented 4 months ago

The input ReplayGain calculation parameters are not written to "AdditionalFields"?

RSGain does not write input parameters to the target file after running that command line.

Here are the insides of the resulting file :

image

You can see we have our 4 output values, but no REPLAYGAIN_REFERENCE_LOUDNESS, nor REPLAYGAIN_ALGORITHM.

Are you sure you gave me the correct command line?


If you want to add those manually using ATL, the code you submitted earlier is the right way to go. I have no idea why MP3tag does not read them, nor do I know how to add them using MP3tag either.

Agagamand commented 4 months ago

Checked it out. It's probably an error in the MP3Tag.

I'm sorry for the inconvenience.

P.S.

NB : Don't mind the ????'s; my system default charset is plain old boring Latin-1

Activating the encoding in Windows UTF8 may help https://stackoverflow.com/a/57134096/5105464

Zeugma440 commented 4 months ago

No problem man 👍

Activating the encoding in Windows UTF8 may help

Thanks. I only have that issue on some apps. As long as Windows Explorer works properly, it should be fine.