将ffprobe文件简化, 用于分析。 文件放在ffmpeg根目录,编译 gcc probe_test.c -I/mnt/hgfs/shared/ffmpeg/ffmpeg-4.0 -lavutil -lavformat -lavcodec , 已经提前安装ffmpeg库。
#include <string.h>
#include "libavformat/avformat.h"
#include "libavutil/opt.h"
#include "fftools/cmdutils.h"
typedef struct InputStream {
AVStream *st;
AVCodecContext *dec_ctx;
} InputStream;
typedef struct InputFile {
AVFormatContext *fmt_ctx;
InputStream *streams;
int nb_streams;
} InputFile;
AVDictionary *format_opts, *codec_opts;
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
{
int ret = avformat_match_stream_specifier(s, st, spec);
if (ret < 0)
av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);
return ret;
}
AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
AVForm