I am trying to capture windows screen (continuous screen shots) and encode them into x264. For that I am using avcodec_encode_video2 function available with libavcodec. However, it takes a huge amount of time. The time fluctuates between 25 – 1800 milliseconds for encoding individual frames.
I tried tried both 1080p and 720p with video recording on screen.
These are the settings I am using. This was tested on Windows 7, win32 release build with 4 GB of RAM.
bit_rate = 2000, width = 1920, height = 1080 qmin = 0, qmax = 0, max_b_frames = 0, frame_rate = 25, pixel_format = YUV 4:4:4. The remaining settings are default which are fetched using avcodec_get_context_defaults3().
Sample data(in milliseconds) for 20 frames (consecutive and chosen randomly) in a set of 250 frames. { 121, 106, 289, 126, 211, 30, 181, 58, 213, 34, 245, 50, 56, 364, 247, 171, 254, 83, 82, 229 }
For the application it is a must that it captures at least at 15 fps. Can someone help out to tell whether any options can be used to improve the frame rate. I need to encode lossless, but I am open to some file size increase.
Thanks in advance.