[Ffmpeg-devel] Decoding Audio and Video
Thu Nov 2 21:15:09 CET 2006
I have some trouble with decoding Video and Audio at the same time... Video
alone is no problem, but I don't know how I should do the audio part..
The problem is, I need the Video and Audio seperated.. I can't just use
av_read_frame() in a loop and check each time if it's audio or video and
then decode it.
I have one loop for the video, where I'm using av_read_frame() and then am
checking if this is my videoStream.
(like in this tutorial:
But, when I'm doing the same for the Audio anything screws up.. :(
It seems as if, when I use av_read_frame() in the audio-loop, it also skips
some videoframes... but the only thing both loops are using is the
AVFormatContext. (each loop has an own AVCodec, AVCodecContext and AVPacket)
To explain what I need:
Let's say I have a Video of 10 seconds... now I want to grab the Videostream
of the first 5 secs, and the Audiostream of the last 5 secs... the resulting
video should now be 5 secs long.. hard to explain, do you know what I mean?
PS: when I use avcodec_decode_audio, the result will be raw PCM audio,
If so, how do I determine the SampleRate, Channelcount and BitsPerSample?
More information about the ffmpeg-devel