From c63fbf02f42e172d55698c7836584a75fd097c37 Mon Sep 17 00:00:00 2001 From: Ender <33337309+e3ndr@users.noreply.github.com> Date: Mon, 25 Sep 2023 02:41:32 -0500 Subject: [PATCH] Server: Fiddle with the codecs. Fixed some quality issues. --- .../e3ndr/athena/transcoding/FFMpegArgs.java | 17 ++++++++++++----- .../java/xyz/e3ndr/athena/types/VideoCodec.java | 2 +- .../xyz/e3ndr/athena/types/VideoQuality.java | 10 +++++----- .../java/xyz/e3ndr/athena/webui/UIRoutes.java | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/server/src/main/java/xyz/e3ndr/athena/transcoding/FFMpegArgs.java b/server/src/main/java/xyz/e3ndr/athena/transcoding/FFMpegArgs.java index e724d2b..67af394 100644 --- a/server/src/main/java/xyz/e3ndr/athena/transcoding/FFMpegArgs.java +++ b/server/src/main/java/xyz/e3ndr/athena/transcoding/FFMpegArgs.java @@ -19,7 +19,7 @@ public static List a_getFF(AudioCodec codec) { return Arrays.asList("-c:a", "libopus", "-b:a", "128k"); case AAC: - return Arrays.asList("-c:a", "aac", "-b:a", "96k"); + return Arrays.asList("-c:a", "aac", "-b:a", "320k"); case MP3: return Arrays.asList("-c:a", "mp3", "-b:a", "96k"); @@ -35,7 +35,7 @@ public static List v_getFF(VideoCodec codec, VideoQuality quality, boole return Arrays.asList("-c:v", "copy"); case H264_BASELINE: - case H264_MAIN: + case H264_HIGH: return getH264Args(codec, quality, enableCuda); case HEVC: @@ -73,10 +73,17 @@ private static List getH264Args(VideoCodec codec, VideoQuality quality, args.add("1.0"); break; - case H264_MAIN: + case H264_HIGH: args.add("-profile:v"); - args.add("main"); - // Let it pick the level. + args.add("high"); + args.add("-level:v"); + args.add("5.0"); + if (!enableCuda) { + args.add("-tune"); + args.add("film"); + } + args.add("-preset"); + args.add("slow"); break; default: diff --git a/server/src/main/java/xyz/e3ndr/athena/types/VideoCodec.java b/server/src/main/java/xyz/e3ndr/athena/types/VideoCodec.java index d49623f..7a21d6a 100644 --- a/server/src/main/java/xyz/e3ndr/athena/types/VideoCodec.java +++ b/server/src/main/java/xyz/e3ndr/athena/types/VideoCodec.java @@ -4,7 +4,7 @@ public enum VideoCodec { SOURCE, H264_BASELINE, - H264_MAIN, + H264_HIGH, HEVC, diff --git a/server/src/main/java/xyz/e3ndr/athena/types/VideoQuality.java b/server/src/main/java/xyz/e3ndr/athena/types/VideoQuality.java index 3d4d823..744e03a 100644 --- a/server/src/main/java/xyz/e3ndr/athena/types/VideoQuality.java +++ b/server/src/main/java/xyz/e3ndr/athena/types/VideoQuality.java @@ -5,11 +5,11 @@ @AllArgsConstructor public enum VideoQuality { // @formatter:off - UHD(2160, 10000), - FHD(1080, 4000), - HD (720, 2500), - SD (480, 1000), - LD (240, 450), + UHD(2160, 25000), + FHD(1080, 7500), + HD (720, 4000), + SD (480, 1500), + LD (240, 500), // @formatter:on ; diff --git a/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java b/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java index 4a4b69b..4e18283 100644 --- a/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java @@ -471,7 +471,7 @@ public HttpResponse onWatchSpecificMedia(SoraHttpSession session) { quality = VideoQuality.FHD; } else if (userAgent.contains("Windows Phone") || userAgent.contains("Trident/")) { container = ContainerFormat.MP4; - vCodec = VideoCodec.H264_BASELINE; + vCodec = VideoCodec.H264_HIGH; aCodec = AudioCodec.AAC; quality = VideoQuality.FHD; }