Hello,
I'm am working with a file that has H.264/AVC video and AAC audio. I'm
doing some processing on the video, but I am not interested in modifying the
audio.
Currently, I do not have any trouble decoding/processing/re-encoding/writing
the video, but I am not able to write the audio to the output file. Here is
the snippet of code that I'm using to handle the writing of video/audio.
while(av_read_frame(pFormatCtx, &packet) >= 0) {
// Is this a packet from the video stream?
if(packet.stream_index==videoStream) {
// Decode video frame
avcodec_decode_video(pCodecCtx, pFrame, &frameFinished, packet.data,
packet.size);
// Did we get a video frame?
if(frameFinished) {
sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0,
pCodecCtx->height,
pFrameYUV->data,pFrameYUV->linesize);
pFrameYUVout = pFrameYUV;
//processing done here -- left out for this snippet
write_video_frame(oc, video_st, pFrameYUVout);
}
}
else if(packet.stream_index==audioStream) {
av_write_frame(oc, &packet);
}
else
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
}
I've tried both av_write_frame() and av_interleaved_write_frame(), but I get
the following error:
"
[mpeg4 @ 0x13d2c60]error, non monotone timestamps 1021 >= 1000
Error while writing video frame
"
Any ideas how to avoid this, or a better way to write the audio directly to
the output file?
Thanks,
Michael
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user