[Libav-user] thread_count = 1 massively breaks reads

Thomas Worth dev at rarevision.com
Wed Mar 28 12:45:12 CEST 2012


On Wed, Mar 28, 2012 at 12:28 AM, Thomas Worth <dev at rarevision.com> wrote:
> What has changed in the past couple months that would cause
> av_read_frame() to return negative values well before the end of the
> file if thread_count is set to 1 for the video? This is the behavior I
> get with both MOV and MTS files with H.264 compressed video. If I set
> thread_count to anything higher than 1 (or not set at all, using the
> automatically detected thread count), it works fine. I have read code
> I've been using successfully for over a year and now it breaks when
> the thread count is set to 1. It used to be that av_read_frame() would
> only return negative values at the end of the file, or EOF - number of
> threads if thread_count was greater than 1.
>
> Is there something else I need to do that I didn't before?

Never mind, problem solved. I was setting thread_count after the codec
was already opened. Duh.

For others that may encounter this problem, you must set thread_count
BEFORE calling avcodec_open().


More information about the Libav-user mailing list