Force non av1 video codec for hls and aac, force aac for flv

This commit is contained in:
dec05eba
2024-06-03 10:11:49 +02:00
parent bccf6e2dfe
commit ac2add6f04
2 changed files with 31 additions and 6 deletions

2
TODO
View File

@@ -129,3 +129,5 @@ 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.
Enable b-frames.

View File

@@ -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,12 +2215,35 @@ 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) {
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;
switch(video_codec) {
case VideoCodec::H264: