* Re: [FFmpeg-devel] [Internet][PATCH v2 00/12] Add MediaCodec encoder and NDK MediaCodec support [not found] <6d2f54dd-88a0-45aa-a795-96b3cef69c70@EX-SZ069.tencent.com> @ 2022-11-21 16:23 ` Zhao Zhili 2022-11-21 16:38 ` StreamNG Harold Camargo 0 siblings, 1 reply; 2+ messages in thread From: Zhao Zhili @ 2022-11-21 16:23 UTC (permalink / raw) To: ffmpeg-devel On Sun, 2022-11-20 at 14:49 +0800, Zhao Zhili wrote: > From: Zhao Zhili <zhilizhao@tencent.com> > > > v2: > > Rebased on master. > > 01/12: Use crop-width/crop-height as fallback and add TODO. Co- > authored-by: Aman Karmani > 07/12: Fix libavcodec/version.h conflict > 10/12: Change default i-frame-interval to 1 and add log message; bump > minor version > 12/12: Fix rebase conflict > > > v1: > 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. > Applied. _______________________________________________ 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". ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [Internet][PATCH v2 00/12] Add MediaCodec encoder and NDK MediaCodec support 2022-11-21 16:23 ` [FFmpeg-devel] [Internet][PATCH v2 00/12] Add MediaCodec encoder and NDK MediaCodec support Zhao Zhili @ 2022-11-21 16:38 ` StreamNG Harold Camargo 0 siblings, 0 replies; 2+ messages in thread From: StreamNG Harold Camargo @ 2022-11-21 16:38 UTC (permalink / raw) To: FFmpeg development discussions and patches please. unsuscribe. Harold F. Camargo R. Stream NG Cel. 318 3227862 Bogotá Colombia www.stream-ng.com El lun, 21 nov 2022 a las 11:23, Zhao Zhili (<quinkblack@foxmail.com>) escribió: > On Sun, 2022-11-20 at 14:49 +0800, Zhao Zhili wrote: > > From: Zhao Zhili <zhilizhao@tencent.com> > > > > > > v2: > > > > Rebased on master. > > > > 01/12: Use crop-width/crop-height as fallback and add TODO. Co- > > authored-by: Aman Karmani > > 07/12: Fix libavcodec/version.h conflict > > 10/12: Change default i-frame-interval to 1 and add log message; bump > > minor version > > 12/12: Fix rebase conflict > > > > > > v1: > > 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. > > > > Applied. > > _______________________________________________ > 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". > _______________________________________________ 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". ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-21 16:38 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <6d2f54dd-88a0-45aa-a795-96b3cef69c70@EX-SZ069.tencent.com> 2022-11-21 16:23 ` [FFmpeg-devel] [Internet][PATCH v2 00/12] Add MediaCodec encoder and NDK MediaCodec support Zhao Zhili 2022-11-21 16:38 ` StreamNG Harold Camargo
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git