priv->vcodec_ctx->bit_rate = 1024 * 1024;
priv->vcodec_ctx->width = 1920;
priv->vcodec_ctx->height = 1080;
- priv->vcodec_ctx->time_base = (AVRational){1, 25};
+ priv->vcodec_ctx->time_base = (AVRational){1, 24};
priv->vcodec_ctx->gop_size = 30;
priv->vcodec_ctx->max_b_frames = 1;
priv->vcodec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
static int __ffmpeg_encode(simp_avio_t* io, AVCodecContext* c, AVPacket* pkt, AVFrame* frame, int idx)
{
simp_ffmpeg_t* priv = io->priv;
- AVStream* s = NULL;
+ AVStream* s = priv->fmt_ctx->streams[idx];
+
+ int64_t pts = frame->pts;
+
+ frame->pts = frame->pts * av_q2d(c->time_base) / av_q2d(s->time_base);
int ret = avcodec_send_frame(c, frame);
if (ret < 0) {
return ret;
}
- int64_t pts = pkt->pts;
-
- s = priv->fmt_ctx->streams[idx];
-
pkt->stream_index = idx;
-// pkt->pts = pkt->pts * av_q2d(c->time_base) / av_q2d(s->time_base);
-
scf_logw("idx: %d, frame->pts: %ld, pkt->stream_index: %d, pkt->pts: %ld, pts: %ld, c->time_base: %d:%d, s->time_base: %d:%d\n",
idx, frame->pts, pkt->stream_index, pkt->pts, pts, c->time_base.num, c->time_base.den, s->time_base.num, s->time_base.den);
av_get_sample_fmt_name(io->sample_fmt),
av_get_default_channel_layout(io->channels));
+ printf("%s\n", args);
+
ret = avfilter_graph_create_filter(&io->abuffersrc_ctx, abuffersrc, "in", args, NULL, f->agraph);
if (ret < 0)
goto end;