首先download下来mpv的代码
git clone https://github.com/mpv-player/mpv.git
然后安装ffmpeg,ffmpeg相关的编译方法在bbs.chinaffmpeg.com中可以找到
mpv代码down下来以后,可以看到目录结构如下
[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost mpv]$ ll
total 432
drwxr-xr-x 37 StevenLiu staff 1258 Apr 16 13:42 .
drwxr-xr-x 35 StevenLiu staff 1190 Apr 16 09:39 ..
drwxr-xr-x 14 StevenLiu staff 476 Apr 16 13:42 .git
-rw-r--r-- 1 StevenLiu staff 424 Apr 16 11:27 .gitignore
-rw-r--r-- 1 StevenLiu staff 3887 Apr 16 13:35 .lock-waf_darwin_build
-rw-r--r-- 1 StevenLiu staff 492 Apr 16 11:27 .travis.yml
drwxr-xr-x 3 StevenLiu staff 102 Apr 16 12:05 .waf-1.7.15-9c6c439a6416a92b3e844736c4ef3c7b
-rw-r--r-- 1 StevenLiu staff 1037 Apr 16 13:42 Copyright
drwxr-xr-x 10 StevenLiu staff 340 Apr 16 13:42 DOCS
-rw-r--r-- 1 StevenLiu staff 18097 Apr 16 13:42 LICENSE
-rw-r--r-- 1 StevenLiu staff 4771 Apr 16 13:42 README.md
drwxr-xr-x 14 StevenLiu staff 476 Apr 16 13:42 TOOLS
drwxr-xr-x 19 StevenLiu staff 646 Apr 16 13:42 audio
-rwxr-xr-x 1 StevenLiu staff 1053 Apr 16 13:42 bootstrap.py
drwxr-xr-x 4 StevenLiu staff 136 Apr 16 13:42 bstr
drwxr-xr-x 26 StevenLiu staff 884 Apr 16 13:42 common
drwxr-xr-x 8 StevenLiu staff 272 Apr 16 13:42 compat
drwxr-xr-x 23 StevenLiu staff 782 Apr 16 13:42 demux
drwxr-xr-x 10 StevenLiu staff 340 Apr 16 13:42 etc
drwxr-xr-x 16 StevenLiu staff 544 Apr 16 13:42 input
drwxr-xr-x 4 StevenLiu staff 136 Apr 16 13:42 libmpv
drwxr-xr-x 6 StevenLiu staff 204 Apr 16 13:42 misc
-rwxr-xr-x 1 StevenLiu staff 90011 Apr 16 13:42 old-configure
-rw-r--r-- 1 StevenLiu staff 19619 Apr 16 13:42 old-makefile
drwxr-xr-x 16 StevenLiu staff 544 Apr 16 13:42 options
drwxr-xr-x 35 StevenLiu staff 1190 Apr 16 13:42 osdep
drwxr-xr-x 24 StevenLiu staff 816 Apr 16 13:42 player
drwxr-xr-x 51 StevenLiu staff 1734 Apr 16 13:42 stream
drwxr-xr-x 26 StevenLiu staff 884 Apr 16 13:42 sub
drwxr-xr-x 8 StevenLiu staff 272 Apr 16 13:42 ta
-rw-r--r-- 1 StevenLiu staff 116 Apr 16 13:42 talloc.h
-rwxr-xr-x 1 StevenLiu staff 1998 Apr 16 13:42 travis-deps
-rwxr-xr-x 1 StevenLiu staff 1192 Apr 16 13:42 version.sh
drwxr-xr-x 28 StevenLiu staff 952 Apr 16 13:42 video
drwxr-xr-x 12 StevenLiu staff 408 Apr 16 13:42 waftools
-rw-r--r-- 1 StevenLiu staff 28347 Apr 16 13:42 wscript
-rw-r--r-- 1 StevenLiu staff 20408 Apr 16 13:42 wscript_build.py
可以看到,里面有一个bootstrap.py,执行这个bootstrap.py即可
[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost mpv]$ ./bootstrap.py
Downloading [url=https://waf.googlecode.com/files/waf-1.7.15...]https://waf.googlecode.com/files/waf-1.7.15...[/url]
Checksum verified.
当然,在OSX下面没有pkg-config,所以,如果想编译mpv的话,需要安装一个pkg-config,如果不安装这个,执行下面的命令不会通过,会提示如下错误
[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost mpv]$ ./waf configure --enable-macosx-bundle
Setting top to : /Users/StevenLiu/Work/multimedia/mpv
Setting out to : /Users/StevenLiu/Work/multimedia/mpv/build
Checking for waf version in 1.7.13-1.8.0 : ok
Checking for program cc : /usr/bin/cc
Checking for program pkg-config : not found
Could not find the program pkg-config
(complete log in /Users/StevenLiu/Work/multimedia/mpv/build/config.log)
所以,需要安装pkg-config,如果源代码安装pkg-config的话,比较费劲,看到mpv的readme里面有说,可以使用brew来安装pkg-config
首先安装一下brew
[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost mpv]$ ruby -e "$(curl -fsSL [url=https://raw.github.com/Homebrew/homebrew/go/install]https://raw.github.com/Homebrew/homebrew/go/install[/url])"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/share
/usr/local/share/locale
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man3
/usr/local/share/man/man7
/usr/local/share/info
/usr/local/share/doc
/usr/local/share/aclocal
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/share
/usr/local/share/locale
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man3
/usr/local/share/man/man7
/usr/local/share/info
/usr/local/share/doc
/usr/local/share/aclocal
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig /usr/local/share /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man7 /usr/local/share/info /usr/local/share/doc /usr/local/share/aclocal
Password:
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig /usr/local/share /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man7 /usr/local/share/info /usr/local/share/doc /usr/local/share/aclocal
==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 166549, done.
remote: Compressing objects: 100% (46832/46832), done.
remote: Total 166549 (delta 118659), reused 166469 (delta 118601)
Receiving objects: 100% (166549/166549), 31.57 MiB | 136.00 KiB/s, done.
Resolving deltas: 100% (118659/118659), done.
From [url=https://github.com/Homebrew/homebrew]https://github.com/Homebrew/homebrew[/url]
* [new branch] master -> origin/master
HEAD is now at 433ecce postgresql: update 9.3.4 bottle.
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help
安装玩brew后,可以安装pkg-config了[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost ~]$ brew install pkg-config
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Downloading [url]https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-0.28.mavericks.bottle.2.tar.gz[/url]
######################################################################## 100.0%
==> Pouring pkg-config-0.28.mavericks.bottle.2.tar.gz
/usr/local/Cellar/pkg-config/0.28: 10 files, 604K
安装好pkg-config后,可以编译mpv了
[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost mpv]$ ./waf configure --disable-libass
Setting top to : /Users/StevenLiu/Work/multimedia/mpv
Setting out to : /Users/StevenLiu/Work/multimedia/mpv/build
Checking for waf version in 1.7.13-1.8.0 : ok
Checking for program cc : /usr/bin/cc
Checking for program pkg-config : /usr/local/bin/pkg-config
Checking for program perl : /usr/bin/perl
Checking for program rst2man : not found
Checking for program rst2pdf : not found
Checking for program windres : not found
Checking for 'gcc' (c compiler) : /usr/bin/cc
Detected target OS: : os-darwin
Checking for shared library : disabled
Checking for build client API examples : libmpv-shared not found
Checking for static build : disabled
Checking for whether to include binary compile time : yes
Checking for whether to compile-in debugging information : yes
Checking for manpage generation : no (missing RST2MAN)
Checking for pdf manual generation : no (missing RST2PDF)
Checking for dynamic loader : yes
Checking for dlopen : yes
Checking for compilation of default filters for vf_dlopen : disabled
Checking for compilation of a Mac OS X Application bundle : disabled
Checking for w32 executable : not found any of os-win32, os-cygwin
Checking for inline assembly : yes
Checking for compiler support for noexecstack : no
Checking for linker support for --nxcompat --no-seh --dynamicbase : no
Checking for ebx availability : yes
Checking for -lm : yes
Checking for nanosleep : yes
Checking for mman.h : yes
Checking for POSIX threads : yes
Checking for compiler support for __atomic built-ins : yes
Checking for compiler support for __sync built-ins : atomic-builtins found
Checking for compiler support for usable thread synchronization built-ins : yes
Checking for linking with -lrt : no
Checking for iconv : yes
Checking for w32/dos paths : not found any of os-win32, os-cygwin
Checking for w32 priority API : not found any of os-win32, os-cygwin
Checking for videoio.h : no
Checking for terminfo : yes
Checking for termcap : terminfo found
Checking for termios : yes
Checking for shm : yes
Checking for POSIX select() : yes
Checking for glob() : yes
Checking for glob() win32 replacement : not found any of os-win32, os-cygwin
Checking for setmode() : no
Checking for BSD's fstatfs() : yes
Checking for Linux's fstatfs() : os-linux not found
Checking for sys/sysinfo.h : no
Checking for libguess support : no
Checking for Samba support : no
Checking for libquvi 0.4.x support : no
Checking for libquvi 0.9.x support : no
Checking for libquvi support : not found any of libquvi9, libquvi4
Checking for SSA/ASS support : disabled
Checking for libass OSD support : libass not found
Checking for dummy OSD support : yes
Checking for zlib : yes
Checking for Encoding : yes
Checking for joystick : disabled
Checking for lirc : no
Checking for VCD support : yes
Checking for Bluray support : no
Checking for dvdread support : no
Checking for dvdnav support : dvdread not found
Checking for cdda support (libcdio) : no
Checking for ENCA support : no
Checking for mpg123 support : no
Checking for LADSPA plugin support : no
Checking for libbs2b audio filter support : no
Checking for LCMS2 support : no
Checking for VapourSynth filter bridge : no
Checking for SDL2 : disabled
Checking for SDL (1.x) : disabled
Checking for OSS (implementation from opensound.com) : no
Checking for OSS (platform-specific OSS implementation) : no
Checking for OSS (emulation on top of SunAudio) : no
Checking for OSS audio output : not found any of oss-audio-native, oss-audio-4front, oss-audio-sunaudio
Checking for audio select() : oss-audio not found
Checking for RSound audio output : no
Checking for sndio audio input/output : no
Checking for PulseAudio audio output : no
Checking for PortAudio audio output : no
Checking for JACK audio output : no
Checking for OpenAL audio output : disabled
Checking for ALSA audio output : no
Checking for CoreAudio audio output : yes
Checking for DirectSound audio output : no
Checking for WASAPI audio output : no
Checking for Cocoa : yes
Checking for GDI : no
Checking for WinMM : no
Checking for OLE : no
Checking for UUID : no
Checking for Wayland : no
Checking for X11 : no
Checking for Xss screensaver extensions : x11 not found
Checking for X extensions : x11 not found
Checking for Xv video output : x11 not found
Checking for Xinerama : x11 not found
Checking for Xxf86vm : x11 not found
Checking for XF86keysym : x11 not found
Checking for OpenGL Cocoa Backend : yes
Checking for OpenGL X11 Backend : x11 not found
Checking for OpenGL Wayland Backend : wayland not found
Checking for OpenGL Win32 Backend : gdi, winmm, uuid, ole not found
Checking for OpenGL video outputs : yes
Checking for CoreVideo : yes
Checking for VDPAU acceleration : x11 not found
Checking for VDPAU with OpenGL/X11 : gl-x11, vdpau not found
Checking for VAAPI acceleration : x11 not found
Checking for VAAPI VPP : vaapi not found
Checking for VAAPI GLX : gl-x11, vaapi not found
Checking for CACA : no
Checking for DVB : no
Checking for DVB input module : dvb not found
Checking for JPEG support : no
Checking for Direct3D support : gdi, winmm, uuid, ole not found
Checking for libav/ffmpeg : yes
Checking for libavresample : no
Checking for libswresample : yes
Checking for usable resampler found : yes
Checking for libavcodec avcodec_enum_to_chroma_pos API : yes
Checking for libavutil QP API : yes
Checking for libavfilter : yes
Checking for libavdevice : yes
Checking for libpostproc : yes
Checking for libavcodec AV_PKT_DATA_METADATA_UPDATE side data type : yes
Checking for libavcodec AV_PKT_DATA_REPLAYGAIN side data type : yes
Checking for libavutil AVFrame metadata : yes
Checking for libavcodec VAAPI hwaccel : vaapi not found
Checking for libavcodec VDA hwaccel : yes
Checking for libavcodec VDA ref-counted CVPixelBuffers : yes
Checking for VDA with OpenGL : yes
Checking for libavcodec VDPAU hwaccel : vdpau not found
Checking for TV interface : yes
Checking for Video4Linux2 TV interface : no
Checking for libv4l2 support : no
Checking for Video4Linux2 MPEG PVR interface : no
Checking for audio input support : not found any of tv-v4l2
Checking for Lua : no
Writing configuration header: : config.h
Writing header: : version.h
'configure' finished successfully (8.646s)
执行完configure以后,就可以build了
[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost mpv]$ ./waf build
Waf: Entering directory `/Users/StevenLiu/Work/multimedia/mpv/build'
[ 1/216] macosx_icon.inc: TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns -> build/osdep/macosx_icon.inc
[ 2/216] x11_icon.inc: video/out/x11_icon.bin -> build/video/out/x11_icon.inc
[ 3/216] input_conf.h: etc/input.conf -> build/input/input_conf.h
[ 4/216] gl_video_shaders.h: video/out/gl_video_shaders.glsl -> build/video/out/gl_video_shaders.h
[ 5/216] osd_font.h: sub/osd_font.otf -> build/sub/osd_font.h
[ 6/216] defaults.inc: player/lua/defaults.lua -> build/player/lua/defaults.inc
[ 7/216] assdraw.inc: player/lua/assdraw.lua -> build/player/lua/assdraw.inc
[ 8/216] osc.inc: player/lua/osc.lua -> build/player/lua/osc.inc
[ 9/216] ebml_types.h: demux/ebml.c demux/demux_mkv.c -> build/ebml_types.h
[ 10/216] ebml_defs.c: demux/ebml.c -> build/ebml_defs.c
[ 11/216] c: ta/ta.c -> build/ta/ta.c.11.o
........
[208/216] c: video/out/cocoa/window.m -> build/video/out/cocoa/window.m.11.o
[209/216] c: options/m_property.c -> build/options/m_property.c.11.o
[210/216] c: video/filter/vf_phase.c -> build/video/filter/vf_phase.c.11.o
[211/216] c: sub/sd_lavc_conv.c -> build/sub/sd_lavc_conv.c.11.o
[212/216] c: video/filter/vf_softpulldown.c -> build/video/filter/vf_softpulldown.c.11.o
[213/216] c: video/out/vo_lavc.c -> build/video/out/vo_lavc.c.11.o
[214/216] c: common/av_log.c -> build/common/av_log.c.11.o
[215/216] c: stream/stream_file.c -> build/stream/stream_file.c.11.o
[216/216] linking -> build/mpv
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
Waf: Leaving directory `/Users/StevenLiu/Work/multimedia/mpv/build'
'build' finished successfully (18.475s)
接着就可以执行mpv来看看了
[AppleScript] 纯文本查看 复制代码 [StevenLiu@localhost mpv]$ ./build/mpv ~/Movies/QvodPlayer/西游记之大闹天宫BD1280高清国语中字.rmvb
Compiled without libass.
There will be no OSD and no text subtitles.
Playing: /Users/StevenLiu/Movies/QvodPlayer/西游记之大闹天宫BD1280高清国语中字.rmvb
rm: Invalid stream index 2 for index at pos 1490818606
Detected file format: RealMedia (libavformat)
File tags:
title: ????Ӱ-bbs.wujidy.com
author: ????Ӱ-bbs.wujidy.com
copyright:
comment:
ASMRuleBook: #($Bandwidth >= 0),Stream0Bandwidth = 64000, Stream1Bandwidth = 1486000;
Audiences: Easy RealMedia Tool's Audience;
audioMode: music
Creation Date: 3/28/2014 20:34:36
Description: This File is Created by Easy RealMedia Tools@!
Email: [email]rick@redcheek.net[/email]
Generated By: Easy RealMedia Tools V1.8x
HomeWeb: [url]http://redcheek.net[/url]
Keywords:
Modification Date: 3/28/2014 20:34:36
videoMode: normal
[stream] Video (+) --vid=1 (rv40)
[stream] Audio (+) --aid=1 (aac)
Selected video codec: RealVideo 4.0 [lavc:rv40]
Selected audio codec: AAC (Advanced Audio Coding) [lavc:aac]
AO: [coreaudio] 32000Hz stereo 2ch float
AV: 00:00:00 / 01:47:20 (0%) A-V: 0.000
VO: [opengl] 1280x720 => 1280x720 yuv420p
AV: 00:01:07 / 01:47:20 (1%) A-V: 0.006
|