FFMPEG Mac版本编译
Mac下FFMPEG使用
There are a few ways to get FFmpeg on OS X.
- One is to build it yourself. Compiling on Mac OS X is as easy as any other
*nix machine, there are just a few caveats(警告). The general procedure is get the source, then./configure <flags>; make && sudo make install, though specific configure flags are possible. - Another is to use some “build helper” tool, to install it for you. For example, homebrew or macports, see the homebrew section in this document.
- Alternatively, if you are unable to compile, or do not want to install homebrew, you can simply download a static build for OS X, but it may not contain the features you want. Typically this involves unzipping an FFmpeg distribution file
[like .zip file], then running it from within the newly extracted files/directories.
手动编译FFMPEG
1.下载FFMPEG源码
使用git clone https://github.com/FFmpeg/FFmpeg从github下载ffmpeg源码,切换到要使用的目标分支(这里使用release/3.3):git checkout -b r3.3 origin/release/3.3,或者直接从github下载分支release/3.3的压缩包,解压.
2.准备Xcode
Starting with Lion 10.7, Xcode is available for free from the Mac App Store and is required to compile anything on your Mac. Make sure you install the Command Line Tools from Preferences > Downloads > Components. Older versions are still available with an AppleID and free Developer account at developer.apple.com.
3.准备HomeBrew工具
To get ffmpeg for OS X, you first have to install Homebrew. If you don’t want to use Homebrew, see the section below.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then:
brew install automake fdk-aac git lame libass libtool libvorbis libvpx \
opus sdl shtool texi2html theora wget x264 x265 xvid yasm
Mac OS X Lion comes with Freetype already installed (older versions may need ‘X11’ selected during installation), but in an atypical location: /usr/X11. Running freetype-config in Terminal can give the locations of the individual folders, like headers, and libraries, so be prepared to add lines like CFLAGS=freetype-config --cflags LDFLAGS=freetype-config --libs PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig before ./configure or add them to your $HOME/.profile file.
4.编译
Once you have compiled all of the codecs/libraries you want, you can now download the FFmpeg source either with Git or the from release tarball links on the website. Study the output of ./configure --help and make sure you’ve enabled all the features you want, remembering that --enable-nonfree and --enable-gpl will be necessary for some of the dependencies above. A sample command is:
git clone http://source.ffmpeg.org/git/ffmpeg.git ffmpeg
cd ffmpeg
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libass \
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame \
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid
make && sudo make install
--prefix指定编译完成后安装路径,这里指定到/usr/local/ffmpeg,安装完成会在/usr/local/ffmpeg下生成:bin,include,lib,share四个目录
安装环境介绍
A package consists of several related files which are installed in several directories. The configure step usually allows the user to specify the so-called install prefix, and is usually specified through the configure option configure --prefix=PREFIX, where PREFIX usually is by default /usr/local. The prefix specifies the common directory where all the components are installed.
The following directories are usually involved in the installation:
PREFIX/bin: contains the generated binaries (e.g. ffmpeg, ffplay, ffprobe etc. in the case of FFmpeg)PREFIX/include: contains the library headers (e.g. libavutil/avstring.h, libavcodec/avcodec.h, libavformat/avformat.h etc. in case of FFmpeg) required to compile applications linked against the package librariesPREFIX/lib: contains the generated libraries (e.g. libavutil, libavcodec, libavformat etc. in the case of FFmpeg)PREFIX/share: contains various system-independent components; especially documentation files and examples
By specifying the prefix it is possible to define the installation layout.
By using a shared prefix like /usr/local/, different packages will be installed in the same directory, so in general it will be more difficult to revert the installation.
Using a prefix like /opt/PROJECT/, the project will be installed in a dedicated directory, and to remove from the system you can simply remove the /opt/PREFIX path. On the other hand, such installation will require to edit all the environment variables to point to the custom path.
Environment variables
Several variables defined in the environment affect your package install. In particular, depending on your installation prefix, you may need to update some of these variables in order to make sure that the installed components can be found by the system tools.
The list of environment variables can be shown through the command env.
A list of the affected variables follows:
- PATH: defines the list of :-separated paths where the system looks for binaries. For example if you install your package in /usr/local/, you should update the PATH so that it will contain /usr/local/bin. This can be done for example through the command export PATH=/usr/local/bin:$PATH.
- LD_LIBRARY_PATH: contains the :-separated paths where the system looks for libraries. For example if you install your package in /usr/local/, you should update the LD_LIBRARY_PATH so that it will contain /usr/local/lib. This can be done for example through the command export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH. This variable is sometimes deprecated in favor of the use of ldconfig.
- CFLAGS: contains flags used by the C compiler, and usually includes preprocessing directives like -IPREFIX/include or compilation flags. Custom CFLAGS are usually prefixed to the source package compiler flags by the source package build system. Alternatively many build systems allow to specify the configure option -extra-cflags.
- LDFLAGS: these are directives used by the linker, and usually include linking directives like -LPREFIX/lib needed to find libraries installed in custom paths. Custom LDFLAGS are usually prefixed to the source package linker flags by the source package build system. Alternatively, many build systems allow to specify the configure option -extra-ldflags.
- PKG_CONFIG_PATH: contains the :-separated paths used by pkg-config to detect the pkg-config files used by many build systems to detect the custom CFLAGS/LDFLAGS used by a specific library.
In case you installed a package in a non standard path, you need to update these environment libraries so that system tools will be able to detect the package components. This is especially required when running a configure script for a package relying on other installed libraries/headers/tools.
Environment variables are usually defined in the profile file, for example .profile defined in the user directory for sh/bash users, and in /etc/profile. This file can be edited to permanently set the custom environment. Alternatively, the variables can be set in a script or in a particular shell session.
Remember to export the variables to the child process, e.g. using the export command. Read the fine documentation of your shell for more detailed information.
MAC下的动态链接库
扩展名
Windows下.DLL,Linux下.so,Mac OS X下的扩展名是.dylib。
.dylib是Mach-O格式,也就是Mac OS X下的二进制文件格式。Mac OS X提供了一系列
工具,用于创建和访问动态链接库。
- 编译器/usr/bin/cc,也就是gcc了,Apple改过的。这个主要还是一个壳,去调用其他
的一些部件。当然同时还有/usr/bin/c++,等等。 - 汇编器/usr/bin/as
- 链接器/usr/bin/ld
MAC下创建动态链接库步骤:
- 首先是生成module文件,也就是.o文件。这跟一般的unix没什么区别。例如
cc -c a.c b.c,就得到a.o和b.o - 可以用ld来合并.o文件,比如
ld -r -o c.o a.o b.o - 然后可以用libtool来创建动态链接库:
libtool -dynamic -o c.dylib a.o b.o.( 这里也可以用libtool -static -o c.a a.o b.o就创建静态库)
如果用gcc直接编译,我记得linux下一般是可以:
gcc -shared -o c.so a.c b.c
而在Mac OS X下需要:
gcc -dynamiclib -o c.dylib a.c b.c
动态链接库的工具
nm是最常用的,这个用法跟linux下差不多:nm c.dylib,可以看到导出符号表,等等。
另一个常用的工具是otool,这个是Mac OS X独有的。比如想看看c.dylib的依赖关系otool -L c.dylib
官网方法
- CompilationGuide-Generic
- CompilationGuide-MacOSX
编译ffmpeg3.3结果没有ffplay
因为系统没有sdl环境或sdl版本不匹配,ffmpeg3.3需要sdl2
http://www.libsdl.org/download-2.0.php 下载Source Code SDL2-2.0.5.zip - GPG signed,解压缩,执行命令:
./configure
make
sudo make install
进行编译
相关文章:
FFMPEG Mac版本编译
Mac下FFMPEG使用 There are a few ways to get FFmpeg on OS X. One is to build it yourself. Compiling on Mac OS X is as easy as any other *nix machine, there are just a few caveats(警告). The general procedure is get the source, then ./configure <flags&g…...
Reactive Programing与“响应式”
将Reactive Programing翻译为“响应式编程”,的确不好理解。什么是Reactive?Reactive被翻译为“反应”,其英文原意是“事物对变化信号的回应、反应”。我热了,空调自动开,这就是空调对我的Reaction,我和空调…...
Pinterest:从 Druid 到 StarRocks,实现 6 倍成本效益比提升
导读: 开源无国界,StarRocks 自开源以来,近3年的时间里已在全球数据技术领域崭露头角。我们欣喜地发现,越来越多的海外用户正在使用并积极推广着 StarRocks。为了促进知识共享,StarRocks中文社区将精选优秀文章与大家共…...
代码+视频,R语言VRPM绘制多种模型的彩色列线图
列线图,又称诺莫图(Nomogram),它是建立在回归分析的基础上,使用多个临床指标或者生物属性,然后采用带有分数高低的线段,从而达到设置的目的:基于多个变量的值预测一定的临床结局或者…...
Python 设计模式之工厂函数模式
文章目录 案例基本案例逐渐复杂的案例 问题回顾什么是工厂模式?为什么会用到工厂函数模式?工厂函数模式和抽象工厂模式有什么关系? 工厂函数模式是一种创建型设计模式,抛出问题: 什么是工厂函数模式?为什么…...
数据赋能(171)——开发:数据挖掘——概述、关注焦点
概述 数据挖掘是从大量的数据中,提取隐藏在其中的、事先不知道的、但潜在有用的信息的过程。 数据挖掘是数据分析过程中的一个核心环节。 数据挖掘的主要目的是从大量数据中自动发现隐藏的模式、关联和趋势,以揭示数据的潜在价值。数据挖掘技术可以帮…...
L1 - OpenCompass 评测 InternLM-1.8B 实践
基础任务(完成此任务即完成闯关) 使用 OpenCompass 评测 internlm2-chat-1.8b 模型在 ceval 数据集上的性能,记录复现过程并截图。 按照教程中的顺序安装包有问题,网上找了解决方案,按一下顺序能正常执行 使用OpenCo…...
JS【详解】数据类型检测(含获取任意数据的数据类型的函数封装、typeof、检测是否为 null、检测是否为数组、检测是否为非数组/函数的对象)
【函数封装】获取任意数据的数据类型 /*** 获取任意数据的数据类型** param x 变量* returns 返回变量的类型名称(小写字母)*/ function getType(x) {// 获取目标数据的私有属性 [[Class]] 的值const originType Object.prototype.toString.call(x); //…...
OpenCV图像滤波(10)Laplacian函数的使用
操作系统:ubuntu22.04 OpenCV版本:OpenCV4.9 IDE:Visual Studio Code 编程语言:C11 功能描述 计算图像的拉普拉斯值。 该函数通过使用 Sobel 运算符计算出的 x 和 y 的二阶导数之和来计算源图像的拉普拉斯值: dst Δ src ∂…...
docker系列11:Dockerfile入门
传送门 docker系列1:docker安装 docker系列2:阿里云镜像加速器 docker系列3:docker镜像基本命令 docker系列4:docker容器基本命令 docker系列5:docker安装nginx docker系列6:docker安装redis docker系…...
LVS(Linux virual server)详解
目录 一、LVS(Linux virual server)是什么? 二、集群和分布式简介 2.1、集群Cluster 2.2、分布式 2.3、集群和分布式 三、LVS运行原理 3.1、LVS基本概念 3.2、LVS集群的类型 3.2.1 nat模式 3.2.2 DR模式 3.2.3、LVS工作模式总结 …...
Session共享方法
在Web开发中,会话(Session)管理是跟踪用户与服务器之间交互的一种常见方法。Session 共享通常指的是在一个应用集群或多个应用服务之间保持用户的会话状态一致。这在负载均衡、微服务架构或者分布式系统中尤为重要 一、基于SQL的session管理…...
Ubuntu 22.04 Docker安装笔记
1、准备一台虚机 可以根据《VMware Workstation安装Ubuntu 22.04笔记》来准备虚拟机。完成后,根据需求安装必要的软件,并设置root权限进行登录。 sudo apt update sudo apt install iputils-ping -y sudo apt install vim -y允许root ssh登录࿱…...
编程-设计模式 6:适配器模式
设计模式 6:适配器模式 定义与目的 定义:适配器模式将一个类的接口转换成客户希望的另一个接口。适配器模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。目的:该模式的主要目的是解决接口不匹配的问题,使得一个…...
ERC721 概念解释
目录 FeaturesVotesAccess ControlUpgradeabilityFeatures Mintable: 允许创建新的代币(minting)。合约的所有者或有权限的账户可以调用 mint 函数来生成新的代币,并将其分配给指定的地址。 Auto Increment Ids:自动递增 ID。每次创建新的代币时,代币的 ID 会自动递增,确保…...
数据结构(其五)--串
目录 12.串 12.1 基本操作 12.2 串的存储结构 12.3 字符串的模式匹配算法 (1).朴素模式匹配算法 (2).KMP算法 i.next[]数组的求解 ii.next[]数组的优化——nextval数组 iii.手算nextval数组 iiii.机算nextval数组 + KMP函数 12.串 串,即字符串(string),由零个或多…...
LeetCode Hot100 LRU缓存
请你设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。 实现 LRUCache 类: LRUCache(int capacity) 以 正整数 作为容量 capacity 初始化 LRU 缓存int get(int key) 如果关键字 key 存在于缓存中,则返回关键字的值,否则返回 -…...
GESP C++ 2024年06月一级真题卷
一、单选题(每题 2 分,共 30 分) 第 1 题 在 C 中,下列不可做变量的是 ( ) 。 A. five-Star B. five_star C. fiveStar D. _fiveStar 答案:A 解析:标识符命名规则,标识符由字母、数…...
在 Ubuntu Server 上配置静态 IP 地址
在 Ubuntu Server 上配置静态 IP 地址 测试时使用的Ubuntu server版本是22.04 一、Ubuntu 17.10之前版本 使用 ifupdown 配置文件来设置静态 IP。配置文件通常位于 /etc/network/interfaces。 1.1 编辑 /etc/network/interfaces 文件: sudo vim /etc/network/in…...
数据结构——栈的讲解(超详细)
前言: 小编已经在前面讲完了链表和顺序表的内容,下面我们继续乘胜追击,开始另一个数据结构:栈的详解,下面跟上小编的脚步,开启今天的学习之路! 目录 1.栈的概念和结构 1.1.栈的概念 1.2.栈的结构…...
PyTorch 2.8镜像实战落地:教育机构AI教学平台(图文+视频+LLM)集成方案
PyTorch 2.8镜像实战落地:教育机构AI教学平台(图文视频LLM)集成方案 1. 教育AI平台的技术挑战与解决方案 现代教育机构在构建AI教学平台时面临三大技术难题:多模态内容生成、算力资源管理和教学场景适配。PyTorch 2.8深度学习镜…...
终极指南:3步打造你的闲鱼AI客服机器人,实现24小时自动化值守
终极指南:3步打造你的闲鱼AI客服机器人,实现24小时自动化值守 【免费下载链接】XianyuAutoAgent 智能闲鱼客服机器人系统:专为闲鱼平台打造的AI值守解决方案,实现闲鱼平台724小时自动化值守,支持多专家协同决策、智能议…...
Qwen3.5-9B惊艳效果:上传物理实验图→识别仪器→生成操作步骤视频脚本
Qwen3.5-9B惊艳效果:上传物理实验图→识别仪器→生成操作步骤视频脚本 1. 模型能力概览 Qwen3.5-9B是一款拥有90亿参数的开源大语言模型,在多模态理解和逻辑推理方面表现出色。这个模型最令人惊艳的能力在于它能够: 准确识别实验仪器&…...
3大核心功能解放明日方舟玩家双手:MAA自动化助手全攻略
3大核心功能解放明日方舟玩家双手:MAA自动化助手全攻略 【免费下载链接】MaaAssistantArknights 《明日方舟》小助手,全日常一键长草!| A one-click tool for the daily tasks of Arknights, supporting all clients. 项目地址: https://gi…...
三轴桁架机械手上下料控制系统详细说明书
三轴桁架机械手上下料用西门子smart200 S 020三轴桁架机械手上下料用西门子smart200 ST40 脉冲控制3轴伺服可上西门子触摸屏详细注释,控制系统详细说明书,文档详细讲解组态和指令,I0表,电气原理图G一、概述本说明书旨在详细介绍三…...
Phi-3-mini-4k-instruct-gguf代码实例:Python requests调用Web API完整示例
Phi-3-mini-4k-instruct-gguf代码实例:Python requests调用Web API完整示例 1. 模型简介 Phi-3-mini-4k-instruct-gguf是微软Phi-3系列中的轻量级文本生成模型GGUF版本,特别适合问答、文本改写、摘要整理和简短创作等场景。这个经过优化的版本可以直接…...
数据主权时代,企业即时通讯厂商选型推荐
BeeWorks作为企业级私有化 IM,主打安全可控、深度协同、信创适配,在政企、军工、金融等强合规场景口碑突出。BeeWorks 定位为安全专属数字化协作平台,核心是私有化部署 全链路安全 业务深度融合,区别于通用 SaaS IM。1. 核心架构…...
LoRA训练助手GPU显存优化:Qwen3-32B INT4量化后仅需9.2GB显存稳定运行
LoRA训练助手GPU显存优化:Qwen3-32B INT4量化后仅需9.2GB显存稳定运行 1. 引言:当大模型遇见显存焦虑 如果你尝试过在个人电脑上运行大语言模型,大概率会遇到一个令人头疼的问题:显存不足。特别是像Qwen3-32B这样拥有320亿参数的…...
Fish-Speech 1.5效果展示:双自回归Transformer架构,语音质量惊艳
Fish-Speech 1.5效果展示:双自回归Transformer架构,语音质量惊艳 你听过那种一听就知道是机器人的AI语音吗?生硬、刻板,每个字都像从模板里抠出来的,毫无生气。再听听这个:“今天天气真好,适合…...
深入浅出MIPI D-PHY:对比HS高速模式与LP低功耗模式,揭秘手机摄像头省电又流畅的底层原理
解密MIPI D-PHY:手机摄像头如何实现高速与低功耗的完美平衡 当你用手机拍摄4K视频时,是否想过为什么画面如此流畅,而电量消耗却相对可控?这背后隐藏着一项关键技术——MIPI D-PHY物理层协议。作为现代移动设备图像传输的核心通道&…...
