【FFmpeg】Common command

1.视频拼接

1)多视频拼接

bash 复制代码
创建1.txt
file '1.mp4'
file '2.mp4'
file '3.mp4'
file '4.mp4'

运行

bash 复制代码
ffmpeg -f concat -safe 0 -i "1.txt" -c copy "output6.mp4"

2.音量调节

1)简单调节

bash 复制代码
ffmpeg  -i bg.mp3 -i output6.mp4 -filter_complex "[0:a]volume=0.3[a1];[1:a]volume=1.5[a2];[a2][a1]amix=inputs=2:duration=first" -y BGM.mp4

2)音量归一化

对每个视频进行:

bash 复制代码
ffmpeg -i input1.mp4 -af loudnorm=I=-16:TP=-1.5:LRA=11:measured_I=-22.3:measured_TP=-1.0:measured_LRA=10.5:measured_thresh=-32.0:linear=true:print_format=summary normalized_output1.mp4

最后拼接在一起

3.字幕添加

bash 复制代码
 ffmpeg -y -i output2.mp4 -vf subtitles=2.ass 2.mp4

4.转场

1)Xfade

https://trac.ffmpeg.org/wiki/Xfade

bash 复制代码
ffmpeg -loop 1 -t 5 -i 1.png -loop 1 -t 5 -i 2.png -filter_complex "[0][1]xfade=transition=fade:duration=1:offset=4,format=yuv420p" output.mp4

2)gl-transitions

GL Transitions (gl-transitions.com)

环境配置

bash 复制代码
Xvfb :1 -screen 0 1280x1024x16

export DISPLAY=:99
ffmpeg -i 0.mp4 -i 1.mp4 -filter_complex "gltransition=duration=4:offset=1.5:source=crosswarp.glsl" -y out.mp4

5.生成黑色视频以及字幕ass转GIF

生成黑色视频

bash 复制代码
ffmpeg -f lavfi -i color=c=black:s=720x1280:d=10 -c:v libx264 -tune stillimage -pix_fmt yuv420p output_black.mp4 

ass转gif

bash 复制代码
ffmpeg -i output_black.mp4 -vf "subtitles=1.ass:force_style='Alignment=2',format=rgba" -pix_fmt rgba output.gif -y 

gif烧录到视频中

bash 复制代码
ffmpeg -i DEMO3.mp4 -stream_loop -1 -i output.gif -filter_complex "[1:v]setpts=PTS-STARTPTS+19/TB,colorkey=0x000000:0.3:0.1[v2];[0:v][v2]overlay=0:0:enable='between(t,19,35)':shortest=1" -c:a copy output_with_gif.mp4 -y 
相关推荐
程序员老陆4 天前
WHIP 与 WHEP:WebRTC 直播的标准化入口与出口
ffmpeg·音视频·webrtc·whip·whep
可乐鸡翅yeah_5 天前
混合内容 Mixed‑Content 安全策略,HLS HTTPS 页面加载 HTTP 资源排错实战
运维·ffmpeg·音视频·媒体·m3u8
刘广睿6 天前
视频导出为什么发灰?色彩空间与色彩范围(BT.601/709/2020)的 ffmpeg 转换实战
ffmpeg·音视频·视频处理·色彩空间·素材管理
yivifu6 天前
精选FFmpeg 实用音频视频转换命令集
ffmpeg·音视频转换
风哥2号10 天前
数据库教程FGMT02‑生产环境Linux+Oracle19c安装配置与项目实战
linux·数据库·ffmpeg
Bruce_Liuxiaowei10 天前
录屏片段无损合并:从 ffmpeg concat 原理到 Python 自动化脚本
python·ffmpeg·自动化
工具派12 天前
口播视频怎么自动剪掉冷场?视频静音删除的阈值实测
ffmpeg·音视频·视频
❀͜͡傀儡师12 天前
移动端 360° 商品展示方案:从 20MB 雪碧图到 800KB 丝滑视频
ffmpeg·webgl·sprite
2501_9304724412 天前
深度复盘|数据库迁移实战(上):腾讯云助手解析慢查询日志,定位索引缺失与语法不兼容
数据库·阿里云·ffmpeg·云计算·腾讯云·aws
我就是DaLing呀!12 天前
flutter + ffmpeg_kit_extended_flutter 大视频合并下载
flutter·ffmpeg·音视频