2018-07-04 10:12:41 +02:00
|
|
|
From: Jan Engelhardt <jengelh@inai.de>
|
|
|
|
|
|
|
|
Edit the default codec selection such that
|
|
|
|
|
|
|
|
ffmpeg -i youtube.blah.webm foobar.mkv
|
|
|
|
|
|
|
|
without any further arguments can produce a result even on a
|
|
|
|
reduced codec selection list.
|
|
|
|
|
|
|
|
---
|
|
|
|
libavformat/matroskaenc.c | 19 +++++++++++++------
|
|
|
|
1 file changed, 13 insertions(+), 6 deletions(-)
|
|
|
|
|
2021-07-10 12:30:49 +02:00
|
|
|
Index: b/libavformat/matroskaenc.c
|
2018-07-04 10:12:41 +02:00
|
|
|
===================================================================
|
2021-07-10 12:30:49 +02:00
|
|
|
--- a/libavformat/matroskaenc.c
|
|
|
|
+++ b/libavformat/matroskaenc.c
|
|
|
|
@@ -2834,16 +2834,24 @@ static const AVClass matroska_class = {
|
2018-07-04 10:12:41 +02:00
|
|
|
.version = LIBAVUTIL_VERSION_INT,
|
|
|
|
};
|
|
|
|
|
|
|
|
+#define PREFAUDIO \
|
|
|
|
+ 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
|
|
|
|
AVOutputFormat ff_matroska_muxer = {
|
|
|
|
.name = "matroska",
|
|
|
|
.long_name = NULL_IF_CONFIG_SMALL("Matroska"),
|
|
|
|
.mime_type = "video/x-matroska",
|
|
|
|
.extensions = "mkv",
|
|
|
|
.priv_data_size = sizeof(MatroskaMuxContext),
|
|
|
|
- .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
|
|
|
|
- AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
|
|
|
|
- .video_codec = CONFIG_LIBX264_ENCODER ?
|
|
|
|
- AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
|
|
|
|
+ .audio_codec = PREFAUDIO,
|
|
|
|
+ .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,
|
|
|
|
.init = mkv_init,
|
2020-06-17 18:37:53 +02:00
|
|
|
.deinit = mkv_deinit,
|
2018-07-04 10:12:41 +02:00
|
|
|
.write_header = mkv_write_header,
|
2021-07-10 12:30:49 +02:00
|
|
|
@@ -2905,8 +2913,7 @@ AVOutputFormat ff_matroska_audio_muxer =
|
2018-07-04 10:12:41 +02:00
|
|
|
.mime_type = "audio/x-matroska",
|
|
|
|
.extensions = "mka",
|
|
|
|
.priv_data_size = sizeof(MatroskaMuxContext),
|
|
|
|
- .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
|
|
|
|
- AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
|
|
|
|
+ .audio_codec = PREFAUDIO,
|
|
|
|
.video_codec = AV_CODEC_ID_NONE,
|
|
|
|
.init = mkv_init,
|
2020-06-17 18:37:53 +02:00
|
|
|
.deinit = mkv_deinit,
|