<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body dir="auto">
<div>do you say ,you write same packet to decoder, and get frame more then in packet? </div>
<div>look at anntation as avcodec_decode_audio4();</div>
<div>that is:</div>
<div>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4643 * Some decoders may support multiple frames in a single AVPacket. Such</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4644 * decoders would then just decode the first frame and the return value would be</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4645 * less than the packet size. In this case, avcodec_decode_audio4 has to be</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4646 * called again with an AVPacket containing the remaining data in order to</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4647 * decode the second frame, etc... Even if no frames are returned, the packet</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4648 * needs to be fed to the decoder with remaining data until it is completely</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4649 * consumed or an error occurs.</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;">
<span style="font-size: 12pt;">4650 *</span></p>
</div>
<div><br>
</div>
<div>good luck<br>
<div>发自我的 iPhone</div>
</div>
<div><br>
在 2017年1月11日,20:08,Aboobeker Sidhik Koyamparambil mammu <<a href="mailto:aboosidhik@gmail.com">aboosidhik@gmail.com</a>> 写道:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">Dear All,
<div><br>
</div>
<div>I am trying to decode opus. When I use both methods </div>
<div>avcodec_decode_audio4 and (avcodec_send_packet /avcodec_receive_frame) . I am receiving the same opus packet that I send for decoding. I got this by using the packet size of the decoded frame. Packet size is same as the input opus packet size.<br>
</div>
<div><br>
</div>
<div>I followed the decoding example given in github of ffmpeg. Please help me. Why I am receiving same packet as input?</div>
<div><br>
</div>
<div>
<div id="gmail-mainbar" style="margin:0px;padding:0px;border:0px;font-size:13px;float:left;width:728px;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">
<div class="gmail-question" id="gmail-question" style="margin:0px;padding:0px;border:0px;clear:both">
<table style="margin:0px;padding:0px;border:0px;border-collapse:collapse">
<tbody style="margin:0px;padding:0px;border:0px">
<tr style="margin:0px;padding:0px;border:0px">
<td class="gmail-votecell" style="padding:0px 15px 0px 0px;border:0px;vertical-align:top">
<br>
</td>
<td class="gmail-postcell" style="padding:0px;border:0px;vertical-align:top">
<div style="margin:0px;padding:0px;border:0px">
<div class="gmail-post-text" style="margin:0px 0px 5px;padding:0px;border:0px;font-size:15px;width:660px;word-wrap:break-word;line-height:1.3">
<pre style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);word-wrap:normal"><code style="margin:0px;padding:0px;border:0px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;white-space:inherit">av_register_all();
avcodec_register_all();
AVCodec *codec;
AVCodecContext *c = NULL;
AVPacket avpkt;
AVFrame *decoded_frame = NULL;
av_init_packet(&avpkt);
codec = avcodec_find_decoder(AV_CODEC_ID_OPUS);
if (!codec) {
printf("Codec not found\n");
exit(1);
}
c = avcodec_alloc_context3(codec);
if (!c) {
printf("Could not allocate audio codec context\n");
exit(1);
}
/* put sample parameters */
c->sample_rate = 48000;
c->request_sample_fmt = AV_SAMPLE_FMT_FLT;
c->channels = 2;
/* open it */
if (avcodec_open2(c, codec, NULL) < 0) {
printf("Could not open codec\n");
exit(1);
}
AVPacket avpkt;
AVFrame *decoded_frame = NULL;
av_init_packet(&avpkt);
avpkt.data = Buffer; // Buffer is packet data here
avpkt.size = len; // length of the packet
int i, ch;
if (!decoded_frame) {
if (!(decoded_frame = av_frame_alloc())) {
RELAY_SERVER_PRINT("Could not allocate audio frame\n");
exit(1);
}
}
int ret;
int got_frame = 0;
ret = avcodec_decode_audio4(client_sockt_num_1->c, decoded_frame, &got_frame, &avpkt);
if (ret < 0) {
fprintf(stderr, "Error decoding audio frame (%s)\n", av_err2str(ret));
return ret;
}
printf("length %i\n", decoded_frame->pkt_size);</code></pre>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">Kind Regards<br>
<br>
Aboobeker Sidhik</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>Libav-user mailing list</span><br>
<span><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a></span><br>
<span><a href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a></span><br>
</div>
</blockquote>
</body>
</html>