Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2345483
  • 博文数量: 141
  • 博客积分: 3552
  • 博客等级: 中校
  • 技术积分: 4148
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-15 14:39
个人简介

熟悉Linux下程序设计及各种应用程序 熟悉C Language 熟悉Glusterfs、FFmpeg、CDN 系统设计,计算机图形系统设计、分布式程序设计 目前主要研究方向:流媒体

文章分类

全部博文(141)

分类: 其他UNIX

2014-04-16 14:11:05

首先download下来mpv的代码
git clone 
然后安装ffmpeg,ffmpeg相关的编译方法在bbs.chinaffmpeg.com中可以找到
mpv代码down下来以后,可以看到目录结构如下

点击(此处)折叠或打开

  1. [StevenLiu@localhost mpv]$ ll
  2. total 432
  3. drwxr-xr-x 37 StevenLiu staff 1258 Apr 16 13:42 .
  4. drwxr-xr-x 35 StevenLiu staff 1190 Apr 16 09:39 ..
  5. drwxr-xr-x 14 StevenLiu staff 476 Apr 16 13:42 .git
  6. -rw-r--r-- 1 StevenLiu staff 424 Apr 16 11:27 .gitignore
  7. -rw-r--r-- 1 StevenLiu staff 3887 Apr 16 13:35 .lock-waf_darwin_build
  8. -rw-r--r-- 1 StevenLiu staff 492 Apr 16 11:27 .travis.yml
  9. drwxr-xr-x 3 StevenLiu staff 102 Apr 16 12:05 .waf-1.7.15-9c6c439a6416a92b3e844736c4ef3c7b
  10. -rw-r--r-- 1 StevenLiu staff 1037 Apr 16 13:42 Copyright
  11. drwxr-xr-x 10 StevenLiu staff 340 Apr 16 13:42 DOCS
  12. -rw-r--r-- 1 StevenLiu staff 18097 Apr 16 13:42 LICENSE
  13. -rw-r--r-- 1 StevenLiu staff 4771 Apr 16 13:42 README.md
  14. drwxr-xr-x 14 StevenLiu staff 476 Apr 16 13:42 TOOLS
  15. drwxr-xr-x 19 StevenLiu staff 646 Apr 16 13:42 audio
  16. -rwxr-xr-x 1 StevenLiu staff 1053 Apr 16 13:42 bootstrap.py
  17. drwxr-xr-x 4 StevenLiu staff 136 Apr 16 13:42 bstr
  18. drwxr-xr-x 26 StevenLiu staff 884 Apr 16 13:42 common
  19. drwxr-xr-x 8 StevenLiu staff 272 Apr 16 13:42 compat
  20. drwxr-xr-x 23 StevenLiu staff 782 Apr 16 13:42 demux
  21. drwxr-xr-x 10 StevenLiu staff 340 Apr 16 13:42 etc
  22. drwxr-xr-x 16 StevenLiu staff 544 Apr 16 13:42 input
  23. drwxr-xr-x 4 StevenLiu staff 136 Apr 16 13:42 libmpv
  24. drwxr-xr-x 6 StevenLiu staff 204 Apr 16 13:42 misc
  25. -rwxr-xr-x 1 StevenLiu staff 90011 Apr 16 13:42 old-configure
  26. -rw-r--r-- 1 StevenLiu staff 19619 Apr 16 13:42 old-makefile
  27. drwxr-xr-x 16 StevenLiu staff 544 Apr 16 13:42 options
  28. drwxr-xr-x 35 StevenLiu staff 1190 Apr 16 13:42 osdep
  29. drwxr-xr-x 24 StevenLiu staff 816 Apr 16 13:42 player
  30. drwxr-xr-x 51 StevenLiu staff 1734 Apr 16 13:42 stream
  31. drwxr-xr-x 26 StevenLiu staff 884 Apr 16 13:42 sub
  32. drwxr-xr-x 8 StevenLiu staff 272 Apr 16 13:42 ta
  33. -rw-r--r-- 1 StevenLiu staff 116 Apr 16 13:42 talloc.h
  34. -rwxr-xr-x 1 StevenLiu staff 1998 Apr 16 13:42 travis-deps
  35. -rwxr-xr-x 1 StevenLiu staff 1192 Apr 16 13:42 version.sh
  36. drwxr-xr-x 28 StevenLiu staff 952 Apr 16 13:42 video
  37. drwxr-xr-x 12 StevenLiu staff 408 Apr 16 13:42 waftools
  38. -rw-r--r-- 1 StevenLiu staff 28347 Apr 16 13:42 wscript
  39. -rw-r--r-- 1 StevenLiu staff 20408 Apr 16 13:42 wscript_build.py




