Add configurable variable QP for video
This commit is contained in:
@@ -103,6 +103,7 @@ void encodeThread(
|
||||
ctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
ctx->max_b_frames = config::video.max_b_frames;
|
||||
ctx->gop_size = config::video.gop_size;
|
||||
ctx->has_b_frames = 1;
|
||||
|
||||
ctx->slices = config.slicesPerFrame;
|
||||
ctx->thread_type = FF_THREAD_SLICE;
|
||||
@@ -114,8 +115,13 @@ void encodeThread(
|
||||
av_dict_set(&options, "preset", config::video.preset.c_str(), 0);
|
||||
av_dict_set(&options, "tune", config::video.tune.c_str(), 0);
|
||||
|
||||
av_dict_set_int(&options, "crf", config::video.crf, 0);
|
||||
|
||||
if(config::video.crf != 0) {
|
||||
av_dict_set_int(&options, "crf", config::video.crf, 0);
|
||||
}
|
||||
else {
|
||||
av_dict_set_int(&options, "qp", config::video.qp, 0);
|
||||
}
|
||||
|
||||
ctx->flags |= (AV_CODEC_FLAG_CLOSED_GOP | AV_CODEC_FLAG_LOW_DELAY);
|
||||
ctx->flags2 |= AV_CODEC_FLAG2_FAST;
|
||||
|
||||
@@ -126,7 +132,6 @@ void encodeThread(
|
||||
yuv_frame->width = ctx->width;
|
||||
yuv_frame->height = ctx->height;
|
||||
|
||||
// yuv_frame->opaque = 0;
|
||||
av_frame_get_buffer(yuv_frame.get(), 0);
|
||||
|
||||
int64_t frame = 1;
|
||||
@@ -146,8 +151,6 @@ void encodeThread(
|
||||
if(idr_events->peek()) {
|
||||
yuv_frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
frame = idr_events->pop()->first;
|
||||
|
||||
// ++yuv_frame->opaque;
|
||||
}
|
||||
|
||||
encode(frame++, ctx, sws, yuv_frame, img, packets);
|
||||
|
||||
Reference in New Issue
Block a user