9

ffmpeg 缩小视频、合并视频

 2 years ago
source link: http://abcdxyzk.github.io/blog/2022/08/07/picture-ffmpeg/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

ffmpeg 缩小视频、合并视频

2022-08-07 19:01:00

https://blog.csdn.net/weixin_45049908/article/details/103962451

使用ffmpeg修改和压缩视频文件格式

更改视频文件格式

/root/ffmpeg-5.0/ffmpeg -y -i test.mp4 out.mp4

压缩视频文件

/root/ffmpeg-5.0/ffmpeg -y -i test.avi -s 400x240 -vcodec libx264 -preset fast -b 80000 -r 25 out.mp4

-y: 当已存在out.mp4是,不提示是否覆盖。
-i : test.avi 输入文件名,可以自己修改路径和名字
-s: 400x240 输出的分辨率,注意片源一定要是16:9的不然会变形
-vcodec -libx264: 输出文件使用的编解码器。
-preset fast: 使用libx264做为编解码器时,需要带上这个参数。
-b: 80000 视频数据流量,用-b xxx表示使用固定码率,数字可更改;还可以用动态码率如:-qscale 4和-qscale 6,4的质量比6高(一般用80000就可以了,否则文件会很大)
-acodec: aac 音频编码用AAC
-ac 2 声道数1或2
-ar: 48000 声音的采样频率
-ab: 128 音频数据流量,一般选择32、64、96、128#-vol 200 200%的音量,可更改(如果源文件声音很小,可以提升10到20倍1000%~2000%)
-r: 25 帧数

下载m3u8文件

/root/ffmpeg-5.0/ffmpeg -i "http://a.com/b.m3u8" out.mp4

合并 mp4

cat ff1
file k4_1.1.1_大数据案例.mp4
file k4_1.1.2_大数据.mp4
file k4_1.1.3_数与数据.mp4
file k4_1.2_数据科学.mp4
file k4_1.3_“思维”辨析.mp4


cat ff.sh
/root/ffmpeg-5.0/ffmpeg -f concat -safe 0 -i ff1 k4_f1.mp4

mp4 转 ts, 合并 ts 为 mp4

/root/ffmpeg-5.0/ffmpeg -i 9.2.mp4 -vcodec copy -acodec copy -vbsf h264_mp4toannexb 9.2.ts

/root/ffmpeg-5.0/ffmpeg -i "concat:1.1.ts|1.2.ts|2.1.ts|2.2.ts|2.3.ts|2.4.ts|3.1.ts|3.2.ts" -acodec copy -vcodec copy -absf aac_adtstoasc oo1.mp4

Posted by kk

2022-08-07 19:01:00tools, picture

« 命令调整图片大小、格式等 Ubuntu 开启 Apache2 HTTP2支持 »

wx_ok.pngali_ok.png


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK