不推荐使用 AVStream.codec.time_base 作为复用器的时基提示.改为设置AVStream.time_
Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead
我正在使用MMPEG
的C
API并收到此消息。所以我在我的直播中添加了time_base
videoStream = avformat_new_stream(formatContext, codec);
videoStream->time_base = AVRational{1, fps};
并在上下文中摆脱了它
codecContext->bit_rate = 400000;
codecContext->width = width;
codecContext->height = height;
codecContext->gop_size = 10;
codecContext->max_b_frames = 1;
//codecContext->time_base = AVRational{1, fps};
codecContext->pix_fmt = AV_PIX_FMT_YUV420P;
avcodec_open2(codecContext, codec, NULL)
立即中断
为什么?我是否需要将值应用于它们?我已经将值复制到了两者,并且消息消失了。但这不是错了吗?
设置codecContext->time_base
值是必需的,不应跳过。取消注释,您应该没事。另请参阅 ffmpeg 提供的代码示例。
至于为什么需要这两个值:AVStream
和AVCodecContext
是两种不同的结构,可能会也可能不会一起使用,具体取决于您的代码需要做什么。他们都需要一个time_base
所以他们都有。您可以称其为 ffmpeg 代码库中的众多特性之一。
相关文章:
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 为什么我会收到"Run-Time Check Failure #2 - Stack around the variable 'pr' was corrupted"错误?
- 解析某些行的文本和输出"time of appearance"
- 返回time()库函数的数据类型
- 如何将 time-uuid(存储在 boost uuid 中)转换为时间戳/自纪元以来的时间?
- 如何从 boost::p osix_time::p time 获取秒数
- 调用 dll 函数时"Run-Time Check Failure #0 - The value of ESP"
- C++ SRAND(time(0)) 在猜谜游戏中不起作用
- 即使包含 <time.h 后仍"‘CLOCK_PER_SEC’ was not declared in this scope"错误>
- struct TM time;vs TM time = {}.输出相同但不相同?
- 使用 Windows 寄存器查找下一个"Daylight Saving Time"
- c++ get millsecond time
- "Feature X requires run-time support"的含义是什么?
- 如何传递以 "size determined at run time" 作为引用的动态分配数组?
- constexpr - "Evaluate value at compile time"到底是什么意思?
- "Time"库形式 Arduino 显示不正确的值
- 自定义 Python 构建 - time.so:未定义的符号:PyExc_ValueError
- C++名称查找来自 <time.h 的函数>
- 不推荐使用 AVStream.codec.time_base 作为复用器的时基提示.改为设置AVStream.time_
- 为什么即使我反复重置它,srand(time(NULL))也能顺利工作