While reading frames with av_read_frame, I get subtitle frames up to frame 543. After this the in_frame parameter never gets set and it never returns a subtitle frame again after this. If I remove this "bad frame" and start decoding after it , all runs ok.