Hi, On Tue, Feb 22, 2011 at 10:45 PM, hz nan <[email protected]> wrote: > hi all, > I use libavcodec to encode audio using ac3, in my system, and avcodec_open > success. > but using the same code in one other system, the returen value of > avcodec_open is always negative. > whether I use it correctly and what should I check for the system? > Thanks > nanhongzhen > > pCodec=avcodec_find_encoder(CODEC_ID_AC3); > > pCodecCtx=avcodec_alloc_context(); > > pCodecCtx->channels=2; > > pCodecCtx->sample_rate=44100; > > pCodecCtx->bit_rate=64000; > > pCodecCtx->bit_rate_tolerance=1; > > pCodecCtx->codec_type=CODEC_TYPE_AUDIO; > > pCodecCtx->channel_layout=3; > > if(pCodec->capabilities & CODEC_CAP_TRUNCATED){ > > pCodecCtx->flags|=CODEC_FLAG_TRUNCATED; > > } > > while(avcodec_open(pCodecCtx,pCodec)<0);
Set pCodecCtx->sample_fmt. Ronald _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
