iOS 开发音视频流[1]---FFmpeg
原文地址: http://www.jianshu.com/p/4811f11aed27
本文是自己實際開發過程中遇到的問題。
1、準備
1.1、Xcode
`XCode`提供了Mac平臺開發環境必須的gcc編譯器,要注意的是`XCode` 安裝后并沒有命令行的gcc可用, 還需要打開`XCode`,在某個設置里添加Command Line Tools,`XCode`就會自動下載并安裝好gcc, 同時還有git也被安裝了。1.2、Homebrew
`homebre` 是 Mac 平臺上的一個包管理工具,提供了許多 Mac 下沒有的 Linux工具等, 而且安裝工具極其簡單,一句命令行 gameOver。2、安裝FFmpeg
ffmpeg的官方網站是:http://ffmpeg.org/?
2.1、在終端輸入以下命令行:
zhuyuhui-4:~ zhuyuhui$ brew install ffmpeg Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> New Formulae bchunk elasticsearch@5.6 kibana@5.6 logstash@5.6 ==> Updated Formulae apibuilder-cli grafana mercurial sassc arangodb grakn metricbeat scons azure-cli grpc mighttpd2 shpotify bitrise harfbuzz mosh sonarqube citus heartbeat nickle streamlink commandbox influxdb open-scene-graph supersonic couchdb itstool opencoarrays swift-protobuf cppad jfrog-cli-go opusfile terragrunt crystal-icr kibana paket traefik dbus kotlin pgrouting upscaledb elasticsearch libfaketime planck urh faac libopusenc poco vault faas-cli libphonenumber pqiv xtensor filebeat libtrace protobuf youtube-dl fn lighttpd protobuf-c zbackup folly logstash protobuf-swift zenity git-cinnabar lxc pumba zimg gjstest mariadb@10.1 purescriptError: Your Xcode (8.3.3) is too outdated. Please update to Xcode 9.1 (or delete it). Xcode can be updated from the App Store.zhuyuhui-4:~ zhuyuhui$我的電腦上同時安裝了Xcode8.3.3和Xcode9.0.1[兩個Xcode都安裝在Applications]。出現上述錯誤,找到解決方法如下:
https://stackoverflow.com/questions/40296756/homebrew-saying-xcode-is-outdated
So as @NicolasMiari mentioned in a comment above, the fix to my issue ended up having tohave both Xcode 7 and Xcode 8 on my machine. I went on the apple developer site, downloaded Xcode 8,
saved it to my documents and then used:sudo xcode-select -switch ~/Documents/Xcode.app/ and then ran my brew install which worked as expected. Afterwards I ran:sudo xcode-select -switch /Applications/Xcode.app/ to switch back to Xcode 7.3.1.Hope this helps someone else! and thanks for the suggestions!
?
按照上述方法,先執行
sudo xcode-select -switch /Applications/Xcode9.app/
然后執行下面代碼:
Last login: Thu Nov 16 09:11:31 on console zhuyuhui-4:~ zhuyuhui$ brew install ffmpeg Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> New Formulae bchunk elasticsearch@5.6 kibana@5.6 logstash@5.6 ==> Updated Formulae apibuilder-cli grafana mercurial sassc arangodb grakn metricbeat scons azure-cli grpc mighttpd2 shpotify bitrise harfbuzz mosh sonarqube citus heartbeat nickle streamlink commandbox influxdb open-scene-graph supersonic couchdb itstool opencoarrays swift-protobuf cppad jfrog-cli-go opusfile terragrunt crystal-icr kibana paket traefik dbus kotlin pgrouting upscaledb elasticsearch libfaketime planck urh faac libopusenc poco vault faas-cli libphonenumber pqiv xtensor filebeat libtrace protobuf youtube-dl fn lighttpd protobuf-c zbackup folly logstash protobuf-swift zenity git-cinnabar lxc pumba zimg gjstest mariadb@10.1 purescriptError: Your Xcode (8.3.3) is too outdated. Please update to Xcode 9.1 (or delete it). Xcode can be updated from the App Store.zhuyuhui-4:~ zhuyuhui$ brew install ffmpeg Updating Homebrew... ==> Installing dependencies for ffmpeg: lame, x264, xvid ==> Installing ffmpeg dependency: lame ==> Downloading https://homebrew.bintray.com/bottles/lame-3.99.5.high_sierra.bot ######################################################################## 100.0% ==> Pouring lame-3.99.5.high_sierra.bottle.1.tar.gz ? /usr/local/Cellar/lame/3.99.5: 27 files, 2MB ==> Installing ffmpeg dependency: x264 ==> Downloading https://homebrew.bintray.com/bottles/x264-r2795.high_sierra.bott ######################################################################## 100.0% ==> Pouring x264-r2795.high_sierra.bottle.tar.gz ? /usr/local/Cellar/x264/r2795: 11 files, 3.2MB ==> Installing ffmpeg dependency: xvid ==> Downloading https://homebrew.bintray.com/bottles/xvid-1.3.4.high_sierra.bott ######################################################################## 100.0% ==> Pouring xvid-1.3.4.high_sierra.bottle.tar.gz ? /usr/local/Cellar/xvid/1.3.4: 10 files, 1.2MB ==> Installing ffmpeg ==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.4.high_sierra.bott ######################################################################## 100.0% ==> Pouring ffmpeg-3.4.high_sierra.bottle.tar.gz ? /usr/local/Cellar/ffmpeg/3.4: 248 files, 50.9MB zhuyuhui-4:~ zhuyuhui$緊接著我們執行?
brew info ffmpeg
zhuyuhui-4:~ zhuyuhui$ brew ls ffmpeg node python ssh-copy-id yasm flow nvm python3 watchman gdbm openssl readline x264 lame pcre ruby xvid libyaml pkg-config sqlite xz zhuyuhui-4:~ zhuyuhui$ brew info ffmpeg ffmpeg: stable 3.4 (bottled), HEAD Play, record, convert, and stream audio and video https://ffmpeg.org/ /usr/local/Cellar/ffmpeg/3.4 (248 files, 50.9MB) *Poured from bottle on 2017-11-16 at 10:47:38 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ffmpeg.rb ==> Dependencies Build: nasm ?, pkg-config ?, texi2html ? Recommended: lame ?, x264 ?, xvid ? Optional: chromaprint ?, fdk-aac ?, fontconfig ?, freetype ?, frei0r ?, game-music-emu ?, libass ?, libbluray ?, libbs2b ?, libcaca ?, libgsm ?, libmodplug ?, libsoxr ?, libssh ?, libvidstab ?, libvorbis ?, libvpx ?, opencore-amr ?, openh264 ?, openjpeg ?, openssl ?, opus ?, rtmpdump ?, rubberband ?, sdl2 ?, snappy ?, speex ?, tesseract ?, theora ?, two-lame ?, wavpack ?, webp ?, x265 ?, xz ?, zeromq ?, zimg ? ==> Options --with-chromaprintEnable the Chromaprint audio fingerprinting library --with-fdk-aacEnable the Fraunhofer FDK AAC library --with-fontconfigBuild with fontconfig support --with-freetypeBuild with freetype support --with-frei0rBuild with frei0r support --with-game-music-emuBuild with game-music-emu support --with-libassEnable ASS/SSA subtitle format --with-libblurayBuild with libbluray support --with-libbs2bBuild with libbs2b support --with-libcacaBuild with libcaca support --with-libgsmBuild with libgsm support --with-libmodplugBuild with libmodplug support --with-libsoxrEnable the soxr resample library --with-libsshEnable SFTP protocol via libssh --with-libvidstabEnable vid.stab support for video stabilization --with-libvorbisBuild with libvorbis support --with-libvpxBuild with libvpx support --with-opencore-amrEnable Opencore AMR NR/WB audio format --with-openh264Enable OpenH264 library --with-openjpegEnable JPEG 2000 image format --with-opensslEnable SSL support --with-opusBuild with opus support --with-rtmpdumpEnable RTMP protocol --with-rubberbandEnable rubberband library --with-sdl2Enable FFplay media player --with-snappyEnable Snappy library --with-speexBuild with speex support --with-tesseractEnable the tesseract OCR engine --with-theoraBuild with theora support --with-toolsEnable additional FFmpeg tools --with-two-lameBuild with two-lame support --with-wavpackBuild with wavpack support --with-webpEnable using libwebp to encode WEBP images --with-x265Enable x265 encoder --with-xzEnable decoding of LZMA-compressed TIFF files --with-zeromqEnable using libzeromq to receive commands sent through a libzeromq client --with-zimgEnable z.lib zimg library --without-gplDisable building GPL licensed parts of FFmpeg --without-lameDisable MP3 encoder --without-qtkitDisable deprecated QuickTime framework --without-securetransportDisable use of SecureTransport --without-x264Disable H.264 encoder --without-xvidDisable Xvid MPEG-4 video encoder --HEADInstall HEAD version zhuyuhui-4:~ zhuyuhui$Game Over 安裝完畢。
注意:我們之前執行?sudo xcode-select -switch /Applications/Xcode9.app/ 之后才安裝FFmpeg成功,如果你之后還需要使用Xcode8.3.3,那么最好再執行?sudo xcode-select -switch /Applications/Xcode.app/
下面是我應用程序里Xcode截圖:
?
?
?
轉載于:https://www.cnblogs.com/1-434/p/7843083.html
總結
以上是生活随笔為你收集整理的iOS 开发音视频流[1]---FFmpeg的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [NOIP2017]逛公园 最短路+拓
- 下一篇: 403错误代码导致网站样式全部乱了