[Libav-user] AAC encoding question

Justin justin-zhao at qq.com
Sun Apr 7 08:45:18 CEST 2013


Thank you firstly, I have tried all sample format by for loop, but it still didn't work.
 
------------------
Best Regards,
 Justin




 
------------------ Original ------------------
From:  "Haridas Sagar N"<haridassagarn at tataelxsi.co.in>;
Date:  Sun, Apr 7, 2013 02:40 PM
To:  "This list is about using libavcodec, libavformat, libavutil, libavdeviceand libavfilter."<libav-user at ffmpeg.org>; 

Subject:  Re: [Libav-user] AAC encoding question



Change sample format
 toAV_SAMPLE_FMT_FLTP______________
From: libav-user-bounces at ffmpeg.org [libav-user-bounces at ffmpeg.org] on behalf of Justin [justin-zhao at qq.com]
Sent: Sunday, April 07, 2013 11:38 AM
To: libav-user
Subject: [Libav-user] AAC encoding question

Hi,

    I am trying to encode audio using the AAC audio encoder with the program below, but when I call the avcodec_open2 funtion, the function always return -733130664. I don't know where is wrong in it. I'll very appreciate someone who can point out the wrong.

note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the avcodec_open2 can return 0 successfully!

============program=================
main()
{
 int ret;
 AVCodec *codec;
 AVCodecContext *c;
 AVFrame *frame;

 avcodec_register_all();
 codec = avcodec_find_encoder(AV_CODEC_ID_AAC);
 if (!codec)  return;
 //avcodec_register(codec);
 c = avcodec_alloc_context3(codec);
 if (!c)  return;

 c->bit_rate = 64000;
 c->sample_rate    = 44100;
 c->channels       = 2;
 c->frame_size = 88200;
 c->sample_fmt = AV_SAMPLE_FMT_S16;
 // open it
 ret = avcodec_open2(c, codec, NULL);
 if (ret >= 0)  printf("OK\r\n");
}

Best Regards,
Justin
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you


_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130407/e96f4b6f/attachment.html>


More information about the Libav-user mailing list