It does it only when the chnl box is to be written. The specification for the chnl box (ISO 14496-12) requires proper number of channels to be written here is it is used, and without the proper number of channels available it becomes tricky to parse the data, as the number of channels in this box comes from that value.
Signed-off-by: Erkki Seppälä <erkki.seppala....@nokia.com> Signed-off-by: OZOPlayer <oz...@nokia.com> --- libavformat/movenc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 6e179ef..bbd176f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1031,7 +1031,13 @@ static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex avio_wb16(pb, 16); avio_wb16(pb, track->audio_vbr ? -2 : 0); /* compression ID */ } else { /* reserved for mp4/3gp */ - avio_wb16(pb, 2); + /* parsing chln box requires the proper number of channels having been + written into the audio header */ + if (av_stream_get_side_data(track->st, AV_PKT_DATA_AUDIO_TRACK_CHANNEL_LAYOUT, + NULL)) + avio_wb16(pb, track->par->channels); + else + avio_wb16(pb, 2); avio_wb16(pb, 16); avio_wb16(pb, 0); } -- 2.7.4 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel