It has been a month with no response to the libffmpeg question below.  Please
consider taking a closer look and send a response if possible.
 - Thank you, David


dmanpearl wrote:
> 
> I am attempting to use libffmpeg to extract individual image frames of a 
> movie, modify them with custom code, and then recreate the movie with the 
> modified images and the original audio packets. 
> 
> The imaging part of my task is finished and working correctly.  However, I 
> have been unable to recreate the audio portion of my output movie. 
> 
> Information about my input movie: 
> Input #0, mov,mp4,m4a,3gp,3g2,mj2 
>   Stream #0.0(eng): Audio: aac, 48000 Hz, 2 channels, s16 
>   Stream #0.1(eng): Video h264,yuv420p,640x480,29.97tbr,2997tbn,5994tbc 
> Video Codec: 28 (MOV format) 
> Audio Codec: 86018 (Advanced Audio Coding) 
> 
> First of all, I have downloaded and build current versions of libfaac and 
> libfaad and installed both.  I am configuring libffmpeg to use both.  I 
> build and use everything as static libraries (which happens to create a 
> nightmare of dependencies all of its own, but which are under control). 
> 
> For video, I decode each image frame, process and modify in "ppm" format 
> with custom code and ImageMagick's libmagick++, encode each frame, and
> write 
> it into the stream of an output movie.  As I said, this works. 
> 
> My problem is in trying to insert the audio packets.  My first choice
> would 
> be to write the packets from the input movie to the output movie without
> any 
> decoding or encoding.  My second option is to decode audio from the input 
> stream and then encode with the same or different audio codec for the
> output 
> stream.  Both methods are failing for me.
> 
> Here is the code I am using to setup the audio portion of the output
> video:
> (lots of error checking omitted) 
> 
>   AVOutputFormat *ofmt;
>   AVFormatContext *oc;
>   AVStream *audio_st, *video_st;
>   ofmt = guess_format(NULL, "out.mov", NULL);
> 
>   // Method 1: force audio codec same as input video
>   ofmt->audio_codec = pCodecCtxAudio->codec_id; // format of input
> 
>   // Same as above: CODEC_ID_AAC == 86018
>   ofmt->audio_codec = CODEC_ID_AAC;
> 
>   // Method 2: use supported audio codec, but don't attempt to decode
> during frame processing
>   ofmt->audio_codec = CODEC_ID_AC3
> 
>   // allocate the output media context
>   oc = avformat_alloc_context();
>   oc->oformat = ofmt;
>   audio_st = add_audio_stream(oc, ofmt->audio_codec);
>   av_set_parameters(oc, NULL)
>   open_audio(oc, audio_st)
> 
> 
> For the first method, if I try to write packet-size bytes of packet-data
> to 
> the output stream, then the next video frame fails with the following
> error: 
> 
>   [mpeg4 @ 0x1826a00]error: non monotone timestamps 23533 >= 1 
> 
> 
> For the second method, libffmpeg fails to find the decoder for the AAC 
> codec, despite my build with libfaac and libfaad.
> On failure, open_audio returns false and prints this message to the
> console: 
> 
>   codec not found
> 
> 
> Please help me determine how to write audio packets to my output stream. 
>  - Thanks, David   
> 

-- 
View this message in context: 
http://n4.nabble.com/ffmpeg-and-AAC-tp956702p998822.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to