[Libav-user] Left channel noise in audio

NITIN GOYAL nitinkumgoyal at gmail.com
Thu May 15 01:43:01 CEST 2014


are you sure that the input source audio dont have any noise?

The code looks ok as you are just sending te buffered content to the decode
func.


On Tue, May 13, 2014 at 1:11 AM, Ankush <wadkes93 at gmail.com> wrote:

>  This is my sample audio code for reading a fixed size of buffer.
> everything works just fine in it even the sync is maintained but the
> problem is i get only noise on the left channel and a constant noise on
> the right channel along with the audio output.
>
> can anyone have a look at it and show me some solution to remove the noise.
> my input file is a AV_SAMPLE_FMT_FLTP with channel_layout = 3.
>
> audio_pkt_size = bufferSize;
> while (av_read_frame(m_mpegIn->pFormatCtx, &avpkt)>=0)
>      {
>          if(avpkt.stream_index==m_mpegIn->audioStreamIndex)
>          {
>              if (!(decoded_frame = avcodec_alloc_frame()))
>              {
>                          fprintf(stderr, "Could not allocate audio
> frame\n");
>                          exit(1);
>                  }
>          else
>          {
>              avcodec_get_frame_defaults(decoded_frame);
>          }
>
>          len = avcodec_decode_audio4(m_mpegIn->pAudioCodecCtx,
> decoded_frame, &got_frame, &avpkt);
>
>          if (len < 0)
>          {
>              // if error, skip frame
>              audio_pkt_size = 0;
>              break;
>          }
>
>          if(audio_pkt_size >= decoded_frame->linesize[0])
>          {
>              //My calculations for filling remaining buffer
>
>          }
>          buf = buf +
> decoded_frame->linesize[0]/*(decoded_frame->nb_samples *
> (m_mpegIn->bitsPerSample/8))*/;
>          avpkt.data += len;
>          avpkt.dts = avpkt.pts = AV_NOPTS_VALUE;
>
>          if( audio_pkt_size > 0 )
>          {
>              int size = sizeof(*_buffer);
>              // No data yet, get more frames
>              continue;
>          }
>          else
>          {
>              av_frame_free(&decoded_frame);
>
>              return ;
>          }
>
>          }
>
>          if (avpkt.data)
>              av_free_packet(&avpkt);
>
>      }
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140514/d7a21a51/attachment.html>


More information about the Libav-user mailing list