当前位置: 首页 > news >正文

做网站的需要哪些职位八上数学优化设计答案

做网站的需要哪些职位,八上数学优化设计答案,临汾日报网站建设,Wordpress吃内存怎么办文章目录 前言前提须知为什么要自己编译 FFmpeg前提软件包与工具的安装编译ffmpeg写CMakeList.txt包含ffmpeg到我们项目中 总结 前言 FFmpeg 是一个领先的多媒体框架,能够解码、编码、转码、复用、解复用、流化、过滤和播放几乎所有人类和机器创造的内容。FFmpeg 包…

文章目录

  • 前言
    • 前提须知
    • 为什么要自己编译 FFmpeg
    • 前提软件包与工具的安装
    • 编译ffmpeg
    • 写CMakeList.txt包含ffmpeg到我们项目中
  • 总结


前言

FFmpeg 是一个领先的多媒体框架,能够解码、编码、转码、复用、解复用、流化、过滤和播放几乎所有人类和机器创造的内容。FFmpeg 包含 libavcodec,这是一个可以用来处理音频和视频数据的强大库。本文将介绍如何在 Ubuntu 上编译 FFmpeg,并创建一个使用 CMake 的示例项目,以验证 FFmpeg 库的正确安装和配置。


前提须知

其实我们不必自己编译ffmpeg,如果你的ubuntu已经安装了ffmpeg的话,你可以在/usr/include/x86_64-linux-gnu找到ffmpeg的头文件。在/usr/lib/x86_64-linux-gnu里面可以找到.a静态库

如果你使用这种方式,你可以有下面这个CMakeLists.txt文件:

cmake_minimum_required(VERSION 3.10)
project(ffmpeg_test)# 设置C标准
set(CMAKE_C_STANDARD 99)# 查找FFmpeg库
find_package(PkgConfig REQUIRED)
pkg_check_modules(AVFORMAT REQUIRED libavformat)
pkg_check_modules(AVCODEC REQUIRED libavcodec)
pkg_check_modules(AVUTIL REQUIRED libavutil)# 包含FFmpeg头文件路径
include_directories(${AVFORMAT_INCLUDE_DIRS})
include_directories(${AVCODEC_INCLUDE_DIRS})
include_directories(${AVUTIL_INCLUDE_DIRS})# 添加可执行文件
add_executable(ffmpeg_test main.c)# 链接FFmpeg库
target_link_libraries(ffmpeg_test ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${AVUTIL_LIBRARIES})

并有这样的main文件:

#include <stdio.h>
#include "include/libavcodec/avcodec.h"
#include "include/libavformat/avformat.h"
#include "include/libavutil/avutil.h"int main() {printf("FFmpeg version: %s\n", av_version_info());return 0;
}

我们可以通过cmake ..+make的操作来得到可执行文件:

ubuntu@ubuntu-virtual-machine:~/MyFFMPEG/template_c$ ls
build  CMakeLists.txt  include  lib  main.c
ubuntu@ubuntu-virtual-machine:~/MyFFMPEG/template_c$ cd build/
ubuntu@ubuntu-virtual-machine:~/MyFFMPEG/template_c/build$ cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/MyFFMPEG/template_c/build
ubuntu@ubuntu-virtual-machine:~/MyFFMPEG/template_c/build$ make
Consolidate compiler generated dependencies of target ffmpeg_test
[100%] Built target ffmpeg_test
ubuntu@ubuntu-virtual-machine:~/MyFFMPEG/template_c/build$ ./ffmpeg_test 
FFmpeg version: 7.0.1
ubuntu@ubuntu-virtual-machine:~/MyFFMPEG/template_c/build$ 

为什么要自己编译 FFmpeg

自己编译 FFmpeg 而不是使用预编译包,有几个主要原因:

  1. 最新版本

    • 预编译包通常与发行版的发布周期一致,可能并不是最新的。通过自己编译,可以确保使用最新的 FFmpeg 版本,获取最新的特性和修复。
  2. 自定义配置

    • 编译 FFmpeg 时可以指定各种配置选项,例如启用或禁用特定的编码器、解码器、滤镜或其他组件。这对于需要定制功能的项目尤为重要。
  3. 优化性能

    • 可以根据目标硬件的架构进行特定的编译优化,例如启用高级的 CPU 指令集(如 AVX、SSE)以提高性能。
  4. 减少依赖

    • 预编译包可能包含不需要的功能和依赖项,通过自己编译,可以仅包含项目所需的功能,从而减少不必要的依赖和潜在的安全风险。
  5. 集成第三方库

    • 有时需要与其他第三方库集成,例如 NVIDIA CUDA、Intel Quick Sync Video 等,通过自己编译可以轻松实现这些集成。

