ffmpeg API单个核心开启多路转码,解码出来的YUV出现花屏
收藏回复举报
ffmpeg API单个核心开启多路转码,解码出来的YUV出现花屏
新人帖
发表于2026-01-16 14:33:32
0 查看

开发环境

  • HUAWEI Kunpeng 920 5220
  • Kylin Linux Advanced Server V10 (Halberd)
  • Atlas 300I Duo 推理卡
  • 宿主机驱动版本信息
    # cat driver/version.info 
    Version=25.2.0
    ascendhal_version=7.35.23
    aicpu_version=1.0
    tdt_version=1.0
    log_version=1.0
    prof_version=2.0
    dvppkernels_version=1.1
    tsfw_version=1.0
    Innerversion=V100R001C21SPC008B208
    compatible_version=[V100R001C17],[V100R001C18],[V100R001C19],[V100R001C20],[V100R001C21]
    compatible_version_fw=[6.4.0,6.4.99],[7.0.0,7.7.99]
    package_version=25.2.0
  • 容器Ascend-toolkit版本信息
    # cat ascend-toolkit/latest/version.cfg 
    # version: 1.0
    runtime_running_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    compiler_running_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    hccl_running_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    opp_running_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    toolkit_running_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    aoe_running_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    ncs_running_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    runtime_upgrade_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    compiler_upgrade_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    hccl_upgrade_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    opp_upgrade_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    toolkit_upgrade_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    aoe_upgrade_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    ncs_upgrade_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    runtime_installed_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    compiler_installed_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    hccl_installed_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    opp_installed_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    toolkit_installed_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    aoe_installed_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
    ncs_installed_version=[8.3.T14.0.B101:8.3.RC1.alpha003]
  • ffmpeg 版本信息
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.3.1 (GCC)
configuration: --prefix=/usr/local/aiserver_3rdparty --disable-static --enable-shared --disable-asm --disable-x86asm --disable-debug --extra-ldflags='-Wl,-rpath,/usr/local/aiserver_3rdparty/lib' --extra-cflags=-I/usr/local/Ascend/ascend-toolkit/latest/include --extra-ldflags='-L/usr/local/Ascend/ascend-toolkit/latest/lib64 -Wl,-rpath,/usr/local/Ascend/ascend-toolkit/latest/lib64' --extra-libs='-lacl_dvpp_mpi -lascendcl' --enable-ascend --enable-nonfree --enable-gpl --enable-pthreads --enable-pic --enable-network --enable-demuxers --enable-demuxer=rtsp --enable-demuxer=sdp --enable-libfreetype --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-protocols --enable-protocol=http --enable-openssl --enable-protocol=https --enable-protocol=file --enable-protocol=rtmp --enable-protocol=rtp --enable-protocol=rtmpt --enable-protocol=hls --enable-protocol=srtp --enable-protocol=tcp --enable-protocol=udp --enable-protocol=cache --disable-ffplay

应用功能简介

ffmpeg拉取rtsp视频流,ffmpeg硬解解码,预处理,目标检测,硬件编码,rtsp推理。

问题详情

单个核心上了,开启一路视频处理,推出来的视频画质正常;当我开启第二处,画质明显变差,这两路的画质都很差。

问题定位,将视频解码后的AVFrame保存为yuv,发现解码后的yuv画质就很差。

saveFrame(const AVFrame *frame, const char *file_name)
{
    FILE *fp = fopen(file_name, "wb");
    if (fp != nullptr) {
        // Copy Y plane from device to host
        uint8_t *y_data = new uint8_t[frame->linesize[0] * frame->height];
        aclError ret = aclrtMemcpy(y_data, frame->linesize[0] * frame->height,
                          frame->data[0], frame->linesize[0] * frame->height,
                          ACL_MEMCPY_DEVICE_TO_HOST);
        if (ret == ACL_ERROR_NONE) {
            // Write Y plane
            fwrite(y_data, 1, frame->linesize[0] * frame->height, fp);
            
            // Copy UV plane from device to host
            uint8_t *uv_data = new uint8_t[frame->linesize[1] * frame->height / 2];
            ret = aclrtMemcpy(uv_data, frame->linesize[1] * frame->height / 2,
                              frame->data[1], frame->linesize[1] * frame->height / 2,
                              ACL_MEMCPY_DEVICE_TO_HOST);
            if (ret == ACL_ERROR_NONE) {
                // Write UV plane
                fwrite(uv_data, 1, frame->linesize[1] * frame->height / 2, fp);
                std::cout << "NV12 frame saved to: " << file_name << std::endl;
            }
            delete[] uv_data;
        }
        delete[] y_data;
        fclose(fp);
    } else {
        std::cout << "Failed to open file for saving NV12 frame: " << file_name << std::endl;
    }

    return true;
}

请问,咱们ffmpeg的扩展是否出现过类似的问题,问题排查修复建议。是否还需要其他详细的相关信息,感谢,在线等

我要发帖子