Page 1 of 1

Audio Transcode_AAC Error -22 opening out codec

Posted: Sat Aug 27, 2016 4:39 pm
by dmodi
I am trying to transcode hls mp3 audio to aac flv format, as given in the transcode_aac example. I am using Ruslan's ffmpeg .net wrapper.

Here is the code snippet -

AVCodec* output_codec = ffmpeg.avcodec_find_encoder(AVCodecID.AV_CODEC_ID_AAC);
AVStream* out_Astream = ffmpeg.avformat_new_stream(outContext, output_codec);

// out_Astream->codec = ffmpeg.avcodec_alloc_context3(output_codec);
out_Astream->codec->strict_std_compliance = -2; //experimental
out_Astream->codec->bit_rate = 64000;// audioBitrate;
out_Astream->codec->sample_fmt = AVSampleFormat.AV_SAMPLE_FMT_U8;
out_Astream->codec->sample_rate = 8000;
out_Astream->codec->channels = 1;
out_Astream->codec->profile = ffmpeg.FF_PROFILE_AAC_MAIN;
//audioCodec->time_base = (AVRational){1, sampleRate};
out_Astream->codec->time_base.num = 1;
out_Astream->codec->time_base.den = 8000;
out_Astream->codec->codec_type = AVMediaType.AVMEDIA_TYPE_AUDIO;

int err;
if ((err = ffmpeg.avcodec_open2(out_Astream->codec, output_codec, null)) < 0)
console.writeline("Error : {0}",err);

Opening the AAC encoder gives error -22.

I have tried with different parameters and also using the input stream codec parameters. But the error code is always -22. What is wrong ?

Thanks in advance.

Re: Audio Transcode_AAC Error -22 opening out codec

Posted: Sun Aug 28, 2016 2:05 pm
by dmodi
To add further information, I am able to mux using ffmpeg.exe

ffmpeg -report -v 9 -loglevel 99 -re -i tcp:// -i
-c:v copy -c:a aac -strict -2 -f flv rtmp://

Inputs are video streamed over tcp (h264, flv format); audio is mp3, 8000 Hz over HLS protocol.

I am trying to achieve the same result using the ffmpeg dll libraries.

Thanks again.

Re: Audio Transcode_AAC Error -22 opening out codec

Posted: Wed May 24, 2017 11:52 am
by rogerdpack
maybe ask on the libav-user mailing list??