gpt4 book ai didi

ffmpeg - 如何通过 ffmpeg (C++) 获取 rtsp-sesson 的开始时间? start_time_realtime 始终等于 -9223372036854775808

转载 作者:行者123 更新时间:2023-12-04 22:50:16 24 4
gpt4 key购买 nike

我正在尝试通过 rtsp 获取帧并计算其真实世界的时间戳。我以前为此使用过 Live555(presentationTime)。

据我了解,ffmpeg 不提供这样的功能,但提供了读取每一帧的相对时间和流的开始时间的能力。在我的情况下,帧时间戳( pts )工作正常,但流开始时间( start_time_realtime )始终为 -9223372036854775808。

我正在尝试使用此 Q 中的简单示例:https://stackoverflow.com/a/11054652/5355846

值不变。无论代码中的位置如何

int main(int argc, char** argv) {
// Open the initial context variables that are needed
SwsContext *img_convert_ctx;
AVFormatContext* format_ctx = avformat_alloc_context();
AVCodecContext* codec_ctx = NULL;
int video_stream_index;

// Register everything
av_register_all();
avformat_network_init();

//open RTSP
if (avformat_open_input(&format_ctx, "path_to_rtsp_stream",
NULL, NULL) != 0) {
return EXIT_FAILURE;
}
...
}
while (av_read_frame(format_ctx, &packet) >= 0 && cnt < 1000) { //read ~ 1000 frames

//// here!
std::cout<< " ***** "
<< std::to_string(format_ctx->start_time_realtime)
<< " | "<<format_ctx->start_time
<< " | "<<packet.pts
<< " | "
<<picture->best_effort_timestamp;

...
}

***** -9223372036854775808 | 0 | 4120 | 40801 车架:103

我究竟做错了什么?

最佳答案

-9223372036854775808AV_NOPTS_VALUE , 意思是 start_time_realtime ffmpeg 不知道。

关于ffmpeg - 如何通过 ffmpeg (C++) 获取 rtsp-sesson 的开始时间? start_time_realtime 始终等于 -9223372036854775808,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57159581/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com