FFmpeg直播RGB帧缓冲区

时间:2018-02-20 18:14:45

标签: c ffmpeg rtmp

当我们有本地视频文件This code适用于流媒体时。我们想要实现的是使用我们从屏幕抓取的RGB帧缓冲区来更改输入文件。下面的代码使用输入文件handsetIds进行PTS和DTS计算。

time_base

this answer之后,PTS值增加1,每帧if(pkt.stream_index==videoindex) { AVRational time_base=ifmt_ctx->streams[videoindex]->time_base; AVRational time_base_q={1,AV_TIME_BASE}; int64_t pts_time = av_rescale_q(pkt.dts, time_base, time_base_q); int64_t now_time = av_gettime() - start_time; if (pts_time > now_time) av_usleep(pts_time - now_time); } in_stream = ifmt_ctx->streams[pkt.stream_index]; out_stream = ofmt_ctx->streams[pkt.stream_index]; /* copy packet */ //Convert PTS/DTS pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base); 保存在本地文件中或流式传输到Wowza服务器工作(低质量)但在Youtube和Twitch上失败。 VideoSt.Frame->pts = VideoSt.NextPts++;函数返回错误-22。为了提高质量,我们降低了av_interleaved_write_frameqmin值,但视频的比特率增加了太多(30Mb / s甚至更高的高清视频)。

qmax

如何使用flv1编解码器以合理的比特率传输无损质量视频?如果流式传输到Youtube或Twitch失败,这只是这项服务要求的问题,还是编码问题?

关于错误代码-22,有一个detailed explanation,它解释了我们应该如何增加PTS和DTS值。

在哪些情况下需要计算PTS和DTS值?

顺便说一下这些PTS和DTS是什么?在阅读了很多帖子并且Understanding PTS and DTS in video frames接受了答案后,我仍然不明白。

0 个答案:

没有答案
相关问题