[Libav-user] Invalid Handle was specified - av_guess_format / avformat_alloc_context

Marlon Reid Marlon at scansoft.co.za
Thu Sep 22 16:13:34 CEST 2011

I am experiencing problems with using av_guess_format /
avformat_alloc_context. In my sample code below, my application crashes
on "m_Outfmt = av_guess_format ( "mp3", NULL, NULL);" with the message
"Unhandled exception at 0x773b2865 in test.exe: 0xC0000008: An invalid
handle was specified." .
 The AVOuptputFormat struct seems to contain garbage after this call,
e.g. audio_codec = -1163005939. The odd thing is that even though
m_OutFmt contains what appears to me to be garbage, the break occurs
only on "m_OutFmtContext = avformat_alloc_context ();". At this point
the breakpoint jumps back to "m_Outfmt = av_guess_format ( encodingStr,
I am using VS2008 with Windows 7 and libavutil 51. 16. 1, libavcodec
53. 16. 0 and libavformat 53. 12. 0.

Any assistance will be much appreciated.

m_Outfmt = av_guess_format ( "mp3", NULL, NULL);

if( !m_Outfmt )

return false;

m_OutFmtContext = avformat_alloc_context ();

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110922/872ce972/attachment.html>

More information about the Libav-user mailing list