Improve video quality
This commit is contained in:
parent
5bfbdec58f
commit
ef3767d750
@ -377,7 +377,7 @@ static AVStream *add_video_stream(AVFormatContext *av_format_context, AVCodec **
|
|||||||
fprintf(stderr, "codec id: %d\n", (*codec)->id);
|
fprintf(stderr, "codec id: %d\n", (*codec)->id);
|
||||||
codec_context->width = window_pixmap.texture_width & ~1;
|
codec_context->width = window_pixmap.texture_width & ~1;
|
||||||
codec_context->height = window_pixmap.texture_height & ~1;
|
codec_context->height = window_pixmap.texture_height & ~1;
|
||||||
codec_context->bit_rate = 3000000 + (codec_context->width * codec_context->height) / 2; //5000000 * ((double)fps / 30.0) + (codec_context->width * codec_context->height) / 2;
|
codec_context->bit_rate = 3500000 + (codec_context->width * codec_context->height) / 2; //5000000 * ((double)fps / 30.0) + (codec_context->width * codec_context->height) / 2;
|
||||||
// Timebase: This is the fundamental unit of time (in seconds) in terms
|
// Timebase: This is the fundamental unit of time (in seconds) in terms
|
||||||
// of which frame timestamps are represented. For fixed-fps content,
|
// of which frame timestamps are represented. For fixed-fps content,
|
||||||
// timebase should be 1/framerate and timestamp increments should be
|
// timebase should be 1/framerate and timestamp increments should be
|
||||||
@ -388,8 +388,7 @@ static AVStream *add_video_stream(AVFormatContext *av_format_context, AVCodec **
|
|||||||
// codec_context->framerate.den = 1;
|
// codec_context->framerate.den = 1;
|
||||||
codec_context->sample_aspect_ratio.num = 1;
|
codec_context->sample_aspect_ratio.num = 1;
|
||||||
codec_context->sample_aspect_ratio.den = 1;
|
codec_context->sample_aspect_ratio.den = 1;
|
||||||
codec_context->gop_size =
|
codec_context->gop_size = fps * 2;
|
||||||
32; // Emit one intra frame every 32 frames at most
|
|
||||||
codec_context->max_b_frames = 2;
|
codec_context->max_b_frames = 2;
|
||||||
codec_context->pix_fmt = AV_PIX_FMT_CUDA;
|
codec_context->pix_fmt = AV_PIX_FMT_CUDA;
|
||||||
if (codec_context->codec_id == AV_CODEC_ID_MPEG1VIDEO)
|
if (codec_context->codec_id == AV_CODEC_ID_MPEG1VIDEO)
|
||||||
@ -753,7 +752,7 @@ int main(int argc, char **argv) {
|
|||||||
// res = cuGraphicsUnmapResources(1, &cuda_graphics_resource, 0);
|
// res = cuGraphicsUnmapResources(1, &cuda_graphics_resource, 0);
|
||||||
|
|
||||||
double start_time = glfwGetTime();
|
double start_time = glfwGetTime();
|
||||||
double frame_timer_start = start_time - target_fps - 0.001;
|
double frame_timer_start = start_time;
|
||||||
double window_resize_timer = start_time;
|
double window_resize_timer = start_time;
|
||||||
bool window_resized = false;
|
bool window_resized = false;
|
||||||
int fps_counter = 0;
|
int fps_counter = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user