Hello,
I am trying to add some data in a video frame and then rewrite a new video again
with the modified frames. The intention is to get that data back again after
reading the frames from the new video.
My input is a flv file and output is also a flv file. From the input flv file, I
can read the frames and decode them as given in many examples.
// Read frames and save first five frames to disk
i=0;
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) {
// video frame in pFrame
// Add the data
}
}
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
}
But, now if try to add my data in pFrame (without decoding the packet), and then
encode it back for the new video, I suspect that the data that I add will get
lost during the encoding process. Therefore, in order to make sure that I add
data such that they don't get lost, I need to understand how encoding works.
When I looked at avcodec_encode_video, it makes use of a function "encode". Now
I am trying to find the source code of this function but so far could not find
so in doxygen. I was wondering if somebody can explain how does encoding of
video frame works, specially in flv files.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user