Re: [FFmpeg-devel] about mediacodec encoder on android platform

2020-03-31 Thread 156615797
Hi,
Thanks for your reply let me know the reasons why using java wrapper instead of 
native apis.
These days I've already started the work of adding mediacodec encoder support.
And i also want to use the java wrappers, because I found the 
mediacodec_wrapper.c
wrapped funcations should also can be used by encoder. So, I think it will not 
be very
complicated and will not waste a lot of time to wrap the encoder needed java 
apis through jni.
and as you mentioned, the java apis can run on more devices .
My plan is to support surface input and plain buffer, may meet many 
problems,but i'll try it!
btw, you said Aman Gupta has already did the work switch to using ndk apis for 
decoder, 
i also want to get some information about that ,can you provide me the git 
address?
Thanks!


 原始邮件 
发件人: Martin Storsj
收件人: FFmpeg development discussions and patches
发送时间: 2020年3月31日(周二) 16:46
主题: Re: [FFmpeg-devel] about mediacodec encoder on android platform


On Tue, 31 Mar 2020, Matthieu Bouron wrote: > On Fri, Mar 27, 2020 at 
04:21:59PM +0800, aistoy wrote: >> Hi, I want to know why ffmpeg do not include 
mediacodec encoder, just include mediacodec decoder. >> And why the decoder 
implemention don’t use mediacodec native api, but use jni call mediacodec java 
methods. >> If i plan to add the mediacodec encoder, what do you think i should 
pay attention to ? > > Hi, > > Sorry for the late replay. > > The MediaCodec 
decoder wrapper in FFmpeg does not use the native API > because at the time it 
was implemented, more than 40% of the devices were > running Android 4.4 (which 
does not support the native API). > > The MediaCodec native API has also some 
limitation regarding codec > probing, ie: it does not provide a wrapper around 
> MediaCodecList/MediaCodecInfo. We use this capability to blacklist > software 
codecs for example. > > I made our MediaCodec java wrapper implement the same 
API as the native > one provided by the NDK so it shouldn't be too hard to 
switch. > Moreover, Aman Gupta already already did this work in one of his 
branches. > > The "tricky" part about implementing MediaCodec encoding support 
in FFmpeg > will be to fit the encoder input surface API into the libavcodec 
API. FWIW, one doesn't need to use the surface API for input to encoders. Since 
Android 4.3 they all support either YUV420 or NV12 as input via plain buffers 
(enforced via a CTS test), fairly quirk free actually. On Android 4.1 and 4.2 
though, there were no tests that enforced encoders to behave, and they did 
pretty much whatever they wanted (having their own definitions of pixel 
formats, meaning something totally different to their standard names etc, with 
nonstandard padding). // Martin ___ 
ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org 
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link 
above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] about mediacodec encoder on android platform

2020-03-31 Thread Martin Storsjö

On Tue, 31 Mar 2020, Matthieu Bouron wrote:


On Fri, Mar 27, 2020 at 04:21:59PM +0800, aistoy wrote:
Hi, I want to know why ffmpeg do not include mediacodec encoder, just include mediacodec decoder. 
And why the decoder implemention don’t use mediacodec native api, but use jni call mediacodec java methods. 
If i plan to add the mediacodec encoder, what do you think i should pay attention to ?


Hi,

Sorry for the late replay.

The MediaCodec decoder wrapper in FFmpeg does not use the native API
because at the time it was implemented, more than 40% of the devices were
running Android 4.4 (which does not support the native API).

The MediaCodec native API has also some limitation regarding codec
probing, ie: it does not provide a wrapper around
MediaCodecList/MediaCodecInfo. We use this capability to blacklist
software codecs for example.

I made our MediaCodec java wrapper implement the same API as the native
one provided by the NDK so it shouldn't be too hard to switch.
Moreover, Aman Gupta already already did this work in one of his branches.

The "tricky" part about implementing MediaCodec encoding support in FFmpeg
will be to fit the encoder input surface API into the libavcodec API.


FWIW, one doesn't need to use the surface API for input to encoders. Since 
Android 4.3 they all support either YUV420 or NV12 as input via plain 
buffers (enforced via a CTS test), fairly quirk free actually.


On Android 4.1 and 4.2 though, there were no tests that enforced encoders 
to behave, and they did pretty much whatever they wanted (having their own 
definitions of pixel formats, meaning something totally different to their 
standard names etc, with nonstandard padding).


// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] about mediacodec encoder on android platform

2020-03-31 Thread Matthieu Bouron
On Fri, Mar 27, 2020 at 04:21:59PM +0800, aistoy wrote:
> Hi, I want to know why ffmpeg do not include mediacodec encoder, just include 
> mediacodec decoder. 
> And why the decoder implemention don’t use mediacodec native api, but use jni 
> call mediacodec java methods. 
> If i plan to add the mediacodec encoder, what do you think i should pay 
> attention to ?

Hi,

Sorry for the late replay.

The MediaCodec decoder wrapper in FFmpeg does not use the native API
because at the time it was implemented, more than 40% of the devices were
running Android 4.4 (which does not support the native API).

The MediaCodec native API has also some limitation regarding codec
probing, ie: it does not provide a wrapper around
MediaCodecList/MediaCodecInfo. We use this capability to blacklist
software codecs for example.

I made our MediaCodec java wrapper implement the same API as the native
one provided by the NDK so it shouldn't be too hard to switch.
Moreover, Aman Gupta already already did this work in one of his branches.

The "tricky" part about implementing MediaCodec encoding support in FFmpeg
will be to fit the encoder input surface API into the libavcodec API.

> thanks!
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] about mediacodec encoder on android platform

2020-03-27 Thread aistoy
Hi, I want to know why ffmpeg do not include mediacodec encoder, just include 
mediacodec decoder. 
And why the decoder implemention don’t use mediacodec native api, but use jni 
call mediacodec java methods. 
If i plan to add the mediacodec encoder, what do you think i should pay 
attention to ?
thanks!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".