I'm following the example code here: http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/output-example_8c-source.html
My code is as follows:
fmt = av_guess_format(NULL, filename, NULL);
if (!fmt) {
LOGE(1,"Could not deduce output format from file extension: using MPEG.\n");
fmt = av_guess_format("mp4", NULL, NULL);
}
if (!fmt) {
LOGE(1, "Could not find suitable output format\n");
exit(1);
}
The two times that I call av_guess_format, it is returning NULL both times. I am calling both av_register_all() and avcodec_register_all() beforehand.
Any ideas as to why this is returning NULL?
Thanks in advance.
av_guess_format was returning NULL because I hadn't properly configured FFMPEG to allow for ANY formats.
I re-configured FFMPEG to allow mp4 and others, and now it works
You need to recompile ffmpeg.make sure "--enable-muxer=mp4" was in configure's argument.after configure open config.h with editor,you will see "#define CONFIG_MP4_MUXER 1"
来源:https://stackoverflow.com/questions/8526738/ffmpeg-av-guess-format-returns-null