diff mbox series

[FFmpeg-devel] avcodec/mediacodecenc: Add a hint message to use nv12 pix_fmt

Message ID tencent_5F5553E1337155CCA90C2EB6A548D305E805@qq.com
State Accepted
Commit b0e17e0f959b09fb228665a7eb7323af9b6ffeac
Headers show
Series [FFmpeg-devel] avcodec/mediacodecenc: Add a hint message to use nv12 pix_fmt | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili March 4, 2024, 3:37 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

---
 libavcodec/mediacodecenc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Matthieu Bouron March 4, 2024, 8:20 a.m. UTC | #1
On Mon, Mar 04, 2024 at 11:37:58AM +0800, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> ---
>  libavcodec/mediacodecenc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
> index 086b545590..984014f1b1 100644
> --- a/libavcodec/mediacodecenc.c
> +++ b/libavcodec/mediacodecenc.c
> @@ -319,6 +319,9 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
>      ret = ff_AMediaCodec_configure(s->codec, format, s->window, NULL, ret);
>      if (ret) {
>          av_log(avctx, AV_LOG_ERROR, "MediaCodec configure failed, %s\n", av_err2str(ret));
> +        if (avctx->pix_fmt == AV_PIX_FMT_YUV420P)
> +            av_log(avctx, AV_LOG_ERROR, "Please try -pix_fmt nv12, some devices don't "
> +                                        "support yuv420p as encoder input format.\n");
>          goto bailout;
>      }
>  

LGTM.
diff mbox series

Patch

diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index 086b545590..984014f1b1 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -319,6 +319,9 @@  static av_cold int mediacodec_init(AVCodecContext *avctx)
     ret = ff_AMediaCodec_configure(s->codec, format, s->window, NULL, ret);
     if (ret) {
         av_log(avctx, AV_LOG_ERROR, "MediaCodec configure failed, %s\n", av_err2str(ret));
+        if (avctx->pix_fmt == AV_PIX_FMT_YUV420P)
+            av_log(avctx, AV_LOG_ERROR, "Please try -pix_fmt nv12, some devices don't "
+                                        "support yuv420p as encoder input format.\n");
         goto bailout;
     }