Reputation: 3073
I am processing a video file. I use ffmpeg to read each packet.
If it is an audio packet, I write the packet into the output video file using av_interleaved_write_frame.
If it is a video packet, I decode the packet, get the data of the video frame, process the image, and compress back to a packet. Then I write the processed video frame packet into the output video file using av_interleaved_write_frame.
Through debugging, it read audio packets and video packets correctly. However, when it goes to "av_write_trailer", it exits. But the output video file exists.
The error information is:
*** glibc detected *** /OpenCV_videoFlatten_20130507/Debug/OpenCV_videoFlatten_20130507: corrupted double-linked list: 0x000000000348dfa0 ***
Using Movie Player (in Ubuntu), the output video file can plays the audio correctly, but without video signals. Using VLC player, it can show the first video frame (keep the same video picture), and play the audio correctly.
I tried to debug into "av_write_trailer", but since it is in the ffmpeg library, I could not get a detailed information what is wrong.
Another piece of information: the previous version of the project is only to process the video frame, without adding audio stream; and it works well.
Any hint or clue?
Upvotes: 0
Views: 4779
Reputation: 3073
I found the solution. I did not use rescale to set the pts based on stream's time_base. Actually the related code is in the example muxing.c.
Upvotes: 1