作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过 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
是 AV_NOPTS_VALUE
, 意思是 start_time_realtime
ffmpeg 不知道。
关于ffmpeg - 如何通过 ffmpeg (C++) 获取 rtsp-sesson 的开始时间? start_time_realtime 始终等于 -9223372036854775808,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57159581/
我正在尝试通过 rtsp 获取帧并计算其真实世界的时间戳。我以前为此使用过 Live555(presentationTime)。 据我了解,ffmpeg 不提供这样的功能,但提供了读取每一帧的相对时间
我是一名优秀的程序员,十分优秀!