I'm using libav to encode video with x264 encoder. Typically everything works good but sometime it just hangs in avcodec_encode_video and never returns. It usually happens after few minutes of encoding but not each time and I don't see any regularity. Does anyone have an idea what could cause that?