可以看到,里面有一个bootstrap.py,执行这个bootstrap.py即可

点击(此处)折叠或打开

  1. [StevenLiu@localhost mpv]$ ./bootstrap.py
  2. Downloading https://waf.googlecode.com/files/waf-1.7.15...
  3. Checksum verified.


当然,在OSX下面没有pkg-config,所以,如果想编译mpv的话,需要安装一个pkg-config,如果不安装这个,执行下面的命令不会通过,会提示如下错误

点击(此处)折叠或打开

  1. [StevenLiu@localhost mpv]$ ./waf configure --enable-macosx-bundle
  2. Setting top to : /Users/StevenLiu/Work/multimedia/mpv
  3. Setting out to : /Users/StevenLiu/Work/multimedia/mpv/build
  4. Checking for waf version in 1.7.13-1.8.0 : ok
  5. Checking for program cc : /usr/bin/cc
  6. Checking for program pkg-config : not found
  7. Could not find the program pkg-config
  8. (complete log in /Users/StevenLiu/Work/multimedia/mpv/build/config.log)



所以,需要安装pkg-config,如果源代码安装pkg-config的话,比较费劲,看到mpv的readme里面有说,可以使用brew来安装pkg-config
首先安装一下brew

点击(此处)折叠或打开

  1. [StevenLiu@localhost mpv]$ ruby -e "$(curl -fsSL )"
  2. ==> This script will install:
  3. /usr/local/bin/brew
  4. /usr/local/Library/...
  5. /usr/local/share/man/man1/brew.1
  6. ==> The following directories will be made group writable:
  7. /usr/local/.
  8. /usr/local/bin
  9. /usr/local/etc
  10. /usr/local/include
  11. /usr/local/lib
  12. /usr/local/lib/pkgconfig
  13. /usr/local/share
  14. /usr/local/share/locale
  15. /usr/local/share/man
  16. /usr/local/share/man/man1
  17. /usr/local/share/man/man3
  18. /usr/local/share/man/man7
  19. /usr/local/share/info
  20. /usr/local/share/doc
  21. /usr/local/share/aclocal
  22. ==> The following directories will have their group set to admin:
  23. /usr/local/.
  24. /usr/local/bin
  25. /usr/local/etc
  26. /usr/local/include
  27. /usr/local/lib
  28. /usr/local/lib/pkgconfig
  29. /usr/local/share
  30. /usr/local/share/locale
  31. /usr/local/share/man
  32. /usr/local/share/man/man1
  33. /usr/local/share/man/man3
  34. /usr/local/share/man/man7
  35. /usr/local/share/info
  36. /usr/local/share/doc
  37. /usr/local/share/aclocal

  38. Press RETURN to continue or any other key to abort
  39. ==> /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
  40. Password:
  41. ==> /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
  42. ==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew
  43. ==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
  44. ==> Downloading and installing Homebrew.
  45. ==> bbs.chinaffmpeg.com 孙悟空
  46. remote: Counting objects: 166549, done.
  47. remote: Compressing objects: 100% (46832/46832), done.
  48. remote: Total 166549 (delta 118659), reused 166469 (delta 118601)
  49. Receiving objects: 100% (166549/166549), 31.57 MiB | 136.00 KiB/s, done.
  50. Resolving deltas: 100% (118659/118659), done.
  51. From https://github.com/Homebrew/homebrew
  52. * [new branch] master -> origin/master
  53. HEAD is now at 433ecce postgresql: update 9.3.4 bottle.
  54. ==> Installation
  55. You should run `brew doctor



安装玩brew后,可以安装pkg-config了

点击(此处)折叠或打开

  1. [StevenLiu@localhost ~]$ brew install pkg-config
  2. Warning: It appears you have MacPorts or Fink installed.
  3. Software installed with other package managers causes known problems for
  4. Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
  5. ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-0.28.mavericks.bottle.2.tar.gz
  6. ######################################################################## 100.0%
  7. ==> Pouring pkg-config-0.28.mavericks.bottle.2.tar.gz
  8. ???? /usr/local/Cellar/pkg-config/0.28: 10 files, 604K



安装好pkg-config后,可以编译mpv了

点击(此处)折叠或打开

  1. [StevenLiu@localhost mpv]$ ./waf configure --disable-libass
  2. Setting top to : /Users/StevenLiu/Work/multimedia/mpv
  3. Setting out to : /Users/StevenLiu/Work/multimedia/mpv/build
  4. Checking for waf version in 1.7.13-1.8.0 : ok
  5. Checking for program cc : /usr/bin/cc
  6. Checking for program pkg-config : /usr/local/bin/pkg-config
  7. Checking for program perl : /usr/bin/perl
  8. Checking for program rst2man : not found
  9. Checking for program rst2pdf : not found
  10. Checking for program windres : not found
  11. Checking for 'gcc' (c compiler) : /usr/bin/cc
  12. Detected target OS: : os-darwin
  13. Checking for shared library : disabled
  14. Checking for build client API examples : libmpv-shared not found
  15. Checking for static build : disabled
  16. Checking for whether to include binary compile time : yes
  17. Checking for whether to compile-in debugging information : yes
  18. Checking for manpage generation : no (missing RST2MAN)
  19. Checking for pdf manual generation : no (missing RST2PDF)
  20. Checking for dynamic loader : yes
  21. Checking for dlopen : yes
  22. Checking for compilation of default filters for vf_dlopen : disabled
  23. Checking for compilation of a Mac OS X Application bundle : disabled
  24. Checking for w32 executable : not found any of os-win32, os-cygwin
  25. Checking for inline assembly : yes
  26. Checking for compiler support for noexecstack : no
  27. Checking for linker support for --nxcompat --no-seh --dynamicbase : no
  28. Checking for ebx availability : yes
  29. Checking for -lm : yes
  30. Checking for nanosleep : yes
  31. Checking for mman.h : yes
  32. Checking for POSIX threads : yes
  33. Checking for compiler support for __atomic built-ins : yes
  34. Checking for compiler support for __sync built-ins : atomic-builtins found
  35. Checking for compiler support for usable thread synchronization built-ins : yes
  36. Checking for linking with -lrt : no
  37. Checking for iconv : yes
  38. Checking for w32/dos paths : not found any of os-win32, os-cygwin
  39. Checking for w32 priority API : not found any of os-win32, os-cygwin
  40. Checking for videoio.h : no
  41. Checking for terminfo : yes
  42. Checking for termcap : terminfo found
  43. Checking for termios : yes
  44. Checking for shm : yes
  45. Checking for POSIX select() : yes
  46. Checking for glob() : yes
  47. Checking for glob() win32 replacement : not found any of os-win32, os-cygwin
  48. Checking for setmode() : no
  49. Checking for BSD's fstatfs() : yes
  50. Checking for Linux's fstatfs() : os-linux not found
  51. Checking for sys/sysinfo.h : no
  52. Checking for libguess support : no
  53. Checking for Samba support : no
  54. Checking for libquvi 0.4.x support : no
  55. Checking for libquvi 0.9.x support : no
  56. Checking for libquvi support : not found any of libquvi9, libquvi4
  57. Checking for SSA/ASS support : disabled
  58. Checking for libass OSD support : libass not found
  59. Checking for dummy OSD support : yes
  60. Checking for zlib : yes
  61. Checking for Encoding : yes
  62. Checking for joystick : disabled
  63. Checking for lirc : no
  64. Checking for VCD support : yes
  65. Checking for Bluray support : no
  66. Checking for dvdread support : no
  67. Checking for dvdnav support : dvdread not found
  68. Checking for cdda support (libcdio) : no
  69. Checking for ENCA support : no
  70. Checking for mpg123 support : no
  71. Checking for LADSPA plugin support : no
  72. Checking for libbs2b audio filter support : no
  73. Checking for LCMS2 support : no
  74. Checking for VapourSynth filter bridge : no
  75. Checking for SDL2 : disabled
  76. Checking for SDL (1.x) : disabled
  77. Checking for OSS (implementation from opensound.com) : no
  78. Checking for OSS (platform-specific OSS implementation) : no
  79. Checking for OSS (emulation on top of SunAudio) : no
  80. Checking for OSS audio output : not found any of oss-audio-native, oss-audio-4front, oss-audio-sunaudio
  81. Checking for audio select() : oss-audio not found
  82. Checking for RSound audio output : no
  83. Checking for sndio audio input/output : no
  84. Checking for PulseAudio audio output : no
  85. Checking for PortAudio audio output : no
  86. Checking for JACK audio output : no
  87. Checking for OpenAL audio output : disabled
  88. Checking for ALSA audio output : no
  89. Checking for CoreAudio audio output : yes
  90. Checking for DirectSound audio output : no
  91. Checking for WASAPI audio output : no
  92. Checking for Cocoa : yes
  93. Checking for GDI : no
  94. Checking for WinMM : no
  95. Checking for OLE : no
  96. Checking for UUID : no
  97. Checking for Wayland : no
  98. Checking for X11 : no
  99. Checking for Xss screensaver extensions : x11 not found
  100. Checking for X extensions : x11 not found
  101. Checking for Xv video output : x11 not found
  102. Checking for Xinerama : x11 not found
  103. Checking for Xxf86vm : x11 not found
  104. Checking for XF86keysym : x11 not found
  105. Checking for OpenGL Cocoa Backend : yes
  106. Checking for OpenGL X11 Backend : x11 not found
  107. Checking for OpenGL Wayland Backend : wayland not found
  108. Checking for OpenGL Win32 Backend : gdi, winmm, uuid, ole not found
  109. Checking for OpenGL video outputs : yes
  110. Checking for CoreVideo : yes
  111. Checking for VDPAU acceleration : x11 not found
  112. Checking for VDPAU with OpenGL/X11 : gl-x11, vdpau not found
  113. Checking for VAAPI acceleration : x11 not found
  114. Checking for VAAPI VPP : vaapi not found
  115. Checking for VAAPI GLX : gl-x11, vaapi not found
  116. Checking for CACA : no
  117. Checking for DVB : no
  118. Checking for DVB input module : dvb not found
  119. Checking for JPEG support : no
  120. Checking for Direct3D support : gdi, winmm, uuid, ole not found
  121. Checking for libav/ffmpeg : yes
  122. Checking for libavresample : no
  123. Checking for libswresample : yes
  124. Checking for usable resampler found : yes
  125. Checking for libavcodec avcodec_enum_to_chroma_pos API : yes
  126. Checking for libavutil QP API : yes
  127. Checking for libavfilter : yes
  128. Checking for libavdevice : yes
  129. Checking for libpostproc : yes
  130. Checking for libavcodec AV_PKT_DATA_METADATA_UPDATE side data type : yes
  131. Checking for libavcodec AV_PKT_DATA_REPLAYGAIN side data type : yes
  132. Checking for libavutil AVFrame metadata : yes
  133. Checking for libavcodec VAAPI hwaccel : vaapi not found
  134. Checking for libavcodec VDA hwaccel : yes
  135. Checking for libavcodec VDA ref-counted CVPixelBuffers : yes
  136. Checking for VDA with OpenGL : yes
  137. Checking for libavcodec VDPAU hwaccel : vdpau not found
  138. Checking for TV interface : yes
  139. Checking for Video4Linux2 TV interface : no
  140. Checking for libv4l2 support : no
  141. Checking for Video4Linux2 MPEG PVR interface : no
  142. Checking for audio input support : not found any of tv-v4l2
  143. Checking for Lua : no
  144. Writing configuration header: : config.h
  145. Writing header: : version.h
  146. 'configure' finished successfully (8.646s)



执行完configure以后,就可以build了

点击(此处)折叠或打开

  1. [StevenLiu@localhost mpv]$ ./waf build
  2. Waf: Entering directory `/Users/StevenLiu/Work/multimedia/mpv/build'
  3. [ 1/216] macosx_icon.inc: TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns -> build/osdep/macosx_icon.inc
  4. [ 2/216] x11_icon.inc: video/out/x11_icon.bin -> build/video/out/x11_icon.inc
  5. [ 3/216] input_conf.h: etc/input.conf -> build/input/input_conf.h
  6. [ 4/216] gl_video_shaders.h: video/out/gl_video_shaders.glsl -> build/video/out/gl_video_shaders.h
  7. [ 5/216] osd_font.h: sub/osd_font.otf -> build/sub/osd_font.h
  8. [ 6/216] defaults.inc: player/lua/defaults.lua -> build/player/lua/defaults.inc
  9. [ 7/216] assdraw.inc: player/lua/assdraw.lua -> build/player/lua/assdraw.inc
  10. [ 8/216] osc.inc: player/lua/osc.lua -> build/player/lua/osc.inc
  11. [ 9/216] ebml_types.h: demux/ebml.c demux/demux_mkv.c -> build/ebml_types.h
  12. [ 10/216] ebml_defs.c: demux/ebml.c -> build/ebml_defs.c
  13. [ 11/216] c: ta/ta.c -> build/ta/ta.c.11.o
  14. ........
  15. [208/216] c: video/out/cocoa/window.m -> build/video/out/cocoa/window.m.11.o
  16. [209/216] c: options/m_property.c -> build/options/m_property.c.11.o
  17. [210/216] c: video/filter/vf_phase.c -> build/video/filter/vf_phase.c.11.o
  18. [211/216] c: sub/sd_lavc_conv.c -> build/sub/sd_lavc_conv.c.11.o
  19. [212/216] c: video/filter/vf_softpulldown.c -> build/video/filter/vf_softpulldown.c.11.o
  20. [213/216] c: video/out/vo_lavc.c -> build/video/out/vo_lavc.c.11.o
  21. [214/216] c: common/av_log.c -> build/common/av_log.c.11.o
  22. [215/216] c: stream/stream_file.c -> build/stream/stream_file.c.11.o
  23. [216/216] linking -> build/mpv
  24. clang: warning: argument unused during compilation: '-pthread'
  25. clang: warning: argument unused during compilation: '-pthread'
  26. clang: warning: argument unused during compilation: '-pthread'
  27. clang: warning: argument unused during compilation: '-pthread'
  28. clang: warning: argument unused during compilation: '-pthread'
  29. clang: warning: argument unused during compilation: '-pthread'
  30. clang: warning: argument unused during compilation: '-pthread'
  31. clang: warning: argument unused during compilation: '-pthread'
  32. clang: warning: argument unused during compilation: '-pthread'
  33. Waf: Leaving directory `/Users/StevenLiu/Work/multimedia/mpv/build'
  34. 'build' finished successfully (18.475s)



接着就可以执行mpv来看看了

点击(此处)折叠或打开

  1. [StevenLiu@localhost mpv]$ ./build/mpv ~/Movies/QvodPlayer/西游记之大闹天宫BD1280高清国语中字.rmvb
  2. Compiled without libass.
  3. There will be no OSD and no text subtitles.
  4. Playing: /Users/StevenLiu/Movies/QvodPlayer/西游记之大闹天宫BD1280高清国语中字.rmvb
  5. rm: Invalid stream index 2 for index at pos 1490818606
  6. Detected file format: RealMedia (libavformat)
  7. File tags:
  8. title: ??????-bbs.wujidy.com
  9. author: ??????-bbs.wujidy.com
  10. copyright:
  11. comment:
  12. ASMRuleBook: #($Bandwidth >= 0),Stream0Bandwidth = 64000, Stream1Bandwidth = 1486000;
  13. Audiences: Easy RealMedia Tool




阅读(11737) | 评论(0) | 转发(3) |
给主人留下些什么吧!~~