<p dir="ltr">On 24 Apr 2013 20:57, "Paul B Mahol" <<a href="mailto:onemda@gmail.com">onemda@gmail.com</a>> wrote:<br>
><br>
> On 4/24/13, Brad O'Hearne <<a href="mailto:brado@bighillsoftware.com">brado@bighillsoftware.com</a>> wrote:<br>
> > On Apr 24, 2013, at 8:30 AM, Claudio Freire <<a href="mailto:klaussfreire@gmail.com">klaussfreire@gmail.com</a>> wrote:<br>
> ><br>
> >> On Wed, Apr 24, 2013 at 8:21 AM, Pradeep Karosiya <<a href="mailto:praks411@gmail.com">praks411@gmail.com</a>><br>
> >> wrote:<br>
> >>> The codec id used is AV_CODEC_ID_AAC. The encoding goes fine but I'm<br>
> >>> getting<br>
> >>> some noise is the final audio output. The quality is getting degraded.<br>
> >>> However if the number of channels is 1 then I'm getting same quality as<br>
> >>> the<br>
> >>> input file<br>
> >><br>
> >><br>
> >> I also experienced this when encoding AAC, so I stopped using AAC.<br>
> >><br>
> >> I'm not using the very latest ffmpeg, so I didn't bother reporting the<br>
> >> issue, and it's been on my To-Do to check the latest version for a<br>
> >> while. Been busy and all. Anyway, I thought I'd say "me too", and add<br>
> >> that it does seem related to the AAC encoder, because it only happens<br>
> >> with AAC.<br>
> ><br>
> > This seems like some level of vindication / relief for this mortal -- as is<br>
> > probably apparent from my other thread, this is the exact problem I am<br>
> > having too. I am heavily suspecting weirdness in either resampling, or the<br>
> > nature of the expected data buffer to the encoder -- that's actually<br>
> > contained within a frame, so the data filling occurs within this function<br>
> > call:<br>
> ><br>
> > avcodec_fill_audio_frame(_streamAudioFrame,<br>
> ><br>
> > _streamAudioFrame->channels,<br>
> ><br>
> > _streamAudioFrame->format,<br>
> >                                                      (const uint8_t<br>
> > *)destinationData[0],<br>
> >                                                      bufferSize,<br>
> >                                                      0);<br>
> ><br>
> > To revisit this, my destinationData variable is declared as:<br>
> ><br>
> >                 uint8_t **destinationData = NULL;<br>
> ><br>
> > It is populated with data from resampling as in:<br>
> ><br>
> >                 returnVal = swr_convert(resamplerCtx,<br>
> >                                         destinationData,<br>
> >                                         destinationNumberOfSamples,<br>
> >                                         (const uint8_t **)sourceData,<br>
> >                                         sourceNumberOfSamples);<br>
> ><br>
> > from a source data array declared similarly as:<br>
> ><br>
> >                 uint8_t **sourceData = NULL;<br>
> ><br>
> > My questions revolve around this parameter in the avcodec_fill_audio_frame<br>
> > function:<br>
> ><br>
> >                  (const uint8_t *)destinationData[0],<br>
> ><br>
> > 1. Is that the proper pointer to be passing? It works (to the degree that<br>
> > the return code is success). I've tried sending:<br>
> ><br>
> >               (const uint8_t *)destinationData,<br>
> ><br>
> > and<br>
> ><br>
> >               (const uint8_t *)&destinationData,<br>
> ><br>
> > and<br>
> ><br>
> >                  (const uint8_t *)&destinationData[0],<br>
> ><br>
> > and all three of those blow up. I wouldn't otherwise doubt the original line<br>
> > (as it produced good audio with another sample format), but I've got little<br>
> > in the equation here that can be changed, so I'm reconsidering everything.<br>
> ><br>
> > 2. For planar data, what exactly is the expected structure of the data<br>
> > array?<br>
> ><br>
> > is it:<br>
> ><br>
> > data[0] -> plane 1<br>
> > data[1] -> plane 2<br>
><br>
> For planar sample format, each channel is in separate array:<br>
><br>
> channel left = data[0]<br>
> channel right = data[1]<br>
><br>
> If you use more than 8 channels, use extended_data instead.</p>
<p dir="ltr">And to set</p>
<p dir="ltr">data[1]=data[0] + plane_size;</p>
<p dir="ltr">is most likely not enough because both data[0] and data[1] must be aligned.<br>
</p>