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

AAC Fixed support #2

Closed
BobbyShoe opened this issue May 8, 2021 · 10 comments
Closed

AAC Fixed support #2

BobbyShoe opened this issue May 8, 2021 · 10 comments

Comments

@BobbyShoe
Copy link

@Yahweasel thank you for the pre-built files. They are really close to working for me. I am running into one issue now. It looks like the aac_fixed decoder is not included in any of the variant builds. Any chance that could be added, or is already in one and I missed it?

Basically calling
libav.avcodec_find_decoder_by_name("aac_fixed")

will not return a codec.

Interestingly
libav.avcodec_find_decoder(86018)

86018 corresponds to AVCodecID.AV_CODEC_ID_AAC

will return a codec, however it does not really work. You can only send in one packet all calls to get a frame return an EOF message as do all subsequent calls to add a packet.

Thanks,
Bobby

@Yahweasel
Copy link
Owner

The configs don't have aac_fixed, only aac. However, upon examination, indeed, it doesn't seem willing to decode (my tests happen not to cover that case, since my actual use is concerned with encoding AAC, not decoding AAC, but I'll add a test for it). I'll investigate.

@Yahweasel
Copy link
Owner

Aha, never mind: AAC decoding works fine, it's just a codec that needs codecpar to decode properly. You'll either need to build a codecpar or get one from your demuxer.

@BobbyShoe
Copy link
Author

Do you mean setting the values on the context? I had modified the test-decode-audio.js test to try decoding aac. I am setting context settings like this to provide decode information.

libav.AVCodecContext_sample_rate_s(c, 48000);
libav.AVCodecContext_sample_fmt_s(c, 8);
libav.AVCodecContext_channels_s(c, 2);

I have this similar logic decoding the same stream in a C# project using the same calls.

@BobbyShoe
Copy link
Author

If it helps here is the simple test I am using. I am looking for the aac file in c:\Temp in the test. You can easily move that around if needed.

test-decode-audio-aac.zip

@Yahweasel
Copy link
Owner

You say that similar code works in a C# version? The problem, as far as I'm aware, isn't the decoder, but the (lack of) demuxer: .aac files have a header before the raw AAC data, so they do require a demuxing step to be read correctly, or at least for the header to be stripped off. None of the variants support demuxing .aac files, only .m4a/.mp4 files.

@BobbyShoe
Copy link
Author

I tried again with an m4a file (attached in zip), I also fixed HTML file to go back to "default" variant. I am still getting the EOF error message as soon as I try get a frame out. Does this file work in any of your tests?

test-decode-audio-aac_withm4a.zip

Thanks for the help.

@Yahweasel
Copy link
Owner

It works fine with, e.g., test-demuxing-aac-simple.js (the test I just added for demuxing + decoding AAC). The issue with your code is that it's not demuxing.

@BobbyShoe
Copy link
Author

@Yahweasel can you share your new test? I tried modifying the opus demuxing test, but it did not work with an AAC file. Thanks.

@Yahweasel
Copy link
Owner

Argh, I added it but forgot to git push @_@. Here it is: https://github.com/Yahweasel/libav.js/blob/master/tests/test-demuxing-aac-simple.js

@BobbyShoe
Copy link
Author

@Yahweasel thank you for the test sample. Using the test case as a guide, I eventually found the main source of all of my problems. I did not await the ff_set_packet function call in an async method, so my buffer was not actually being set on the packet.

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

No branches or pull requests

2 participants