Skip to content

Commit

Permalink
Server: Fiddle with the codecs.
Browse files Browse the repository at this point in the history
Fixed some quality issues.
  • Loading branch information
e3ndr committed Sep 25, 2023
1 parent fd42b66 commit c63fbf0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
17 changes: 12 additions & 5 deletions server/src/main/java/xyz/e3ndr/athena/transcoding/FFMpegArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static List<String> 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");
Expand All @@ -35,7 +35,7 @@ public static List<String> 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:
Expand Down Expand Up @@ -73,10 +73,17 @@ private static List<String> 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public enum VideoCodec {
SOURCE,

H264_BASELINE,
H264_MAIN,
H264_HIGH,

HEVC,

Expand Down
10 changes: 5 additions & 5 deletions server/src/main/java/xyz/e3ndr/athena/types/VideoQuality.java
Original file line number Diff line number Diff line change
Expand Up @@ -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

;
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c63fbf0

Please sign in to comment.