aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-07-03 02:35:35 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-03 02:36:38 +0200
commitef3767d750e82539198554277c493a8675360f44 (patch)
treee9a8f961790c916be5129b36905bbf5c88b5001c /src
parent5bfbdec58f6ac84e509038c1bd1523e6e04fbbd0 (diff)
Improve video quality
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 102e938..3a0635c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -377,7 +377,7 @@ static AVStream *add_video_stream(AVFormatContext *av_format_context, AVCodec **
fprintf(stderr, "codec id: %d\n", (*codec)->id);
codec_context->width = window_pixmap.texture_width & ~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
// of which frame timestamps are represented. For fixed-fps content,
// 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->sample_aspect_ratio.num = 1;
codec_context->sample_aspect_ratio.den = 1;
- codec_context->gop_size =
- 32; // Emit one intra frame every 32 frames at most
+ codec_context->gop_size = fps * 2;
codec_context->max_b_frames = 2;
codec_context->pix_fmt = AV_PIX_FMT_CUDA;
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);
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;
bool window_resized = false;
int fps_counter = 0;