网站首页 > 开源技术 正文
FFmpeg 是一个用于处理多媒体文件的开源工具集合。FFmpeg 包含一组共享的多媒体库,例如 libavcodec、libavutil 和 libavformat。允许你转换视频和音频文件、执行流和调整视频文件的大小。 |
如何安装FFmpeg
本文介绍如何在Centos8中安装ffmpeg,FFmpeg 在默认的CentOS 8 源仓库中没有提供,可以从第三方软件源中安装:
[root@localhost ~]# rpm -ivh https://mirrors.ustc.edu.cn/rpmfusion/free/el/rpmfusion-free-release-8.noarch.rpm
[root@localhost ~]# yum config-manager --enable PowerTools
[root@localhost ~]# yum -y install SDL2
[root@localhost ~]# yum -y install ffmpeg
安装完成之后可以查看一下ffmpeg的版本:
[root@localhost ~]# ffmpeg -version
[root@localhost ~]# ffmpeg -version
ffmpeg version 4.2.4 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsrt --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
FFmpeg基本用法
转换多媒体文件时,选择正确的编解码器、容器和格式可能非常具有挑战性。但是,使用 FFmpeg,可以坚持默认设置并期待出色的结果。要使用默认 FFmpeg 设置转换文件,请使用以下命令:
[root@localhost ~]# ffmpeg -i video.mp4 out_video.mp4
可以看到下图中,输出的视频变小了许多:
上面的命令会将文件从指定格式转换为输出格式。但是,要有效地压缩文件,我们需要使用编解码器、比特率、容器和 fps。
如何使用 FFmpeg 减少视频大小
没有通用的方法来减小视频文件的大小,因为各种文件类型的创建并不相同。在本教程中,我们将使用 x265 编解码器。x265 编解码器,它是一个免费的库,用于视频编码为 H.254/MPEG-H HEVC 的压缩格式。
CRF使用 0 到 51 之间的数字。恒定速率因子(CRF)是 x264 和 x265 编码的默认质量设置。值越高,压缩率越高,值越高这可能会导致质量损失。
下面我们将一个274M的视频文件进行压缩:
[root@localhost ~]# ffmpeg -i video.mp4 -vcodec libx265 -crf 25 compress_video.mp4
总结
虽然使用自定义压缩选项可以产生很好的结果,但在某些情况下使用默认的 FFmpeg 选项可能会更好。
- 上一篇: 一个C文件实现的http服务器
- 下一篇: 从零开始学习DPDK:掌握这些常用库函数就够了
猜你喜欢
- 2025-03-08 正妹漫画家织织「被目击遭前任PUA」 网秒认出:真是辛苦了!
- 2025-03-08 浅谈linux下进程最大数、最大线程数、进程打开的文件数
- 2025-03-08 工艺管道常用英文缩写 英汉对照
- 2025-03-08 Python之psutil库简介
- 2025-03-08 Astro 2.x助力:Sharp终于宣布支持 WebAssembly!
- 2025-03-08 手把手教你使用ffmpeg及nginx实现直播、点播、安防监控
- 2025-03-08 音视频开发-ffmpeg指令(2)
- 2025-03-08 从零开始学习DPDK:掌握这些常用库函数就够了
- 2025-03-08 一个C文件实现的http服务器
- 2025-03-08 VLC 时隔9个月发布 3.0.17
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- jdk (81)
- putty (66)
- rufus (78)
- 内网穿透 (89)
- okhttp (70)
- powertoys (74)
- windowsterminal (81)
- netcat (65)
- ghostscript (65)
- veracrypt (65)
- asp.netcore (70)
- wrk (67)
- aspose.words (80)
- itk (80)
- ajaxfileupload.js (66)
- sqlhelper (67)
- express.js (67)
- phpmailer (67)
- xjar (70)
- redisclient (78)
- wakeonlan (66)
- tinygo (85)
- startbbs (72)
- webftp (82)
- vsvim (79)
本文暂时没有评论,来添加一个吧(●'◡'●)