ffmpeg/ffmpeg-codec-choice.patch

58 lines
2.1 KiB
Diff
Raw Normal View History

2022-02-11 19:18:52 +00:00
From: Jan Engelhardt <jengelh@inai.de>
Edit the default codec selection such that
2023-03-12 05:44:10 +00:00
ffmpeg -i youtube.blah.webm foobar.mkv
2022-02-11 19:18:52 +00:00
without any further arguments can produce a result even on a
reduced codec selection list.
---
2023-03-12 05:44:10 +00:00
libavformat/matroskaenc.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
2022-02-11 19:18:52 +00:00
2023-03-12 05:44:10 +00:00
Index: ffmpeg-6.0/libavformat/matroskaenc.c
2022-02-11 19:18:52 +00:00
===================================================================
2023-03-12 05:44:10 +00:00
--- ffmpeg-6.0.orig/libavformat/matroskaenc.c
+++ ffmpeg-6.0/libavformat/matroskaenc.c
@@ -3321,16 +3321,25 @@ static int mkv_query_codec(enum AVCodecI
2022-02-11 19:18:52 +00:00
return 0;
}
+#define PREFAUDIO \
2023-03-12 05:44:10 +00:00
+ CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : \
+ CONFIG_AAC_ENCODER ? AV_CODEC_ID_AAC : \
+ CONFIG_VORBIS_ENCODER ? AV_CODEC_ID_VORBIS : \
+ AV_CODEC_ID_AC3
+
const FFOutputFormat ff_matroska_muxer = {
.p.name = "matroska",
.p.long_name = NULL_IF_CONFIG_SMALL("Matroska"),
.p.mime_type = "video/x-matroska",
.p.extensions = "mkv",
2022-02-11 19:18:52 +00:00
.priv_data_size = sizeof(MatroskaMuxContext),
2023-03-12 05:44:10 +00:00
- .p.audio_codec = CONFIG_LIBVORBIS_ENCODER ?
2022-02-11 19:18:52 +00:00
- AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
2023-03-12 05:44:10 +00:00
- .p.video_codec = CONFIG_LIBX264_ENCODER ?
2022-02-11 19:18:52 +00:00
- AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
2023-03-12 05:44:10 +00:00
+ .p.audio_codec = PREFAUDIO,
+ .p.video_codec =
+ CONFIG_LIBVPX_VP9_ENCODER ? AV_CODEC_ID_VP9 : \
+ CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : \
+ CONFIG_LIBVPX_VP8_ENCODER ? AV_CODEC_ID_VP8 : \
+ CONFIG_MPEG4_ENCODER ? AV_CODEC_ID_MPEG4 : \
+ AV_CODEC_ID_THEORA,
2022-02-11 19:18:52 +00:00
.init = mkv_init,
.deinit = mkv_deinit,
.write_header = mkv_write_header,
2023-03-12 05:44:10 +00:00
@@ -3388,8 +3397,7 @@ const FFOutputFormat ff_matroska_audio_m
.p.mime_type = "audio/x-matroska",
.p.extensions = "mka",
2022-02-11 19:18:52 +00:00
.priv_data_size = sizeof(MatroskaMuxContext),
2023-03-12 05:44:10 +00:00
- .p.audio_codec = CONFIG_LIBVORBIS_ENCODER ?
2022-02-11 19:18:52 +00:00
- AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
2023-03-12 05:44:10 +00:00
+ .p.audio_codec = PREFAUDIO,
.p.video_codec = AV_CODEC_ID_NONE,
2022-02-11 19:18:52 +00:00
.init = mkv_init,
.deinit = mkv_deinit,