[FFmpeg-devel] [PATCH]lavf/mkvenc: Set bit_depth for lossless audio codecs

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Mar 12 16:51:18 CET 2016


Hi!

Attached patch makes the output of the mkv muxer more similar to what 
mkvmerge does.
May fix ticket #5332.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 05b1b94..b721dc3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -854,6 +854,9 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
         bit_depth = av_get_bytes_per_sample(codec->sample_fmt) << 3;
     if (!bit_depth)
         bit_depth = codec->bits_per_coded_sample;
+    if (   codec->codec_id == AV_CODEC_ID_FLAC
+        || codec->codec_id == AV_CODEC_ID_TTA)
+        bit_depth = codec->bits_per_raw_sample;
 
     if (codec->codec_id == AV_CODEC_ID_AAC) {
         ret = get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);


More information about the ffmpeg-devel mailing list