From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6B84B43B3B for ; Fri, 11 Nov 2022 03:36:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7CCA568B418; Fri, 11 Nov 2022 05:36:51 +0200 (EET) Received: from out203-205-221-205.mail.qq.com (out203-205-221-205.mail.qq.com [203.205.221.205]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 75AF768B114 for ; Fri, 11 Nov 2022 05:36:43 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1668137800; bh=1Nuy5U9myicWmwJDA1VJNvB9pZfpOJxMN6wyvqY0EzY=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=nx7SxIft0aih4OL6zQ3deNnODFMMWwNZOKRc9ZZeW+nzeycMrW8vPdcfzD2XGrtp5 ifoUCTQZQMF7AjXAbjuevNw8hiJ1YNQhXpUmxLg+7eeN+9rzVQbUPK2H5zzcrVzMb3 u0h/TntC5C6J7kjPBy+7NKOoV6XqCu1jUH/rOpsA= Received: from smtpclient.apple ([113.108.77.50]) by newxmesmtplogicsvrszc2-1.qq.com (NewEsmtp) with SMTP id 9268EC11; Fri, 11 Nov 2022 11:36:38 +0800 X-QQ-mid: xmsmtpt1668137798trgg9ojd6 Message-ID: X-QQ-XMAILINFO: N+e2o5mO2Saeify1ACuDdjGTbKpXSDJBhMpJzluZ1B7PPM68xNLOVIYHhfw4A0 q5DEU76Uh0eSt+CfIc1YHOtCq4DQ48vnKVJHftagbeB6cW2Ph9EWWD4jXuVu4Z61y8xtRat6g+v7 rxls/s5HGT8GFJhK4EbluajIL5boTBdpeuxNfn3mljLlePKOAe1mg1Cnz5ScQCPBMRBoFD72zWg3 Nu0P3ojLy+7MxD2JuS+RITQj9HHoqApC6/GOkB3WktIHY/xvF0vgzvF79vwORtEAJ4i93x2u/+tD qSV/Cw6g5APdz/igMHNKXcccd7N2pEM/b24SVr5DOFewB+sTZ4RKjB88svCzzEAQUCEJfNeuYrU1 CIgPdkMd/w7xO3U8RtyUeobO7v0QxE+aCU/poacslcTZXC7V3D9zPchdo6uiqjIvNplqcE9GpLbB /e6CDpmBMEuhXohH7VRsSCK5g6lgk5VneGMGcncpxkiSMeHgiQxCN6aXyaAErmBaJbBkreaF5nb5 McwUcmJczpEXFBAgbDe1T5N2RFga4xIhYkXTWjc39m3Tyr3b43R0ihynHMkwOsiLdCSNrhH4Kfwi mUEymdUgn99KZC/83w5qVWd/xKpqa4FBEbgcuPyUf/+Xy9a77d6EJhRAu+sCj9TkKUb19MpKvIHN AUhV9fOuOPbxqAcC/4GSfgB56o95Utndq1for70klnVNpiOyaNfb5URehYF9K8npWaLBKYNKP/0P Opz4y72ZITjDJWn/8OryfndvmeQ2mFmueb91zFJDvtbJeN8+5WbYEMCFczLp+LLSVvBAgVhnm7PS KF4xXgbe4Fdk+YESmB2/0aC/iOi+hhkyEmB00rbzyLlwScopcp/dqlxuvqSy0Tt77Ie/SXvW3Skx IjljeKiTzcKxKgb+ZuPxn8f/WigHUDmE/8yGqSPWwMyND6Tv4uzuEglxwnyLFQ4MguYbxWRo5fpy MJEE83svNucpu0l3w/X6b4docszZo6DvmS7g0XnVo= Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) From: =?utf-8?B?InpoaWxpemhhbyjotbXlv5fnq4spIg==?= In-Reply-To: <2be0f2b8-5320-4a81-994a-2b35cc2d3af6@EX-SZ063.tencent.com> Date: Fri, 11 Nov 2022 11:36:37 +0800 X-OQ-MSGID: <2A75ADFB-5802-4BDA-A109-951E26EE1327@foxmail.com> References: <2be0f2b8-5320-4a81-994a-2b35cc2d3af6@EX-SZ063.tencent.com> To: FFmpeg development discussions and patches X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: Re: [FFmpeg-devel] [Internet][PATCH 00/12] Add MediaCodec encoder and NDK MediaCodec support X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: matthieu.bouron@stupeflix.com, aman@tmm1.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Ping for review. > On Oct 24, 2022, at 11:16, Zhao Zhili wrote: > > From: Zhao Zhili > > Firstly, some bugs were fixed (patch 1-4). > > Patch 5 and 6 make mediacodec_wrapper support Java MediaCodec and NDK > MediaCodec. The use case I'm considering is run FFmpeg on cmdline without JVM, > for example, run FFmpeg inside of termux (an Android terminal emulator). It's > well known that NDK MediaCodec missing some important functions, like get the > list of codecs, but still useable. > > Patch 7 add NDK MediaCodec decoder support. It can be enabled via options, > and enabled automatically if no JVM is available. > > Patch 8 add ANativeWindow support to hwcontext_mediacodec. It can be set by > user, and can be created via AMediaCodec_createPersistentInputSurface > automatically. This is a preparation for encoder. > > Patch 9 makes MediaCodec decoder to support ANativeWindow directly. It worth > to note that AVMediaCodecContext has only surface. Although we provided > av_mediacodec_alloc_context(), we didn't strictly prevent users to allocate > AVMediaCodecContext on stack. I'm not sure if it's OK to add new field to > AVMediaCodecContext. > > Patch 10 add MediaCodec encoder support. Frame can be feed to encoder via > buffer, or via Surface/ANativeWindow. If Surface/ANativeWindow is used, and > the frames come from our MediaCodec decoder wrapper, we can control it's > 'render' (send to encoder's surface) via av_mediacodec_release_buffer(). A DTS > generation strategy works in this case. However, if frames comes from other > sources, like a camera, there is no way to control the 'render' yet, so DTS is > missing in this case. > > Finally, we can do mediacodec transcoding with FFmpeg cmdline on Android. > More importantly, we can do MediaCodec decoder to encoder without copy frames, > although it's very limited since most of avfilters doesn't work. For example: > > ./ffmpeg -hwaccel mediacodec -hwaccel_output_format mediacodec -i /sdcard/test.mp4 -an -c:v h264_mediacodec -y /sdcard/out.mp4 > > Since there is no real AVHWFrameContext implementation in hwcontext_mediacodec. > there is no hwframe_ctx for mediacodec and av_hwframe_transfer_data() doesn't > work. So if -hwaccel_output_format isn't being specified like: > > ./ffmpeg -hwaccel mediacodec -i /sdcard/test.mp4 -an -c:v h264_mediacodec -y /sdcard/out.mp4 > > It will trigger a crash in av_hwframe_transfer_data. Patch 11 add a check on > hwframe_ctx. Patch 12 set hwaccel_output_format automatically to avoid such > case. > > > Zhao Zhili (12): > avcodec/mediacodec: fix incorrect crop info > avcodec/mediacodecdec: don't break out if both input and output port > return try again > avcodec/mediacodecdec_common: fix misuse av_free/av_freep > avcodec/mediacodecdec_common: fix useless av_buffer_unref > avcodec/mediacodec_wrapper: separate implementation from interface > avcodec/mediacodec: add NDK media codec wrapper > avcodec/mediacodecdec: enable NDK mediacodec > avutil/hwcontext_mediacodec: add ANativeWindow support > avcodec/mediacodec: add ANativeWindow support > avcodec: add MediaCodec encoder > avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc > fftools/ffmpeg_opt: set default hwaccel_output_format for mediacodec > > Changelog | 2 + > configure | 6 + > fftools/ffmpeg_opt.c | 4 + > libavcodec/Makefile | 2 + > libavcodec/allcodecs.c | 2 + > libavcodec/mediacodec_surface.c | 46 +- > libavcodec/mediacodec_surface.h | 8 +- > libavcodec/mediacodec_wrapper.c | 942 +++++++++++++++++++++++++++--- > libavcodec/mediacodec_wrapper.h | 275 +++++++-- > libavcodec/mediacodecdec.c | 21 +- > libavcodec/mediacodecdec_common.c | 35 +- > libavcodec/mediacodecdec_common.h | 1 + > libavcodec/mediacodecenc.c | 495 ++++++++++++++++ > libavcodec/version.h | 2 +- > libavutil/hwcontext.c | 6 +- > libavutil/hwcontext_mediacodec.c | 56 +- > libavutil/hwcontext_mediacodec.h | 11 + > libavutil/version.h | 4 +- > 18 files changed, 1780 insertions(+), 138 deletions(-) > create mode 100644 libavcodec/mediacodecenc.c > > -- > 2.25.1 > > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".