interrupt_callback not working

For the developers that use FFmpeg in their software.
Post Reply
Posts: 1
Joined: Sun Jul 16, 2017 3:50 am

interrupt_callback not working

Post by sergman » Sun Jul 16, 2017 3:58 am

Hi guys,

I am facing the problem described here:

I used the latest version of ffmpeg.
When I open non-existing URL the call to avformat_open_input hangs and interrupt_callback is not called.

And here is the small code that demonstrates the problem (compiled in Visual Studio)

Code: Select all

#include <Windows.h>

#include <libavcodec\avcodec.h>
#include <libavformat\avformat.h>
#include <stdio.h>

static int interrupt_cb(void *ctx)
	printf("Interrupt callback called\n");

	return 0;

int main(int argc, char *argv[]) {
	AVFormatContext *pFormatCtx;

	if (argc < 2) {
		printf("Please provide a movie file\n");
		return -1;
	// Register all formats and codecs

	// Open video file
	pFormatCtx = avformat_alloc_context();
	pFormatCtx->interrupt_callback.callback = interrupt_cb;
	pFormatCtx->interrupt_callback.opaque = pFormatCtx;

	if (avformat_open_input(&pFormatCtx, argv[1], NULL, NULL) != 0)
		return -1; // Couldn't open file

	return 0;
The parameter can be any non-existing URL for example:

Post Reply