aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-10-15 22:23:08 +0200
committerdec05eba <dec05eba@protonmail.com>2022-10-15 22:23:08 +0200
commit3266868c0a36f74aa71a4022300f766d48a2ee05 (patch)
tree013a7c375600e3e454bc08581854157823c61951 /src
parent9d65552d057a7a629ead9758f7627f0c7879bf4a (diff)
Fix livestreaming: flv does not properly fallback to h264
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b449666..28c4079 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -861,6 +861,9 @@ static void open_video(AVCodecContext *codec_context,
av_dict_set(&options, "tune", "hq", 0);
av_dict_set(&options, "rc", "constqp", 0);
+ if(codec_context->codec_id == AV_CODEC_ID_H264)
+ av_dict_set(&options, "profile", "high", 0);
+
ret = avcodec_open2(codec_context, codec_context->codec, &options);
if (ret < 0) {
fprintf(stderr, "Error: Could not open video codec: %s\n",
@@ -1486,6 +1489,12 @@ int main(int argc, char **argv) {
}
}
+ //bool use_hevc = strcmp(window_str, "screen") == 0 || strcmp(window_str, "screen-direct") == 0;
+ if(video_codec != VideoCodec::H264 && strcmp(container_format, "flv") == 0) {
+ video_codec = VideoCodec::H264;
+ fprintf(stderr, "Warning: h265 is not compatible with flv, falling back to h264 instead.\n");
+ }
+
const AVCodec *video_codec_f = nullptr;
switch(video_codec) {
case VideoCodec::H264:
@@ -1524,12 +1533,6 @@ int main(int argc, char **argv) {
requested_audio_inputs.push_back({ "", "gsr-silent" });
}
- //bool use_hevc = strcmp(window_str, "screen") == 0 || strcmp(window_str, "screen-direct") == 0;
- if(video_codec != VideoCodec::H264 && strcmp(container_format, "flv") == 0) {
- video_codec = VideoCodec::H264;
- fprintf(stderr, "Warning: h265 is not compatible with flv, falling back to h264 instead.\n");
- }
-
AVStream *video_stream = nullptr;
std::vector<AudioTrack> audio_tracks;