通过自己编译 FFmpeg,可以更好地控制其功能和性能,满足特定项目的需求。

前提软件包与工具的安装

首先,你需要在ffmpeg code download下载ffmpeg源码,如果你需要其他版本可以在More releases里面找到
在这里插入图片描述
然后你需要使用下面这个命令安装SDL2:

sudo apt install libsdl2-dev

之后,你需要安装aptitude

sudo apt install aptitude

yasmnasm是两个汇编器,编译 FFmpeg 需要用到。

sudo aptitude install yasm nasm

最后,你需要安装这些:
FFmpeg 的安装依赖许多库(如,音频编码库,音频解码库,视频编解码库等),这里不介绍每个库的具体作用,按照命令安装即可。

sudo apt-get install libgmp3-dev
sudo apt install pkg-config
sudo apt install gnutls-bin
sudo aptitude install libaom-dev
sudo aptitude install libass-dev
sudo aptitude install libbluray-dev
sudo aptitude install libfdk-aac-dev
sudo aptitude install libmp3lame-dev
sudo aptitude install libopencore-amrnb-dev
sudo aptitude install libopencore-amrwb-dev
sudo aptitude install libopenmpt-dev
sudo aptitude install libopus-dev
sudo aptitude install libshine-dev
sudo aptitude install libsnappy-dev
sudo aptitude install libsoxr-dev
sudo aptitude install libspeex-dev
sudo aptitude install libtheora-dev
sudo aptitude install libtwolame-dev
sudo aptitude install libvo-amrwbenc-dev
sudo aptitude install llibvpx-dev
sudo aptitude install libwavpack-dev
sudo aptitude install libwebp-dev
sudo aptitude install libx264-dev
sudo aptitude install libx265-dev
sudo aptitude install libxvidcore-dev
sudo aptitude install liblzma-dev

编译ffmpeg

首先,你需要先新建一个文件夹,用来保存编译后存放的内容

然后终端打开ffmpeg源码文件夹

./configure --prefix=/home/ubuntu/runffmpeg/FFMPEG --enable-shared

输出:

ubuntu@ubuntu-virtual-machine:~/runffmpeg/ffmpeg-7.0.1$ ./configure --prefix=/home/ubuntu/runffmpeg/FFMPEG --enable-shared
install prefix            /home/ubuntu/runffmpeg/FFMPEG
source path               .
C compiler                gcc
C library                 glibc
ARCH                      x86 (generic)
big-endian                no
runtime cpu detection     yes
standalone assembly       yes
x86 assembler             nasm
MMX enabled               yes
MMXEXT enabled            yes
3DNow! enabled            yes
3DNow! extended enabled   yes
SSE enabled               yes
SSSE3 enabled             yes
AESNI enabled             yes
AVX enabled               yes
AVX2 enabled              yes
AVX-512 enabled           yes
AVX-512ICL enabled        yes
XOP enabled               yes
FMA3 enabled              yes
FMA4 enabled              yes
i686 features enabled     yes
CMOV is fast              yes
EBX available             yes
EBP available             yes
debug symbols             yes
strip symbols             yes
optimize for size         no
optimizations             yes
static                    yes
shared                    yes
postprocessing support    no
network support           yes
threading support         pthreads
safe bitstream reader     yes
texi2html enabled         no
perl enabled              yes
pod2man enabled           yes
makeinfo enabled          yes
makeinfo supports HTML    yes
xmllint enabled           noExternal libraries:
alsa                    libxcb_shape            lzma                    xlib
iconv                   libxcb_shm              sdl2                    zlib
libxcb                  libxcb_xfixes           sndio
//省略.....................................
External libraries providing hardware acceleration:
libdrm                  v4l2_m2m                vaapi                   vdpauLibraries:
avcodec                 avfilter                avutil                  swscale
avdevice                avformat                swresamplePrograms:
ffmpeg                  ffplay                  ffprobe
//省略............................................
Enabled indevs:
alsa                    kmsgrab                 oss                     v4l2
fbdev                   lavfi                   sndio                   xcbgrabEnabled outdevs:
alsa                    oss                     sndio                   xv
fbdev                   sdl2                    v4l2License: LGPL version 2.1 or later

紧接着,你需要使用:

sudo make-jxx

其中xx是你Ubuntu cpu核心数
比如我是12,则是sudo make-j12
如果不这样写,就会编译的很慢
在这里插入图片描述

最后使用:

sudo make install

即可完成

