Ubuntu compiler Ffmpeg+sdl+ffplay Extract motion vectors

Source: Internet
Author: User

Compile FFmpeg: The first step:
从官网http://ffmpeg.org/下载最新版本.解压tar -xjvf ffmpeg-3.3.1.tar.bz2进入目录cd ffmpeg-3.3.1
Step Two:
从http://yasm.tortall.net/Download.html下载yasmtar -xvzf yasm-1.3.0.tar.gzcd yasm-1.3.0/./configuremakemake install
Step Three:
回到ffmpeg目录中./configure --enable-shared --prefix=/你想让他编译以后在哪里/ffmpegmakemake install编译为动态库时的问题:/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet‘ can not be used when making a shared object; recompile with -fPIC修改方法:./configure --enable-pic && make[默认编译安装在/usr/local/下
Test: 1. Enter/usr/local/ffmpeg/bin./ffmpeg View installation 2. Compile the C file with FFmpeg:
  gcc -o 可执行文件名 待编译文件名.c -L../lib/ -lavcodec -lavdevice -lavfilter -lavformat -lavutil
Compilation uses FFmpeg to extract motion Vector1. Compile and install ffmpeg;2. Use Pkg-config--cflags--libs OpenCV to find the OPENCV link library required for compiling files, Modify the Objects.mk and subdir.mk files, then make, 3. Or compile with the cmakefile of OpenCV:
具体内容:[注意每行之间不能有空格,直接回车]PROJECT(mpegflow)CMAKE_MINIMUM_REQUIRED(VERSION 2.8)if(COMMAND cmake_policy)cmake_policy(SET CMP0003 NEW)endif(COMMAND cmake_policy)FIND_PACKAGE( OpenCV REQUIRED )# Declare the target (an executable)ADD_EXECUTABLE(mpegflow  draw_flow.cpp)TARGET_LINK_LIBRARIES(mpegflow ${OpenCV_LIBS})  然后cmake.,再执行make即可。
4. Compile the Extract_mvs file using the FFmpeg library:
  gcc -o extract_mvs /ffmpeg-2.8/doc/samples/extract_mvs.c -L../lib/ -lavcodec -lavdevice -lavfilter -lavformat -lavutil
Install FFmpeg load SDL, compile run ffplay1. Install the FFMPEG2. Install SDL:

sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-sound1.2-dev

Detects that the SDL is loaded without: Sdl-config--exec-prefix--version--cflag]ffplay for motion vector visualization:

ffplay -debug vis_mb_type test.mp4 ffplay -vismv pf test.mp4

Ubuntu compiler Ffmpeg+sdl+ffplay Extract motion vectors

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.