[Libav-user] stubborn valgrind issue

Brian Lewis brian at lorf.org
Wed Jul 31 10:10:16 CEST 2013

Hi, I'm getting some invalid reads and uses of uninitialized values in
valgrind that I can't clear up.

An archive with the test code and video is at

Or if you prefer to just look at the code, it's also up at

The test code reads frames from test.mkv and writes PNGs to frame.png.
It seems to be able to do this, but only with a bunch of scary warnings
from valgrind.

To see the problem, compile with
$ gcc -W -Wall -g -o test test.c -lavcodec -lavformat -lavutil -lswscale
or just run ./go from the archive.

$ valgrind ./test

You should see that frame.png has been written, and its contents seem
OK. But there are warnings from valgrind.

The problematic part of the code seems to be around line 95, probably
the call to avcodec_encode_video2.

Can anyone fix this code to get rid of the valgrind warnings? Thanks in

More information about the Libav-user mailing list