mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-24 07:31:22 +01:00
编码开始延迟一帧输出 #218
Labels
No labels
bug
enhancement
help wanted
invalid
pull-request
question
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: starred/ffmpeg-rockchip#218
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @changliwu on GitHub (Sep 30, 2025).
编码帧率为2帧,开始时延迟一帧输出,如下:
input encode 129600(0)
input encode 176400(520)
output encode 129600(0) 1
input encode 219600(480)
output encode 176400(520) 0
input encode 266400(520)
output encode 219600(480) 0
input encode 309600(480)
output encode 266400(520) 0
input encode 356400(520)
output encode 309600(480) 0
h265编码,参数设置如下:
m_pRKEncodecCtx->pix_fmt = AV_PIX_FMT_DRM_PRIME;
m_pRKEncodecCtx->width = m_nDstW;
m_pRKEncodecCtx->height = m_nDstH;
m_pRKEncodecCtx->coded_width = m_nDstW;
m_pRKEncodecCtx->coded_height = m_nDstH;
m_pRKEncodecCtx->time_base = av_make_q(1,2);//pV.time_base;
m_pRKEncodecCtx->framerate = av_make_q(2,1);
m_pRKEncodecCtx->gop_size = m_nGopSize;
m_pRKEncodecCtx->max_b_frames = 0;
请问如何设置才能没有一帧延迟,即编码立即输出
@nyanmisaka commented on GitHub (Sep 30, 2025):
Use
-flags +low_delayto disable async encoding.https://github.com/nyanmisaka/ffmpeg-rockchip/wiki/Encoder#test-encoders
bc561013c9/libavcodec/avcodec.h (L314)@changliwu commented on GitHub (Oct 9, 2025):
h265编码时,我这样设置的 av_opt_set(m_pRKEncodecCtx->priv_data,"flags","+low_delay",0),但是输出没起作用,请问哪里有问题吗?
@changliwu commented on GitHub (Oct 9, 2025):
我按照下面的方法设置,可以了,谢谢!
m_pRKEncodecCtx->flags |= AV_CODEC_FLAG_LOW_DELAY;
av_opt_set(m_pRKEncodecCtx->priv_data, "preset", "fast", 0);
av_opt_set(m_pRKEncodecCtx->priv_data, "tune", "zerolatency", 0);