[FFmpeg-user] 答复: how to use swr_convert_frame convert audio form s16p to s16

He Lei helei0908 at hotmail.com
Thu Nov 17 11:53:04 EET 2016


FFMpeg 3.2





发件人: He Lei<mailto:helei0908 at hotmail.com>
发送时间: 2016年11月17日 17:44
收件人: ffmpeg-user at ffmpeg.org<mailto:ffmpeg-user at ffmpeg.org>
主题: [FFmpeg-user] how to use swr_convert_frame convert audio form s16p to s16



Hi,
My sources like this:
              AVFrame *pOutFrame = av_frame_alloc();
              pOutFrame->channel_layout = AV_CH_LAYOUT_STEREO;
              pOutFrame->format = AVSampleFormat::AV_SAMPLE_FMT_S16;
              pOutFrame->sample_rate = 44100;
              static SwrContext* m_pSwrCtx = swr_alloc_set_opts(NULL, AV_CH_LAYOUT_STEREO,        AV_SAMPLE_FMT_S16, 44100,  pFrame->channel_layout,(AVSampleFormat)pFrame->format, pFrame->sample_rate, 0, NULL);
              swr_init(m_pSwrCtx);

              swr_convert_frame(m_pSwrCtx, pOutFrame, pFrame));//return 0
              av_frame_free(&pOutFrame);

pFrame { nb_channel =2;fotmat=s16p;nb_sample=1024,rate=44100}
After called swr_convert_frame;
I found the linesize[0] of pOutFrame is incorrect,;
according to common sense:
pOutFrame linesize[0] should be nb_channel * nb_sample * sample_bytes,
That is 2*1024*2 = 4096 (format is S16), but it’s 4224;
What's wrong with me……



_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list