[FFmpeg-devel] regarding Ticket 3107

anshul anshul.ffmpeg at gmail.com
Wed Jan 29 10:03:38 CET 2014


I was looking to solve the ticket 3107, since I am facing the same problem

below code snippet is taken from libavcodec/utils.c
         if (avctx->codec->sample_fmts) {
             for (i = 0; avctx->codec->sample_fmts[i] != 
                 if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
                 if (avctx->channels == 1 &&
                     av_get_planar_sample_fmt(avctx->sample_fmt) ==
av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {
                     avctx->sample_fmt = avctx->codec->sample_fmts[i];
             if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
                 char buf[128];
                 snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt);
                 av_log(avctx, AV_LOG_ERROR, "Specified sample format %s 
is invalid or not supported\n",
*)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));
                 ret = AVERROR(EINVAL);
                 goto free_and_end;

According to above code in my case avctx->channels = 2 and 
avctx->codec->sample_fmts[0]  = S16 sample format
and avctx->sample_fmt = fltp sample format.

I do have some queries for solving this problem
*1)Is there any relation of planar sample format and **number of channel?**
**2)what is the importance of avctx->channels == 1, if I remove this 
condition where our code will fall?**
Other Info:
version = master git
os = linux 3.7 custom
audio codec = mp2
video codec = mpeg2video
yuv420; 640x480


More information about the ffmpeg-devel mailing list