freyr-js icon indicating copy to clipboard operation
freyr-js copied to clipboard

Replace AtomicParsley with lofty-rs

Open miraclx opened this issue 3 years ago • 6 comments

Related: https://github.com/miraclx/freyr-js/pull/82

In certain cases, AtomicParsley falls short. Like embedding long rDNSatom keys. https://github.com/wez/atomicparsley/issues/44

In the spirit of https://github.com/miraclx/freyr-js/pull/305, we could replace it with a wasm bundled version of https://github.com/Serial-ATA/lofty-rs

Which should allow us to support more formats beyond AAC and even export the original audio with only metadata embedded. https://github.com/miraclx/freyr-js/issues/168

And be free of native dependencies.

miraclx avatar Sep 02 '22 00:09 miraclx

Couldn't we just use ffmpeg? This way i think we could even embed the metadata during the encoding process

orsett0 avatar May 16 '23 19:05 orsett0

~Even ffmpeg uses AtomicParsley to embed metadata.~

Looks like I misread, I thought you had said youtube-dl.

ffmpeg doesn't support metadata embedding into AAC containers which the mp4 format (.m4a) uses, so this doesn't work.

miraclx avatar May 21 '23 17:05 miraclx

That's not entirely true. It supports all the tags currently used by freyr-js, for the exception of apID, purd, ©enc, rDNSatom and rtng, unless you specify a flag in ffmpeg which however messes with the other metadata. (*)

Also, metadata written with ffmpeg can't be read by AtomicParsley, and this makes me think that they are not readable by iTunes too. They can however be read by other players.

I don't know if you consider these metadata to be important, but if they aren't, I could make a PR in a few days implementing the use of ffmpeg to embed metadata. Otherwise I can't offer a solution, as I'm not experienced in rust nor wasm.

(*) the flag is -movflags use_metadata_tags. I don't know exactly how it works, given that I can't find proper documentation, but it renders metadata such as the track number not readable by vlc and others.

orsett0 avatar May 22 '23 15:05 orsett0

Also, metadata written with ffmpeg can't be read by AtomicParsley, and this makes me think that they are not readable by iTunes too.

That is a point of concern for this project.

I don't have much time these days, but this is worth investigating. I will if I ever find the time. Or if you do, and can submit a PR, I'd be happy to test and review it. Reusing the embedded ffmpeg wasm binary for this would save on third-party requirements and make freyr a "download only" solution.

The help would be very much appreciated.

Otherwise, I'm pretty happy with the state of things as it is.

miraclx avatar Aug 19 '23 04:08 miraclx

Hi, I was working on using ffmpeg to add metadata, but then I noticed that some tags were not recognized correctly by other music players, so I abandoned the idea.

I wanted to develop a WASM version of lofty-rs, but due to university I didn't have much time. I think I can start working on it in a couple of days and I'll be happy to submit a PR once I get things to work.

orsett0 avatar Sep 27 '23 12:09 orsett0

That would be amazing, feel free to reach out if you need any help. Thank you!

miraclx avatar Oct 02 '23 14:10 miraclx