Question

Hello I'm attempting to encode videos using the C ffmpeg libraries. For some reason, when I attempt to create a format context I get an error with:

[NULL @ 0x7ff574006600] Requested output format 'mp4' is not a suitable output format

I know that my ffmpeg is compiled with the x264 flags, as a simple

ffmpeg -i test.mov test.mp4

works fine. I'm also linking with all of the generated pch files and everything else from the libav* libraries is working fine. Here's a full working example with the error's I'm recieving:

#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libswscale/swscale.h>
#include <libavutil/opt.h>
#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>

#include <stdio.h>

int main() {

    AVFormatContext * output = NULL;

    // now lets initialize the actual format element
    if (avformat_alloc_output_context2(&output, NULL, "mp4", "test.mp4") < 0) {

        printf("%s", "INVALID");
    }

    return 0;

}
Was it helpful?

Solution

You have to call

av_register_all();

prior to allocating the output context.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top