ubuntu 上下载ffmpeg的相关组件 并且安装安装如下
1 ./configure --prefix=/usr/local/ffmpeg2 --enable-shared --enable-libmp3lame --enable-libvorbis --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxvid --enable-postproc --enable-ffserver --enable-ffplay --enbale-static
2 make
3 sudo make install
代码 :
#include <iostream>
#include <stdio.h>
extern "C"
{
#include <libavformat/avformat.h>
#include <libavutil/mathematics.h>
#include <libavutil/time.h>
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libswscale/swscale.h"
#include "libswresample/swresample.h"
#include "libavfilter/avfilter.h"
#include "libavutil/log.h"
#include <libavutil/opt.h>
#include "libavfilter/buffersrc.h"
#include "libavfilter/buffersink.h"
}
#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
int main(int argc, char *argv [])
{
AVOutputFormat *ofmt = NULL;
//Input AVFormatContext and Output AVFormatContext
AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
AVPacket pkt;
const char *in_filename, *out_filename;
int ret, i;
int videoindex = -1;
int frame_index = 0;
int64_t start_time = 0;
# 记得修改推流的地址
in_filename = "/hefu/live/zip.mp4"; //输入URL(Input file URL)</