У сб, 2009-08-01 у 06:18 +0500, Shujaat пише:
> hello list
>
> I am trying to make an mp4 video from png images and then adding sound to
> its audio stream. I have compiled the video and it plays fine but when it
> comes to adding audio to it, it fails. Here are some steps for audio. I have
> installed ffmpeg with libfaac, libfaad, and libmp3lame enabled.
>
> what I am doing is:
>
> I read a wav file
> get its audio stream
> get a decoder for it
> decode this video ( returns me the value "1" as output)
> resample it (still the value of output is 1)
>
> then I am trying to encode it to aac because mp4 container by default take
> aac audio in its audio stream. then
>
> pkt.size = avcodec_encode_audio ( pAudioCodec, audioBuffer,
> AUDIO_BUF_SIZE, Samples ); //samples contain the value 1 which I dont what
> it is.
>
> when this statement executes pkt.size becomes 0 and the audioBuffer contains
> nothing in it.
>
I think you got it all wrong. Hire is what documentation says:
@param[out] buf the output buffer
@return On error a negative value is returned, on success zero
or the number of bytes used to encode the data read from the
input buffer.
Did you read it? Does AUDIO_BUF_SIZE >= FF_MIN_BUFFER_SIZE? A assume
that it's better align this buffer. Does Samples is a pointer to short?
>
> After this I do:
>
> pkt.pts = av_rescale_q ( audioCodec->coded_frame->pts,
> audioCodec->time_base, audioStream->time_base );
>
> here it fails because audioCodec->coded_frame is null.
>
It's not very clear for me from your code where audioCodec came from...
> I have initalized all the codecs, buffers etc. but it fails over here. dont
> know whether there is some problem with decoded packet or with this encode
> function.
>
> And one another confusion, can we combine mp4 video and mp3 or wav audio in
> an mp4 container so that there should be no encoding required for audio
> part.
>
Yes, absolutely, mp4 can contain mp3, wav and dozen of other formats.
Hint: did you checked ffmpeg.c and api-example.c for any hints?
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user