[FFmpeg-devel] [PATCH]Fix G.726 in mkv
Michael Niedermayer
michaelni at gmx.at
Mon Jan 13 02:12:43 CET 2014
On Fri, Jan 10, 2014 at 11:26:59AM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> The following command lines fail since dd5689a3
> $ ffmpeg -i input -vn -acodec g726 -ar 8k out.mkv
> $ ffmpeg -i out.mkv
>
> Attached are two (independent) patches, one fixes decoding the samples created
> since the breakage, one allows to create files that older (broken) FFmpeg can
> read.
>
> Please review, Carl Eugen
> matroskadec.c | 1 +
> matroskaenc.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
> 91911d3bf0cfe01475a70f4b0e1c5e86c579c150 patchmkvg726.diff
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index e05101f..9a7e366 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1909,6 +1909,7 @@ static int matroska_read_header(AVFormatContext *s)
> st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
> st->codec->sample_rate = track->audio.out_samplerate;
> st->codec->channels = track->audio.channels;
> + if (!st->codec->bits_per_coded_sample)
> st->codec->bits_per_coded_sample = track->audio.bitdepth;
> if (st->codec->codec_id != AV_CODEC_ID_AAC)
> st->need_parsing = AVSTREAM_PARSE_HEADERS;
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 82624b7..11174f1 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -620,7 +620,7 @@ static int mkv_write_tracks(AVFormatContext *s)
> continue;
> }
>
> - if (!bit_depth)
> + if (!bit_depth && codec->codec_id != AV_CODEC_ID_ADPCM_G726)
> bit_depth = av_get_bytes_per_sample(codec->sample_fmt) << 3;
also its possible that a better condition here would be to check for
PCM
> if (!bit_depth)
> bit_depth = codec->bits_per_coded_sample;
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140113/de569b6b/attachment.asc>
More information about the ffmpeg-devel
mailing list