[Libav-user] Repeating frame while encoding using ffmpeg api

Pradeep Karosiya praks411 at gmail.com
Fri Sep 26 13:54:59 CEST 2014


Hi,

I'm trying to create small screen capture application using ffmpeg encoding
api.
The application mostly working fine when I encode each frame as per
specified frame rate.
However I would like to do some changes in above approach. If there is no
change on screen (frames are exactly same) then I don't want to encode the
duplicate frames and want ffmpeg to keep the last displayed frame till
something changes on screen. I'm doing following steps.
1. Check difference between previous and current frame, if difference == 0
then skip frame else add frame to encoder.
2. In add_frame_encoder I'm encoding the previous screen with previous time
stamp and setting extra_delay between current time stamp and previous time
stamp in repeat_pict field of the encode frame.
frame->repeact_pict = 2*fps*extra_delay
where extra_delay is the duration for ffmpeg to display the frame. 

However the above approach is not working fine. Even though video duration
is correct. When I'm playing the video the frame rate is reduced and I don't
see repeat_pict option is working. 
For example I'm encoding a video for 30 seconds at 10 fps containing many
duplicate frames. The final 
number of frames matches the frame which are added for encoding but I don't
see any frame repeated by ffmpeg and final fps is reduced to match the video
duration.
Please suggest what could be going wrong.

Regards,
Pradeep





--
View this message in context: http://libav-users.943685.n4.nabble.com/Repeating-frame-while-encoding-using-ffmpeg-api-tp4660473.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list