aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-05-19 23:56:53 +0200
committerdec05eba <dec05eba@protonmail.com>2024-05-19 23:58:53 +0200
commitdda2de856c4ba0c273be077bfcebd0e5e2fe9970 (patch)
tree1ea47ceb0ae79753fd6d8dc8dc1e7476835345d0 /src
parente12ac44909e733c367436d0c3019d673256bf681 (diff)
Support av1 webm (force opus audio for .webm files)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 1c5024b..45d6079 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1209,6 +1209,7 @@ static void save_replay_async(AVCodecContext *video_codec_context, int video_str
av_packet.pts = save_replay_packets[i]->data.pts;
av_packet.dts = save_replay_packets[i]->data.pts;
av_packet.flags = save_replay_packets[i]->data.flags;
+ //av_packet.duration = save_replay_packets[i]->data.duration;
AVStream *stream = video_stream;
AVCodecContext *codec_context = video_codec_context;
@@ -2098,20 +2099,29 @@ int main(int argc, char **argv) {
switch(audio_codec) {
case AudioCodec::AAC: {
+ if(file_extension == "webm") {
+ audio_codec_to_use = "opus";
+ audio_codec = AudioCodec::OPUS;
+ fprintf(stderr, "Warning: .webm files only support opus audio codec, changing audio codec from aac to opus\n");
+ }
break;
}
case AudioCodec::OPUS: {
// TODO: Also check mpegts?
- if(file_extension != "mp4" && file_extension != "mkv") {
+ if(file_extension != "mp4" && file_extension != "mkv" && file_extension != "webm") {
audio_codec_to_use = "aac";
audio_codec = AudioCodec::AAC;
- fprintf(stderr, "Warning: opus audio codec is only supported by .mp4 and .mkv files, falling back to aac instead\n");
+ fprintf(stderr, "Warning: opus audio codec is only supported by .mp4, .mkv and .webm files, falling back to aac instead\n");
}
break;
}
case AudioCodec::FLAC: {
// TODO: Also check mpegts?
- if(file_extension != "mp4" && file_extension != "mkv") {
+ if(file_extension == "webm") {
+ audio_codec_to_use = "opus";
+ audio_codec = AudioCodec::OPUS;
+ fprintf(stderr, "Warning: .webm files only support opus audio codec, changing audio codec from flac to opus\n");
+ } else if(file_extension != "mp4" && file_extension != "mkv") {
audio_codec_to_use = "aac";
audio_codec = AudioCodec::AAC;
fprintf(stderr, "Warning: flac audio codec is only supported by .mp4 and .mkv files, falling back to aac instead\n");