EZreal-zhangxing / rk_ffmpeg

在rockchip3588上实现用ffmpeg进行推拉流,其中推拉流使用硬件加速编解码
43 stars 8 forks source link

存储到本地文件时,出现问题 #7

Closed tu-nie closed 1 month ago

tu-nie commented 3 months ago

[h264 @ 0x7f34005520] non-existing PPS 0 referenced [h264 @ 0x7f34005520] non-existing PPS 0 referenced [h264 @ 0x7f34005520] decode_slice_header error [h264 @ 0x7f34005520] no frame! [h264 @ 0x7f34005520] Missing reference picture, default is 0 [h264 @ 0x7f34005520] decode_slice_header error

EZreal-zhangxing commented 3 months ago

这个是存储的时候没有带上PPS信息,这个头信息存在编码器里 1.如果你是通过ffmpeg申明编码器可以通过 编码器的上下文(codecContext)获取,见rtsp_with_ffmpeg_using_opencv:413

  1. 如果你是通过mpp进行编解码,可以通过MPP_ENC_GET_HDR_SYNC 指令来获取,见rtsp_with_mpp_using_opencv:280
tu-nie commented 3 months ago

如果你是通过ffmpeg申明编码器可以通过 编码器的上下文(codecContext)获取,见rtsp_with_ffmpeg_using_opencv:413 您好,我看的就是这个代码,我只不过存储到的是本地h264文件

范宇俊玉 @.***

 

------------------ 原始邮件 ------------------ 发件人: "EZreal-zhangxing/rk_ffmpeg" @.>; 发送时间: 2024年7月1日(星期一) 上午10:40 @.>; @.**@.>; 主题: Re: [EZreal-zhangxing/rk_ffmpeg] 存储到本地文件时,出现问题 (Issue #7)

这个是存储的时候没有带上PPS信息,这个头信息存在编码器里 1.如果你是通过ffmpeg申明编码器可以通过 编码器的上下文(codecContext)获取,见rtsp_with_ffmpeg_using_opencv:413

如果你是通过mpp进行编解码,可以通过MPP_ENC_GET_HDR_SYNC 指令来获取,见rtsp_with_mpp_using_opencv:280

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

EZreal-zhangxing commented 3 months ago

你存储的时候带上开始码了么(00,00,00,01)

tu-nie commented 3 months ago

您好,我在init_encoder函数里,增加的打开输出文件。 this->video_path = SetControl::getInstance()->getSetting_videopath(); this->path = video_path + "/" + name + ".h264"; this->outformat = av_guess_format(nullptr, path.toStdString().c_str(), nullptr); if (outformat == nullptr) { qDebug() << "Could not guess output format" ; return -1; } formatCtx->oformat = outformat; // 设置输出格式 stream = avformat_new_stream(formatCtx,codec); if(!stream){ qDebug()<<"create stream failed!"; return -1; } stream->time_base = (AVRational){1,25}; // 设置帧率 stream->id = formatCtx->nb_streams - 1; // 设置流的索引 stream->codecpar->codec_tag = 0; res = avcodec_parameters_from_context(stream->codecpar,codecCtx); if(res < 0){ qDebug()<<"copy parameters to stream failed!"; return -1; } // 打开输出文件IO if (!(outformat->flags & AVFMT_NOFILE)) { res = avio_open2(&pformatContext->pb, this->path.toStdString().c_str(), AVIO_FLAG_WRITE,NULL,NULL); if (res < 0) { qDebug()<<"avio open failed !"; return -1; } }没太看懂你说的这个 “你存储的时候带上开始码了么(00,00,00,01)”什么意思

范宇俊玉 @.***

 

------------------ 原始邮件 ------------------ 发件人: "EZreal-zhangxing/rk_ffmpeg" @.>; 发送时间: 2024年7月1日(星期一) 上午10:58 @.>; @.**@.>; 主题: Re: [EZreal-zhangxing/rk_ffmpeg] 存储到本地文件时,出现问题 (Issue #7)

你存储的时候带上开始码了么(00,00,00,01)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>