c++ – I have a problem with my input resampling FFmpeg audio code
I,ve tried to do a resampling with ffmpeg, but i found issues all the time in my code.
firt, i tried to get the imput channel layout but av_channel_layout_default(&layout, audio_codecpar->nb_channels); tells me, “there´s not nb_channels menber.
so i put the resampling code manually cause I know is stereo.
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", codec_ctx->sample_fmt, 0);
av_opt_set_int(swr_ctx, "in_channel_layout", AV_CH_LAYOUT_STEREO, 0);
av_opt_set_int(swr_ctx, "in_sample_rate", codec_ctx->sample_rate, 0);
av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
av_opt_set_int(swr_ctx, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
av_opt_set_int(swr_ctx, "out_sample_rate", pwfx->nSamplesPerSec, 0);
but on execution give me this error:
Formato de mezcla: 48000 Hz, 32 bits, 2 canales
[SWR @ 00000277ef707a40] Input channel layout “” is invalid or unsupported.
any clue? I’m new on this, but I think I’m close.
thanks!!
Read more here: Source link
