使用 FFmpeg 转换视频/音频格式 | 开源 免费 | 不用套壳软件

在我的上篇文章中,只有 不到0.43% 的人点了赞

所以如果觉得做的还行的话可以给我点个赞、收个藏,这对我真的很重要!QWQ


注: FFmpeg 有很多功能,这里只用来转换格式。

前言

emm…

据说最近格式工厂出了点事。

然后… 这分析倒是挺快的
关于BrightData BV19B4y1G7Fs
所以,这里就不再弄这事了,但是在当时找东西时找到了这个…
github:ffmpeg/web/src/shame (FFmpeg官网显示在更新)
FFmpeg Hall of Shame.
这个表里的都是违反 FFmpeg 许可证(即 LGPL or GPL许可证) 的软件。
来看看…

找到了好几个老朋友

  • Baofeng Storm 暴风影音
  • Daum tv PotPlayer (咋PotPlayer也在)
  • Format Factory 格式工厂
  • QQPlayer QQ影音

算了还是别用格式工厂了吧(

FFmpeg 下载&安装

官网
Windows builds by BtbN (Linux也有)

自己用选这个就行。
下载。

全部解压。
反手直接打开SystemPropertiesAdvanced.exe-> 环境变量 -> 用户环境变量 ->Path-> 新建 -> <FFmpeg解压路径>\bin

使用

注:本软件无 GUI , 使用纯命令行。
首先,找个要转格式的视频/音频,这里随便找了个文件比较小的的视频,视频编码器H264音频编码器AAC
首先,最简单的办法:ffmpeg -i <输入文件> <输出文件> 如: ffmpeg -i "InputFile.mp4" "OutputFile.mkv"
输出:

ffmpeg version n5.1.1-3-gfcbd9ec248-20220908 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: .. # 省略了
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'InputFile.mp4':
.. # 太多,省略了
Press [q] to stop, [?] for help
.. # 这咋就这么多呢
Output #0, matroska, to 'OutputFile.mkv':
.. # 离谱
[libx264 @ 000002e128df0780] consecutive B-frames:  0.8%  0.0%  0.2% 99.0%
..
[libx264 @ 000002e128df0780] kb/s:15.27

挺不错的,不是嘛?

编码器

视频编码器

转换方法:ffmpeg -i <输入文件>-c:v <编码器> <输出文件> 如:ffmpeg -i InputFile.mp4 -c:v libx265 OutputFile.mp4

libx264=H264
libx265=H265
libaom-av1=AV1
//这是几个常用的,其他可以自己去找。

运行结果: (省略一堆)

ffmpeg version n5.1.1-3-gfcbd9ec248-20220908 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
..
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'InputFile.mp4':
..
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5+38-20255e6f0
x265 [info]: build info [Windows][GCC 12.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
..
Output #0, mp4, to 'OutputFile.mp4':
..
x265 [info]: frame I:      6, Avg QP:29.00  kb/s: 589.23
x265 [info]: frame P:    464, Avg QP:33.00  kb/s: 26.52
x265 [info]: frame B:    972, Avg QP:35.39  kb/s: 24.44
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 29.4% 7.4% 26.2% 1.1% 36.0%

encoded 1442 frames in 59.70s (24.15 fps), 27.46 kb/s, Avg QP:34.59
[aac @ 0000013f969e04c0] Qavg: 65475.656
音频编码器

参数c:a <编码器> 比如ffmpeg -i InputFile.mp4 c:a libopus OutputFile.mp4

aac=AAC
ac3=AC3
dca=DTS
libvorbis=Vorbis
libopus=Opus
alac=ALAC
//其他可以自己去找。

运行结果:(还是省略一堆)

ffmpeg version n5.1.1-3-gfcbd9ec248-20220908 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: ..
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'InputFile.mp4':
..
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libopus @ 000002afeac22a80] No bit rate set. Defaulting to 96000 bps.
[libx264 @ 000002afeaa43440] using SAR=3/2
[libx264 @ 000002afeaa43440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002afeaa43440] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 000002afeaa43440] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'OutputFile.mp4':
..
frame= 1442 fps= 88 q=-1.0 Lsize=    1036kB time=00:01:00.23 bitrate= 140.9kbits/s speed=3.67x
..
[libx264 @ 000002afeaa43440] kb/s:15.27

音频也基本一样

ffmpeg -i <输入文件> <输出文件> 比如ffmpeg -i InputFile.mp3 OutputFile.mp3
运行效果: (省略一堆)

ffmpeg version n5.1.1-3-gfcbd9ec248-20220908 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: ..
Input #0, mp3, from 'InputFile.mp3':
..
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (mp3float) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'OutputFile.mp3':
..
size=     942kB time=00:01:00.24 bitrate= 128.1kbits/s speed=79.6x
video:0kB audio:942kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.046255%

编码器设置见上面 音频编码器 。
应该差不多了吧qwq
咕咕咕

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值