Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- avcodec_get_context_defaults3(vstrm->codec, vcodec);
- vstrm->codec->width = dst_width;
- vstrm->codec->height = dst_height;
- vstrm->codec->pix_fmt = vcodec->pix_fmts[0];
- vstrm->codec->time_base = vstrm->time_base = av_inv_q(dst_fps);
- vstrm->r_frame_rate = vstrm->avg_frame_rate = dst_fps;
- if (outctx->oformat->flags & AVFMT_GLOBALHEADER)
- vstrm->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
- // open video encoder
- ret = avcodec_open2(vstrm->codec, vcodec, nullptr);
- if (ret < 0) {
- std::cerr << "fail to avcodec_open2: ret=" << ret;
- fclose(time_fp);
- return 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement