[Libav-user] Decoding too slow (avcodec_send_packet() / avcodec_receive_frame())
I'm using ffmpeg libraries to decode, scale, and re-encode video within an MPEG transport stream. I've just recompiled from source to v3.3.2 and changed from the old avcodec_decode_video2() API to the new send/receive API.
Both the old and new APIs decode the video very slowly.
25 fps video = 1 frame every 40ms. However, I see 70 to 120ms per frame to decode. This is a file translator so need it to run faster than real time.
The code outline is below. Anyone have any ideas on how to improve the decoding speed? There are other posts about the deprecated avcodec_decode_video2() being slow; none of those were resolved. The new API doesn't run any faster...
DECODE ReadFrame 6 usec, DecodeVideo 154273 usec.
Dump mpFrameEnc with DateTime:
AVFrame Info frame 720 X 406. PTS = 305700353 PKT_PTS = 305700353 Linesize=720. Linesize=360. Linesize=360.
Time taken to ENCODE video frame = 3685 usec. Scaling time 4 usec
DECODE ReadFrame 8 usec, DecodeVideo 128203 usec.
Time taken to ENCODE video frame = 3724 usec. Scaling time 3 usec
DECODE ReadFrame 8 usec, DecodeVideo 69321 usec.
Time taken to ENCODE video frame = 3577 usec. Scaling time 3 usec
Tests running on core2 duo 3.2 GHz, 32-bit Centos 6.