aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-08-31 23:22:14 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-31 23:22:14 +0200
commit5537ebad6d6548f38a3a702dcd63f7ae821eb4a1 (patch)
tree4f1827ce56c6822995c4e24ae73a298f9dea2bfc
parentc94ce44dbeb1156cd9c9ac1ae9d40248ce6c491e (diff)
Add medium quality
-rw-r--r--src/main.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 74e61f9..3121044 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -88,6 +88,7 @@ struct WindowPixmap {
};
enum class VideoQuality {
+ MEDIUM,
HIGH,
ULTRA
};
@@ -449,6 +450,14 @@ static AVStream *add_video_stream(AVFormatContext *av_format_context, AVCodec **
codec_context->pix_fmt = AV_PIX_FMT_CUDA;
codec_context->color_range = AVCOL_RANGE_JPEG;
switch(video_quality) {
+ case VideoQuality::MEDIUM:
+ codec_context->bit_rate = 5000000 + (codec_context->width * codec_context->height) / 2;
+ codec_context->qmin = 16;
+ codec_context->qmax = 23;
+ //av_opt_set(codec_context->priv_data, "preset", "slow", 0);
+ //av_opt_set(codec_context->priv_data, "profile", "high", 0);
+ //codec_context->profile = FF_PROFILE_H264_HIGH;
+ break;
case VideoQuality::HIGH:
codec_context->qmin = 12;
codec_context->qmax = 18;
@@ -668,12 +677,14 @@ int main(int argc, char **argv) {
quality_str = "high";
VideoQuality quality;
- if(strcmp(quality_str, "high") == 0) {
+ if(strcmp(quality_str, "medium") == 0) {
+ quality = VideoQuality::MEDIUM;
+ } else if(strcmp(quality_str, "high") == 0) {
quality = VideoQuality::HIGH;
} else if(strcmp(quality_str, "ultra") == 0) {
quality = VideoQuality::ULTRA;
} else {
- fprintf(stderr, "Error: -q should either be 'high' or 'ultra', got: %s\n", quality_str);
+ fprintf(stderr, "Error: -q should either be either 'medium', 'high' or 'ultra', got: '%s'\n", quality_str);
usage();
}