[Libav-user] custom av_log callback receiving incorrect format specifiers from h264 module

Blake Senftner bsenftner at earthlink.net
Sun Dec 18 17:28:19 EET 2016


Hello,

I am working with ffmpeg libav* 3.2 libs, downloaded pre-built from Zeranoe early November, my versions are:

libavutil      55. 34.100 / 55. 34.100
libavcodec     57. 64.100 / 57. 64.100
libavformat    57. 56.100 / 57. 56.100
libavdevice    57.  1.100 / 57.  1.100
libavfilter     6. 65.100 /  6. 65.100
libswscale      4.  2.100 /  4.  2.100
libswresample   2.  3.100 /  2.  3.100
libpostproc    54.  1.100 / 54.  1.100

I’m developing a video playback library, (no audio handling.) I started with the Dranger tutorials, but have updated everything to the latest APIs from reading here, and other sources. So far the code is having no problems playing live USB video, or any video file I can find, but does not play IP cameras delivering rtsp h264 streams correctly. The non-keyframes are very blurry. Plus, for media files as well as rtsp streams, I can only get half speed or lower playback.

I’ll be posting a few questions about those issues later, but first I want to ask about my implementation of an av_log callback, as I am getting crashes from an “incorrect format specifier” delivered from the “h264” module. The specific format string causing the crash is “error while decoding MB %d %d, bytestream %td\n”. (Is the “t” size modifier valid in Visual Studio?)

void CE_LIBAV_Video::logging_callback(void *ptr, int level, const char *fmt, va_list vargs)
{
	static char message[8192];		
	const char *module = NULL;

	if (level > AV_LOG_WARNING)
		return;

	 // Get module name
	 if (ptr)
	 {
		AVClass *avc = *(AVClass**) ptr;
		module = avc->item_name(ptr);
	 }

	 // Create the actual message
	 vsnprintf_s(message, sizeof(message), _TRUNCATE, fmt, vargs);

	 ofstream log_file;
	 log_file.open( "libav.log", std::ios::app );
	 log_file << message;
	 log_file.close();
}

Playing USB video, I see no av_log format specifier issues. Playing media files, non-h264, I see no av_log issues, but when playing an h264 video file I also see the same format specifier issue. 

I’m working in Win10, Visual Studio 2013 Community. 

Sincerely,
-Blake Senftner
Mad Computer Scientist 


More information about the Libav-user mailing list