[Ffmpeg-devel] Using libavformat and libavcodec(help me Martin Böhme)

Chang Min Jeon jcm1981
Tue May 31 15:54:50 CEST 2005

hello, I'm student in South Korea.

I read Martin B?hme's article about using libavcodec and libavformat
in ffmpeg doc.

So I can read video frame from video file, Wow amazing.~

Now I'm trying to read audio stream.


How to read raw audio stream from video file ?


//find the first audio stream.

 m_nAudioStream = -1;

 for(j=0; j<m_pFormatCtx->nb_streams; j++)
  if(m_pFormatCtx->streams[j]->codec.codec_type == CODEC_TYPE_AUDIO)
   m_nAudioStream =j;

// didn't find a video stream
  return -1;
 // get a pointer to the codec context for the audio stream.

// fine the decoder for the audio stream
  return -1;

// open audio codec

 if(avcodec_open(m_pAudioCtx, pAudioCodec) <0)
  return -1;







Thanks in advance :)

More information about the ffmpeg-devel mailing list