Firefly开源社区

标题: mpp编码失败 [打印本页]

作者: tangmignzhou    时间: 2023-7-18 11:35
标题: mpp编码失败
本帖最后由 tangmignzhou 于 2023-7-18 11:45 编辑

dev:/tmz$ ffgo version
OS:         Ubuntu 20.04.6 LTS
MODEL:         Firefly AIO-3588Q MIPI101(Linux)
FIREFLY: v2.40-7-gaab3442
DATE:         20230629
KERNEL:         Linux version 5.10.160 (lvsx@tchip16) (kernel commit id: dc384cc20ddf) (sdk version: rk3588_linux_release_20230704_v1.1.1a) (aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 10.3.1 20210621, GNU ld (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 2.36.1.20210621) #111 SMP Tue Jul 4 11:41:59 CST 2023

0:00:00.073694217 181803   0x55b1bc8b60 WARN                  mppenc gstmppenc.c:641:gst_mpp_enc_set_format:<myenc_1> framerate (0/1) is insane!

rga_api version 1.8.1_[4]
RgaBlit(1465) RGA_BLIT fail: Invalid argument
RgaBlit(1466) RGA_BLIT fail: Invalid argument
fd-vir-phy-hnd-format[0, 0x7fe83490a0, (nil), 0, 0]
rect[0, 0, 1280, 800, 3840, 800, 1792, 0]
f-blend-size-rotation-col-log-mmu[0, 0, 0, 0, 0, 0, 1]
fd-vir-phy-hnd-format[33, (nil), (nil), 0, 0]
rect[0, 0, 1280, 800, 1280, 800, 2560, 0]
f-blend-size-rotation-col-log-mmu[0, 0, 0, 0, 0, 0, 1]
This output the user patamaters when rga call blit fail
:00:14.891498867 181803   0x55b1bc8b60 WARN                     mpp gstmpp.c:235:gst_mpp_rga_do_convert: failed to blit
0:00:14.891568285 181803   0x55b1bc8b60 ERROR                 mppenc gstmppenc.c:829:gst_mpp_enc_convert:<myenc_1> failed to convert frame
0:00:14.891586952 181803   0x55b1bc8b60 ERROR                 mppenc gstmppenc.c:1021:gst_mpp_enc_handle_frame:<myenc_1> not negotiated
0:00:14.891610285 181803   0x55b1bc8b60 WARN                  mppenc gstmppenc.c:1025:gst_mpp_enc_handle_frame:<myenc_1> can't handle this frame
0:00:14.891973123 181803   0x55b1bc8b60 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<mysource_1> error: Internal data stream error.
0:00:14.891999665 181803   0x55b1bc8b60 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<mysource_1> error: streaming stopped, reason not-negotiated (-4)


源码:
  1. CRINFO << "starting gstreamer";
  2.     if (mGstInfo.pipeline = gst_pipeline_new("mypipeline_1"); mGstInfo.pipeline == nullptr) {
  3.         CRERROR << "mGstInfo.pipeline nullptr";
  4.         return false;
  5.     }

  6.     if (mGstInfo.appsrc = gst_element_factory_make("appsrc", "mysource_1"); mGstInfo.appsrc == nullptr) {
  7.         CRERROR << "mGstInfo.appsrc nullptr";
  8.         return false;
  9.     }

  10.     if (mGstInfo.appsink = gst_element_factory_make("appsink", "mysink_1"); mGstInfo.appsink == nullptr) {
  11.         CRERROR << "mGstInfo.appsink nullptr";
  12.         return false;
  13.     }

  14.     if (mGstInfo.frame_encoder = gst_element_factory_make("mpph264enc", "myenc_1");
  15.         mGstInfo.frame_encoder == nullptr) {
  16.         CRERROR << "mGstInfo.frame_encoder nullptr";
  17.         return false;
  18.     }

  19.     mGstInfo.gst_elements.push_back(mGstInfo.appsrc);
  20.     mGstInfo.gst_elements.push_back(mGstInfo.frame_encoder);
  21.     mGstInfo.gst_elements.push_back(mGstInfo.appsink);
  22.     GstCaps *caps_appsrc = nullptr, *caps_h264 = nullptr, *caps_conv = nullptr;

  23.     caps_appsrc = gst_caps_new_simple("video/x-raw", "format", G_TYPE_STRING, mGstInfo.type.c_str(), "width",
  24.                                       G_TYPE_INT, mGstInfo.width, "height", G_TYPE_INT, mGstInfo.height,
  25.                                       "framerate", GST_TYPE_FRACTION, mGstInfo.framerate, 1, "chroma-site",
  26.                                       G_TYPE_STRING, "mpeg2", NULL);

  27.     if (caps_appsrc == nullptr) {
  28.         CRERROR << "caps_appsrc nullptr";
  29.         return false;
  30.     }

  31.     // caps_h264 =
  32.     //     gst_caps_new_simple("video/x-h264", "stream-format", G_TYPE_STRING, "byte-stream", "alignment",
  33.     //                         G_TYPE_STRING, "au", "profile", G_TYPE_STRING, "baseline", "height", G_TYPE_INT,
  34.     //              mGstInfo.height,"width", G_TYPE_INT, mGstInfo.width, NULL);
  35.     caps_h264 =
  36.                 gst_caps_new_simple("video/x-h264", "stream-format", G_TYPE_STRING, "byte-stream", "alignment",
  37.                             G_TYPE_STRING, "au", NULL);
  38.     if (caps_h264 == nullptr) {
  39.         CRERROR << "caps_h264 nullptr";
  40.         gst_caps_unref(caps_appsrc);
  41.         return false;
  42.     }

  43.     int blocksize = mGstInfo.width * mGstInfo.height * mGstInfo.channel;  // TODO::
  44.     g_object_set(G_OBJECT(mGstInfo.appsrc), "caps", caps_appsrc, "blocksize", blocksize, NULL);

  45.     CRINFO << "mGstInfo.appsrc set";

  46.     // g_object_set(G_OBJECT(mGstInfo.appsink), "caps", caps_h264, NULL);
  47.     // CRINFO << "mGstInfo.appsink set";
  48.     g_object_set(G_OBJECT(mGstInfo.appsink), "caps", caps_h264, NULL);
  49.     CRINFO << "mGstInfo.appsink set";
  50.     g_object_set(G_OBJECT(mGstInfo.frame_encoder), "bps", mGstInfo.bitrate, "bps-max", mGstInfo.bitrate,
  51.                  "bps-min", mGstInfo.bitrate, "gop", mGstInfo.iframeinterval, "header-mode", 1, "height",
  52.                  mGstInfo.height, "profile", 66, "rc-mode", 1, "width", mGstInfo.width, NULL);

  53.     CRINFO << "mGstInfo.encoder set";

  54.     mGstInfo.loop = g_main_loop_new(NULL, FALSE);
  55.     mGstInfo.bus = gst_pipeline_get_bus(GST_PIPELINE(mGstInfo.pipeline));
  56.     mGstInfo.bus_watch_id = gst_bus_add_watch(mGstInfo.bus, busCall, mGstInfo.loop);
  57.     gst_object_unref(mGstInfo.bus);

  58.     for (int i = 0; i < mGstInfo.gst_elements.size(); ++i) {
  59.         gst_bin_add(GST_BIN(mGstInfo.pipeline), mGstInfo.gst_elements[i]);
  60.         if (i > 0) {
  61.             if (!gst_element_link(mGstInfo.gst_elements[i - 1], mGstInfo.gst_elements[i])) {
  62.                 CRERROR << "link element [" << mGstInfo.gst_elements[i - 1]->object.name << "] and ["
  63.                         << mGstInfo.gst_elements[i]->object.name << "] failed.";
  64.                 gst_caps_unref(caps_appsrc);
  65.                 gst_caps_unref(caps_h264);
  66.                 return false;
  67.             }
  68.         }
  69.     }

  70.     gst_caps_unref(caps_appsrc);
  71.     gst_caps_unref(caps_h264);
  72.     if (caps_conv != nullptr) { gst_caps_unref(caps_conv); }

  73.     CRINFO << "iframeinterval: " << mGstInfo.iframeinterval << ", bitrate: " << mGstInfo.bitrate
  74.            << ", for image " << mGstInfo.width << "*" << mGstInfo.height;

  75.     // Start pipeline so it could process incoming data
  76.     GstStateChangeReturn ret = gst_element_set_state(mGstInfo.pipeline, GST_STATE_PLAYING);
  77.     CRINFO << "gst_element_set_state:" << ret;

  78.     mGstreamerThreadStarted = true;  // TODO::
  79.     CRINFO << "gstreamer thread started";
  80.     return true;
复制代码





tchip_askquestions

飞书20230718-113154.jpg (434.01 KB, 下载次数: 381)

飞书20230718-113154.jpg

1.txt

156.94 KB, 下载次数: 0, 下载积分: 灯泡 -1 , 经验 -1


作者: zhibiao    时间: 2023-8-25 17:09
我也遇到同样的问题,请问你问题解决了吗?




欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1