donmai-me / WannaCRI

Criware media formats library
MIT License
128 stars 10 forks source link

Add experimental HCA encoding support #10

Closed pmdevita closed 1 year ago

pmdevita commented 1 year ago

Tried adding support for HCA to re-encode videos for the PC release of Chaos;Head NOAH. Used the VGAudio binary template as a reference for how the HCA file works as well as some USM files I had on hand.

I can't check if this works because the game actually uses mpeg1 instead of H264, which I didn't fully realize until after I finished this lol. It seems like the only info online indicates USM is only used with H264/VP9, have you maybe seen this before in another game?

Thanks for the library anyways though!

donmai-me commented 1 year ago

Thanks for your interest in improving this repo. Currently a bit busy so I'll take a closer look at this later. However since hca isn't exclusive to usm and is mainly used in Criware's audio containers. I might recommend separating the main logic to a separate module outside of usm and make only usm packaging logic in the usm module. If you don't feel like doing this, then that's fine with me.

It seems like the only info online indicates USM is only used with H264/VP9, have you maybe seen this before in another game?

I've seen hca in usms used in games with cutscenes like genshin, uma musume, etc. Other video codecs can be used as you can see in open issues. I have never gotten to support them since I don't have the games to properly investigate.

pmdevita commented 1 year ago

Ah, I was trying to implement HCA audio as a subclass of USMAudio, to mirror how the H264 and VP9 classes were implemented. I'm not sure if I exactly understand what you mean by main logic vs packaging logic, do you mean all the code to decode and read the HCA file vs. the HCA subclass used in packaging? Looking back at it, yeah it should probably be somewhere else, do you have a preference for where? I'm fine with reorganizing it however you like.

I see this issue for it now, I probably just passed by it earlier since I didn't realize it was relevant. I might try to take a crack at mpeg1/2 support too later.

donmai-me commented 1 year ago

I was thinking something like this. Again I don't expect you to do most of these.

donmai-me commented 1 year ago

Sorry for taking so long. I'll accept your code as-is, I'll do the modifications to follow the plan I outlined above. Thanks again for your interest in contributing.

pmdevita commented 1 year ago

Oh sorry, I was meaning to come back to this, my bad. I'll send another pull request when I get around to reorganizing if you don't get to it before me.