ubuntu16.04下利用wigwam安装mpegflow
来源:互联网 发布:拼团软件排行 编辑:程序博客网 时间:2024/06/03 10:42
最近想从264视频中提取运动向量(motion vector),ffmpeg的ffplay是可以显示运动向量在播放画面中的,但是具体怎么样将运动向量提取到文件中似乎没有给出解决办法,自己Google了半天才发现一个github的项目,发现其可以提取运动向量到文件中,也可以显示运动向量在播放的画面当中。具体的主页是:
https://github.com/vadimkantorov/mpegflow
其主要的功能也是十分简单:
./mpegflow examples/mpi_sintel_final_alley_1.avi > examples/alley_1.txt
还有一下几种模式可供选择:
在此不多解释。
然后主要是这个项目的编译,自己在windows下面编译似乎是通过了,但是在实际运用的过程中似乎存在问题,只能使用一种模式提取运动向量(--raw模式),其他的几种模式似乎都没有成功,所以索性放弃,在Ubuntu16.04下进行编译。
查看其编译说明是依赖于FFmpeg软件包的,所以在编译之前是要安装ffmpeg的,ffmpeg其官网上已经有源代码可供Linux编译,具体我也是没怎么去试,看到作者推荐使用他自己的另一个项目wigwam安装ffmpeg,也就没有多想,直接安装wigwam
wigwam的主页是:
http://wigwam.in/
在其主页上也很详细地写明了安装方法。
第一:
在~/.bashrc文件中末尾添加以下内容:
alias wigwam='python2.7 <($([ -z "$(which curl)" ] && echo "wget -nv -O -" || echo "curl -sS") https://raw.githubusercontent.com/vadimkantorov/wigwam/master/wigwam.py) --repo https://github.com/vadimkantorov/wigwam/tree/master/wigs'
sudo vim ~/.bashrc
修改后保存退出,然后reload一下:
source ~/.bashrc
然后就是进行ffmpeg的安装:
wigwam init
wigwam install ffmpeg
其中安装ffmpeg的过程稍微久一点,十分钟左右。
安装完后进行mpegflow的编译,首先得让make发现你的ffmpeg在什么地方:
wigwam in
切换到mpegflow的目录编译:
make
有一些warning可以忽略,编译成功后会生成可执行文件mpegflow
最后可以在example文件夹下面验证以下mpegflow,切换到mpegflow文件夹下面运行bash脚本文件:
$ /\ $ bash extract_mpeg_flow.sh
然后就会生成4个txt文件,具体的命令可以查看extract_mpeg_flow.sh
注意:因为mpegflow是依赖于FFmpeg的,所以一定要在使用wigwam in命令进入wigwam环境后才能正常运行,不然会提示找不到
一些库:
../mpegflow: error while loading shared libraries: libavformat.so.57: cannot open shared object file: No such file or directory
../mpegflow: error while loading shared libraries: libavformat.so.57: cannot open shared object file: No such file or directory
../mpegflow: error while loading shared libraries: libavformat.so.57: cannot open shared object file: No such file or directory
../mpegflow: error while loading shared libraries: libavformat.so.57: cannot open shared object file: No such file or directory
终端输入exit可以退出wigwam环境。
collect2: error: ld returned 1 exit status
Makefile:6: recipe for target 'mpegflow' failed
make: *** [mpegflow] Error 1
根据提示是因为缺少bz2的库,所以进行安装:
$ sudo apt-get install libbz2-devReading package lists... DoneBuilding dependency tree Reading state information... DoneThe following additional packages will be installed: bzip2-docThe following NEW packages will be installed: bzip2-doc libbz2-dev0 upgraded, 2 newly installed, 0 to remove and 186 not upgraded.Need to get 324 kB of archives.After this operation, 556 kB of additional disk space will be used.Do you want to continue? [Y/n]
安装之后重新make,又会出现一系列错误:$ vim ./Makefile
在LDFLAGS一行的后面加上 -ldl最后进行make,编译通过,在此记录一下warning:
mpegflow.cpp: In function ‘void ffmpeg_init()’:mpegflow.cpp:75:56: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations] AVCodecContext *enc = ffmpeg_pFormatCtx->streams[i]->codec; ^In file included from mpegflow.cpp:10:0:/usr/local/include/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^mpegflow.cpp:75:56: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations] AVCodecContext *enc = ffmpeg_pFormatCtx->streams[i]->codec; ^In file included from mpegflow.cpp:10:0:/usr/local/include/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^mpegflow.cpp:75:56: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations] AVCodecContext *enc = ffmpeg_pFormatCtx->streams[i]->codec; ^In file included from mpegflow.cpp:10:0:/usr/local/include/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^mpegflow.cpp: In function ‘bool process_frame(AVPacket*)’:mpegflow.cpp:102:12: warning: ‘int avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations] int ret = avcodec_decode_video2(ffmpeg_pVideoStream->codec, ffmpeg_pFrame, &got_frame, pkt); ^In file included from mpegflow.cpp:9:0:/usr/local/include/libavcodec/avcodec.h:4901:5: note: declared here int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, ^mpegflow.cpp:102:12: warning: ‘int avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations] int ret = avcodec_decode_video2(ffmpeg_pVideoStream->codec, ffmpeg_pFrame, &got_frame, pkt); ^In file included from mpegflow.cpp:9:0:/usr/local/include/libavcodec/avcodec.h:4901:5: note: declared here int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, ^mpegflow.cpp:102:55: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations] int ret = avcodec_decode_video2(ffmpeg_pVideoStream->codec, ffmpeg_pFrame, &got_frame, pkt); ^In file included from mpegflow.cpp:10:0:/usr/local/include/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^mpegflow.cpp:102:55: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations] int ret = avcodec_decode_video2(ffmpeg_pVideoStream->codec, ffmpeg_pFrame, &got_frame, pkt); ^In file included from mpegflow.cpp:10:0:/usr/local/include/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^mpegflow.cpp:102:55: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations] int ret = avcodec_decode_video2(ffmpeg_pVideoStream->codec, ffmpeg_pFrame, &got_frame, pkt); ^In file included from mpegflow.cpp:10:0:/usr/local/include/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^mpegflow.cpp:102:92: warning: ‘int avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations] int ret = avcodec_decode_video2(ffmpeg_pVideoStream->codec, ffmpeg_pFrame, &got_frame, pkt); ^In file included from mpegflow.cpp:9:0:/usr/local/include/libavcodec/avcodec.h:4901:5: note: declared here int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, ^mpegflow.cpp: In function ‘bool read_frame(int64_t&, char&, std::vector<AVMotionVector>&)’:mpegflow.cpp:154:23: warning: ‘AVFrame::pkt_pts’ is deprecated [-Wdeprecated-declarations] pts = ffmpeg_pFrame->pkt_pts != AV_NOPTS_VALUE ? ffmpeg_pFrame->pkt_pts : (ffmpeg_pFrame->pkt_dts ^In file included from /usr/local/include/libavcodec/avcodec.h:38:0, from mpegflow.cpp:9:/usr/local/include/libavutil/frame.h:279:13: note: declared here int64_t pkt_pts; ^mpegflow.cpp:154:23: warning: ‘AVFrame::pkt_pts’ is deprecated [-Wdeprecated-declarations] pts = ffmpeg_pFrame->pkt_pts != AV_NOPTS_VALUE ? ffmpeg_pFrame->pkt_pts : (ffmpeg_pFrame->pkt_dts ^In file included from /usr/local/include/libavcodec/avcodec.h:38:0, from mpegflow.cpp:9:/usr/local/include/libavutil/frame.h:279:13: note: declared here int64_t pkt_pts; ^mpegflow.cpp:154:23: warning: ‘AVFrame::pkt_pts’ is deprecated [-Wdeprecated-declarations] pts = ffmpeg_pFrame->pkt_pts != AV_NOPTS_VALUE ? ffmpeg_pFrame->pkt_pts : (ffmpeg_pFrame->pkt_dts ^In file included from /usr/local/include/libavcodec/avcodec.h:38:0, from mpegflow.cpp:9:/usr/local/include/libavutil/frame.h:279:13: note: declared here int64_t pkt_pts; ^mpegflow.cpp:154:66: warning: ‘AVFrame::pkt_pts’ is deprecated [-Wdeprecated-declarations] pts = ffmpeg_pFrame->pkt_pts != AV_NOPTS_VALUE ? ffmpeg_pFrame->pkt_pts : (ffmpeg_pFrame->pkt_dts ^In file included from /usr/local/include/libavcodec/avcodec.h:38:0, from mpegflow.cpp:9:/usr/local/include/libavutil/frame.h:279:13: note: declared here int64_t pkt_pts; ^mpegflow.cpp:154:66: warning: ‘AVFrame::pkt_pts’ is deprecated [-Wdeprecated-declarations] pts = ffmpeg_pFrame->pkt_pts != AV_NOPTS_VALUE ? ffmpeg_pFrame->pkt_pts : (ffmpeg_pFrame->pkt_dts ^In file included from /usr/local/include/libavcodec/avcodec.h:38:0, from mpegflow.cpp:9:/usr/local/include/libavutil/frame.h:279:13: note: declared here int64_t pkt_pts; ^mpegflow.cpp:154:66: warning: ‘AVFrame::pkt_pts’ is deprecated [-Wdeprecated-declarations] pts = ffmpeg_pFrame->pkt_pts != AV_NOPTS_VALUE ? ffmpeg_pFrame->pkt_pts : (ffmpeg_pFrame->pkt_dts ^In file included from /usr/local/include/libavcodec/avcodec.h:38:0, from mpegflow.cpp:9:/usr/local/include/libavutil/frame.h:279:13: note: declared here int64_t pkt_pts;
- ubuntu16.04下利用wigwam安装mpegflow
- ubuntu16.04下安装mariadb
- Ubuntu16.04下安装Matlab
- Ubuntu16.04下openface安装
- Ubuntu16.04下安装matlab2014a
- ubuntu16.04下安装caffe
- ubuntu16.04下安装mysql
- ubuntu16.04下安装opencv
- ubuntu16.04下安装xgboost
- ubuntu16.04下安装docker
- ubuntu16.04下安装opencv
- ubuntu16.04下安装Scrapy
- Ubuntu16.04下安装OpenCV
- Ubuntu16.04下安装supervisor
- ubuntu16.04下安装pip
- Ubuntu16.04下安装pillow
- Ubuntu16.04下安装GTK+
- Ubuntu16.04下安装opencv3
- 优秀博客收藏
- JAVA中的定时器
- 算法提高 ADV-103 逆序排列
- 嚼得菜根做得大事·《菜根谭》·五
- html界面显示Toast
- ubuntu16.04下利用wigwam安装mpegflow
- TestNG学习
- 集合-HashSet
- SQL查询优化小结
- C语言实现大型非负整数加减乘除
- 评论框图片表情输入工具分享
- jsp代码连接数据库实现显示登陆、退出、显示在线人数
- 用C#如何遍历一个窗体中的某一种控件
- 段错误原因小结