Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ogg Opus metadata support #69

Merged
merged 1 commit into from
May 30, 2022
Merged

Add Ogg Opus metadata support #69

merged 1 commit into from
May 30, 2022

Conversation

wader
Copy link
Contributor

@wader wader commented Apr 26, 2020

Refactor into a ogg demuxer that returns slice of packets
and then look for first vorbis comment or opus tags packet.

Fixes #64

Refactor into a ogg demuxer that returns slice of packets
and then look for first vorbis comment or opus tags packet.

Fixes dhowden#64
@wader
Copy link
Contributor Author

wader commented Apr 26, 2020

@dhowden Sorry for messy diff, it got messy to add support so decided to refactor a bit. Also haven't tried it with many ogg files but it seems to work, please how a go if you have time.

@deluan
Copy link

deluan commented May 23, 2020

Hey guys, any blockers for this to be merged?

@wader
Copy link
Contributor Author

wader commented May 23, 2020

I guess testing is what is missing. Do you have lots of oggs with metadata to test on?

@deluan
Copy link

deluan commented May 23, 2020

Not that many, maybe a dozen or two, but will try with what I have this weekend.

@dhowden
Copy link
Owner

dhowden commented May 24, 2020

@dhowden Sorry for messy diff, it got messy to add support so decided to refactor a bit. Also haven't tried it with many ogg files but it seems to work, please how a go if you have time.

No worries. I remember scanning through this and planning to come back to it: wasn't sure why you didn't use the CRC32 stuff from the stdlib.

@wader
Copy link
Contributor Author

wader commented May 24, 2020

@dhowden Sorry maybe should add a comment about that. I tried to use stdlib crc32 but didn't mange to get it working. Did some digging in the ogg reference implementation and it seems both table generator and update function is a bit different from the go crc32 https://github.com/xiph/ogg/blob/6e9f7cc2f64c9e659c6ca7cde6737f5d1d564b5e/src/framing.c#L112 or do you have any idea if it possible?

@deluan
Copy link

deluan commented May 27, 2020

Hey, a user of my project was able to test it compiled against this PR and it successfully extracted cover arts from 4K+ files without errors... 👍

@wader
Copy link
Contributor Author

wader commented May 27, 2020

@deluan ah nice, thanks for testing! any idea what mix or ogg vorbis/opus it was?

@deluan
Copy link

deluan commented May 27, 2020

It was tested by a user, @andre15silva, maybe he can give some more info about his library.

Also, seems that there are still some edge cases where the library returns an invalid image, I'm trying to get a sample file and attach it here.

@wader
Copy link
Contributor Author

wader commented May 28, 2020

Ah that would be great

@andre15silva
Copy link

@wader, I encoded all those files using opusenc, so they are all ogg opus. What other information is useful to you?

@wader
Copy link
Contributor Author

wader commented May 28, 2020

@andre15silva ok! i think ogg files produced by different encoders would be useful

@mipimipi
Copy link

@ALL: Just tested that as well - no problems. Can this be merged? Thanks.

@wader
Copy link
Contributor Author

wader commented Dec 31, 2020

@mipimipi 👍
@dhowden let me know if there is something i should change or clarify in the PR

iotku added a commit to iotku/genMusicSQLiteDB that referenced this pull request Aug 5, 2021
we check isValidExt to determine if the file extension should be scanned, currently tag does not support opus files unless
dhowden/tag#69 is merged
@dhowden
Copy link
Owner

dhowden commented Nov 8, 2021

@dhowden Sorry maybe should add a comment about that. I tried to use stdlib crc32 but didn't mange to get it working. Did some digging in the ogg reference implementation and it seems both table generator and update function is a bit different from the go crc32 https://github.com/xiph/ogg/blob/6e9f7cc2f64c9e659c6ca7cde6737f5d1d564b5e/src/framing.c#L112 or do you have any idea if it possible?

Yeah, without examples it's hard to look at. I suspect they aren't using the same form of CRC32 that the stdlib does, which is annoying. I wonder if it's adaptable? Not sure it's worth it though. https://github.com/Michaelangel007/crc32

@wader
Copy link
Contributor Author

wader commented Nov 9, 2021

Interesting CRC article, probably need some time to really understand that :) do you feel awkward merging as it is now? would it be enough with a comment about where the CRC stuff comes from and that it is confusing?

Alternatively just skip checking CRC?

@idcmp
Copy link

idcmp commented May 7, 2022

Any thoughts on adding Opus support?

@bertvandepoel
Copy link

Is there anything I can do to help advance this PR?

@wader
Copy link
Contributor Author

wader commented May 30, 2022

I'm happy to help fixing whatever needs to be done

@bertvandepoel
Copy link

@wader I see, so you're just waiting for @dhowden to give feedback concerning the CRC issue?

@wader
Copy link
Contributor Author

wader commented May 30, 2022

@bertvandepoel Yes, i guess accept current change, skip CRC check or somehow rewrite or clarify the CRC thing, but i'm not a CRC expert. If i remember correct i could not figure how to use https://pkg.go.dev/hash/crc32#MakeTable to make it do the same thing, maybe something it could be done by transforming the 0x04c11db7 polynom? so i ended up portort some C version etc of it instead

@dhowden
Copy link
Owner

dhowden commented May 30, 2022

Yeah, sorry. I started looking at removing the CRC stuff (a long time ago now), and then didn't finish it. Ideally we would ditch the custom CRC implementation, but without a good solution happy to keep it in for now.

@dhowden dhowden merged commit 77907a3 into dhowden:master May 30, 2022
@wader wader deleted the ogg-opus branch May 30, 2022 11:30
@wader
Copy link
Contributor Author

wader commented May 30, 2022

@dhowden Yes that would be nice, but don't think i will spend more time on it either. Thanks for reviewing and creating this package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get picture from OGG file
7 participants