[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;
break;
}
// didn't find a video stream
if(m_nAudioStream==-1)
return -1;
// get a pointer to the codec context for the audio stream.
m_pAudioCtx=&m_pFormatCtx->streams[m_nAudioStream]->codec;
// fine the decoder for the audio stream
pAudioCodec=avcodec_find_decoder(m_pAudioCtx->codec_id);
if(pAudioCodec==NULL)
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