aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--src/main.cpp33
2 files changed, 31 insertions, 6 deletions
diff --git a/TODO b/TODO
index 3420a17..8b62029 100644
--- a/TODO
+++ b/TODO
@@ -128,4 +128,6 @@ Try fixing HDR by passing HDR+10 data as well, and in the packet. Run "ffprobe -
Flac is disabled because the frame sizes are too large which causes big audio/video desync.
-Add 10-bit capture option. This is good because it reduces banding and quality in very dark areas while reducing the file size compared to doing the same thing with 8-bits. \ No newline at end of file
+Add 10-bit capture option. This is good because it reduces banding and quality in very dark areas while reducing the file size compared to doing the same thing with 8-bits.
+
+Enable b-frames.
diff --git a/src/main.cpp b/src/main.cpp
index 06ce49e..445625d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2128,7 +2128,7 @@ int main(int argc, char **argv) {
file_extension = file_extension.substr(0, comma_index);
}
- const bool force_no_audio_offset = file_extension == "ts" || file_extension == "flv";
+ const bool force_no_audio_offset = is_livestream || (file_extension != "mp4" && file_extension == "mkv" && file_extension != "webm");
if(egl.gpu_info.vendor != GSR_GPU_VENDOR_NVIDIA && file_extension == "mkv" && strcmp(video_codec_to_use, "h264") == 0) {
video_codec_to_use = "hevc";
@@ -2215,10 +2215,33 @@ int main(int argc, char **argv) {
// TODO: Allow hevc, vp9 and av1 in (enhanced) flv (supported since ffmpeg 6.1)
const bool is_flv = strcmp(file_extension.c_str(), "flv") == 0;
- if(video_codec != VideoCodec::H264 && is_flv) {
- video_codec_to_use = "h264";
- video_codec = VideoCodec::H264;
- fprintf(stderr, "Warning: hevc/av1 is not compatible with flv, falling back to h264 instead.\n");
+ if(is_flv) {
+ if(video_codec != VideoCodec::H264) {
+ video_codec_to_use = "h264";
+ video_codec = VideoCodec::H264;
+ fprintf(stderr, "Warning: hevc/av1 is not compatible with flv, falling back to h264 instead.\n");
+ }
+
+ if(audio_codec != AudioCodec::AAC) {
+ audio_codec_to_use = "aac";
+ audio_codec = AudioCodec::AAC;
+ fprintf(stderr, "Warning: flv only supports aac, falling back to aac instead.\n");
+ }
+ }
+
+ const bool is_hls = strcmp(file_extension.c_str(), "m3u8") == 0;
+ if(is_hls) {
+ if(video_codec == VideoCodec::AV1 || video_codec == VideoCodec::AV1_HDR) {
+ video_codec_to_use = "hevc";
+ video_codec = VideoCodec::HEVC;
+ fprintf(stderr, "Warning: av1 is not compatible with hls (m3u8), falling back to hevc instead.\n");
+ }
+
+ if(audio_codec != AudioCodec::AAC) {
+ audio_codec_to_use = "aac";
+ audio_codec = AudioCodec::AAC;
+ fprintf(stderr, "Warning: hls (m3u8) only supports aac, falling back to aac instead.\n");
+ }
}
const AVCodec *video_codec_f = nullptr;