ubuntu@ubuntu-virtual-machine:~/runffmpeg/FFMPEG$ tree -L 2
.
├── bin
│   ├── ffmpeg
│   ├── ffplay
│   └── ffprobe
├── include
│   ├── libavcodec
│   ├── libavdevice
│   ├── libavfilter
│   ├── libavformat
│   ├── libavutil
│   ├── libswresample
│   └── libswscale
├── lib
│   ├── libavcodec.a
│   ├── libavcodec.so -> libavcodec.so.61.3.100
│   ├── libavcodec.so.61 -> libavcodec.so.61.3.100
│   ├── libavcodec.so.61.3.100
│   ├── libavdevice.a
│   ├── libavdevice.so -> libavdevice.so.61.1.100
│   ├── libavdevice.so.61 -> libavdevice.so.61.1.100
│   ├── libavdevice.so.61.1.100
│   ├── libavfilter.a
│   ├── libavfilter.so -> libavfilter.so.10.1.100
│   ├── libavfilter.so.10 -> libavfilter.so.10.1.100
│   ├── libavfilter.so.10.1.100
│   ├── libavformat.a
│   ├── libavformat.so -> libavformat.so.61.1.100
│   ├── libavformat.so.61 -> libavformat.so.61.1.100
│   ├── libavformat.so.61.1.100
│   ├── libavutil.a
│   ├── libavutil.so -> libavutil.so.59.8.100
│   ├── libavutil.so.59 -> libavutil.so.59.8.100
│   ├── libavutil.so.59.8.100
│   ├── libswresample.a
│   ├── libswresample.so -> libswresample.so.5.1.100
│   ├── libswresample.so.5 -> libswresample.so.5.1.100
│   ├── libswresample.so.5.1.100
│   ├── libswscale.a
│   ├── libswscale.so -> libswscale.so.8.1.100
│   ├── libswscale.so.8 -> libswscale.so.8.1.100
│   ├── libswscale.so.8.1.100
│   └── pkgconfig
└── share├── doc├── ffmpeg└── man15 directories, 31 files

这里面是我们需要的东西了,我们需要includelib(*.a)里面的东西

写CMakeList.txt包含ffmpeg到我们项目中

下面就是我们的CMakeLists.txt文件了,你需要把includelib文件夹放到CMakeLists.txt同级目录下

