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

AMediaExtractor and MediaCodec #439

Open
ruichaowang opened this issue Oct 11, 2023 · 4 comments · May be fixed by #453
Open

AMediaExtractor and MediaCodec #439

ruichaowang opened this issue Oct 11, 2023 · 4 comments · May be fixed by #453

Comments

@ruichaowang
Copy link

Dear Experts,

I hope this message finds you well. I am currently encountering a couple of issues related to the usage of AMediaExtractor and MediaCodec and seeking for your guidance.

The first question is regarding the "Safe abstraction of the AMediaExtractor". I'm wondering if there is a specific reason as to why this does not exist? Are there perhaps alternative methods that could act as a suitable replacement?

The second question revolves around the running modes of MediaCodec. I found that MediaCodec operates normally in synchronous mode but not in asynchronous mode. Could you kindly guide me as where I might locate detailed usage documentation related to these modes?

I would really appreciate any help or insights you could provide on these topics.

Thank you very much for your time and assistance.

Best regards,

@MarijnS95
Copy link
Member

MarijnS95 commented Oct 11, 2023

The first question is regarding the "Safe abstraction of the AMediaExtractor". I'm wondering if there is a specific reason as to why this does not exist? Are there perhaps alternative methods that could act as a suitable replacement?

No reason, other than "it hasn't been built yet". And most likely no-one dares to submit one if you look at my track record for being pedantic and complete in my own additions about new bindings in recent PRs.

The second question revolves around the running modes of MediaCodec. I found that MediaCodec operates normally in synchronous mode but not in asynchronous mode. Could you kindly guide me as where I might locate detailed usage documentation related to these modes?

Asynchronous notifications were contributed in #410 and should be available in the 0.8.0-beta.0 release. This should all be promoted to stable later this week.
Not sure if that's enough for "asynchronous mode" as I have zero experience with AMediaCodec. If necessary, @spencercw or @zarik5 might help you out? Looks like that's all that's needed.

@MarijnS95
Copy link
Member

MarijnS95 commented Oct 11, 2023

Fwiw the bindings look trivial/minimal enough that I might as well PR them if I get to sit down comfortably for an hour or so :). But for the time being you can use the raw bindings from ndk-sys as a temporary "workaround".

@spencercw
Copy link
Contributor

The problem with AMediaExtractor is that it seems to require a seekable source, which mine isn't. I have full control over the input so it was easier to just manually construct the AMediaFormat with the required parameters. If you need something that works more generally then getting AMediaExtractor to work is probably the best option. Failing that you may be able to use something like ffmpeg to extract the metadata required to build the AMediaFormat.

If you haven't seen it already, the Java MediaCodec documentation is much more detailed than the NDK documentation, and the API is quite similar.

@MarijnS95
Copy link
Member

Reopening this to track adding bindings for AMediaExtractor, which is now almost done on a local branch.

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