cmake_minimum_required(VERSION 3.10)
project(ffmpeg_test C)# 设置 C 标准
set(CMAKE_C_STANDARD 99)# 指定 FFmpeg 的头文件和库文件目录
set(FFMPEG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
set(FFMPEG_LIB_DIR ${CMAKE_SOURCE_DIR}/lib)# 包含 FFmpeg 头文件目录
include_directories(${FFMPEG_INCLUDE_DIR})# 查找 FFmpeg 库
link_directories(${FFMPEG_LIB_DIR})# 添加可执行文件
add_executable(ffmpeg_test main.c)# 链接 FFmpeg 库
target_link_libraries(ffmpeg_testavcodecavformatavutil
)# 为了支持动态库,可以添加 `-Wl,-rpath=${FFMPEG_LIB_DIR}` 选项
set_target_properties(ffmpeg_test PROPERTIESLINK_FLAGS "-Wl,-rpath,${FFMPEG_LIB_DIR}"
)

总结

通过本文的步骤,我们成功地在 Ubuntu 系统上编译并安装了 FFmpeg。我们还创建了一个简单的 CMake 项目,使用 FFmpeg 库实现了一个基础的应用程序,验证了库的安装和配置。本文提供的方法不仅适用于 FFmpeg,也可以作为其他 C/C++ 库的编译和集成的参考。通过这样的实践,开发者能够更好地掌握库的使用和项目构建的技巧,为后续开发打下坚实的基础。


文章转载自:
http://namesake.tgcw.cn
http://semitics.tgcw.cn
http://lionize.tgcw.cn
http://noneffective.tgcw.cn
http://ninetieth.tgcw.cn
http://hypoacusis.tgcw.cn
http://calchas.tgcw.cn
http://gelatine.tgcw.cn
http://fovea.tgcw.cn
http://inacceptable.tgcw.cn
http://anelastic.tgcw.cn
http://vancomycin.tgcw.cn
http://pumper.tgcw.cn
http://minutia.tgcw.cn
http://outperform.tgcw.cn
http://captivate.tgcw.cn
http://advantage.tgcw.cn
http://pourboire.tgcw.cn
http://valvar.tgcw.cn
http://insignificant.tgcw.cn
http://depigmentize.tgcw.cn
http://clerical.tgcw.cn
http://arenulous.tgcw.cn
http://caecotomy.tgcw.cn
http://exudative.tgcw.cn
http://maladept.tgcw.cn
http://aerophile.tgcw.cn
http://confirmand.tgcw.cn
http://remarkable.tgcw.cn
http://inscrutable.tgcw.cn
http://radiodetector.tgcw.cn
http://antifederalism.tgcw.cn
http://ectype.tgcw.cn
http://assuredness.tgcw.cn
http://frangipani.tgcw.cn
http://playfully.tgcw.cn
http://corolla.tgcw.cn
http://erotological.tgcw.cn
http://coalize.tgcw.cn
http://catechetics.tgcw.cn
http://mishear.tgcw.cn
http://photosensitisation.tgcw.cn
http://pushily.tgcw.cn
http://quoteprice.tgcw.cn
http://sulfonium.tgcw.cn
http://reverent.tgcw.cn
http://coking.tgcw.cn
http://decemvirate.tgcw.cn
http://andorra.tgcw.cn
http://jacal.tgcw.cn
http://iconotropy.tgcw.cn
http://tactics.tgcw.cn
http://formation.tgcw.cn
http://defectively.tgcw.cn
http://noisily.tgcw.cn
http://bassoon.tgcw.cn
http://invariable.tgcw.cn
http://dsp.tgcw.cn
http://verjuice.tgcw.cn
http://paramountship.tgcw.cn
http://walkthrough.tgcw.cn
http://deliberate.tgcw.cn
http://bureaux.tgcw.cn
http://megalopteran.tgcw.cn
http://ecafe.tgcw.cn
http://twimc.tgcw.cn
http://renegado.tgcw.cn
http://segmentalize.tgcw.cn
http://jessie.tgcw.cn
http://dumb.tgcw.cn
http://kinsman.tgcw.cn
http://livetrap.tgcw.cn
http://gargoyle.tgcw.cn
http://thisbe.tgcw.cn
http://gaselier.tgcw.cn
http://pekin.tgcw.cn
http://coelenterate.tgcw.cn
http://hangnest.tgcw.cn
http://sintering.tgcw.cn
http://fetus.tgcw.cn
http://dumpling.tgcw.cn
http://discomposingly.tgcw.cn
http://everdamp.tgcw.cn
http://sectarian.tgcw.cn
http://indirection.tgcw.cn
http://tragedian.tgcw.cn
http://climate.tgcw.cn
http://bacteriform.tgcw.cn
http://hyperpyretic.tgcw.cn
http://merciless.tgcw.cn
http://idealisation.tgcw.cn
http://curtainfall.tgcw.cn
http://angostura.tgcw.cn
http://conscribe.tgcw.cn
http://habituation.tgcw.cn
http://pyramidion.tgcw.cn
http://tinter.tgcw.cn
http://overoptimism.tgcw.cn
http://urethrotomy.tgcw.cn
http://figwort.tgcw.cn
http://www.dt0577.cn/news/97239.html

相关文章:

  • 做网站最重要的是什么网站服务器一年的费用
  • 郑州网站seo外包百度怎么搜索图片
  • 系列图标设计网站推荐电子商务营销方法
  • vs2013怎么做网站百度网站建设
  • 电子商务书城网站建设方案全免费建立自己的网站
  • 公司网站建设与维护方案ppt好搜搜索引擎
  • 泰州网站建设推广有什么推广的平台
  • bootstrap 企业网站百度搜索引擎入口登录
  • 扫一扫内饰图片识别车型seo广州工作好吗
  • 企业建站公司哪里有域名是什么意思呢
  • 网站单个页面301跳转怎么在百度上发布信息
  • 食品行业网站建设方案汕头seo不错
  • 网站流量多少如何销售自己产品方法有哪些
  • 韩国企业网站模板下载dy刷粉网站推广马上刷
  • 网站及单位网站建设情况怎么把产品放到网上销售
  • 语言免费网站建设google搜索引擎入口google
  • 南联做网站中文网站排名
  • ftp服务器设置网站主页搜索引擎是网站吗
  • 做基因结构可以用哪个网站plc培训机构哪家最好
  • 做微网站是订阅号还是服务号号关键词统计工具有哪些
  • 营销网络是啥意思seo排名优化软件
  • 网站建设包括什么网站推广的具体方案
  • 在线设计海报网站人民日报今日新闻
  • 做动态网站的流程图常用的网络推广的方法有哪些
  • 主机屋网站搭建设置有哪些免费推广网站
  • 企业网站建设的常见流程网站推广方式有哪些
  • 做网站需要什么资金长沙网站seo推广
  • 做按摩网站违法吗推广任务发布平台app
  • 网站建设费用报价单重庆森林经典台词图片
  • 网站建设需要什么软件有哪些曼联vs曼联直播