转换视频
1
2
|
ffmpeg -i input.mp4 output.mp4
ffmpeg -i input.mp4 -c:
v
libx264 -c:a libfaac output.mp4
|
提取音频:
1
|
ffmpeg -i 0.mp4 -id3v2_version 3 out.mp3
|
提取视频:
1
|
ffmpeg -i 0.mp4 -c:
v
libx264 -an output5.mp4
|
把音视频文件合并
1
|
ffmpeg -i out.mp3 -i output5.mp4 -map 0:0 -map 1:0 -c:
v
copy -c:a copy output6.mp4
|
视频中添加文字
1
|
ffmpeg -i output5.mp4 -vf
"drawtext=text='lihuibin':fontfile=/usr/share/fonts/truetype/ttf-indic-fonts-core/utkal.ttf:fontsize=24:fontcolor=red@0.8:x=w-tw-20:y=h-th-20"
-c:
v
libx264 -c:a copy output8.mp4
|
把图片转化成透明
1
|
convert logo.png -channel a -evaluate
set
60% logo1.png
|
给视频打水印
1
|
ffmpeg -i 0.mp4 -i logo.png -filter_complex
'overlay=main_w-overlay_w-20:20'
output11.mp4
|
把视频转变成gif
1
2
3
|
ffmpeg -i 0.mp4 -r 5 tmp/%03d.png
convert -delay 1x5 tmp/*.png output.gif
convert -delay 1x5 tmp/*.png -layers OptimizeTransparency output3.gif
|
截取视频
1
|
ffmpeg -i 0.mp4 -ss 25 -t 15 output.mp4
|
镜面倒影特效
1
|
ffmpeg -i input.mp4 -vf
'split[up][down];[up]pad=iw:ih*2[up];[down]vflip[down];[up][down]overlay=0:h'
output.mp4
|
给视频添加字幕
1
|
ffmpeg -i input.mp4 -i input.srt -c copy output3.mkv
|
input.srt字幕信息
1
2
3
4
5
6
7
8
9
|
1
00:00:00,000 --> 00:00:03,000
大家好,我是宅鸟
2
00:00:05,000 --> 00:00:09,000
我们可以使用<b>ffmpeg</b>,在视频中嵌入字幕
3
00:00:11,000 --> 00:00:15,000
请关注我的微博:<font color="red">http://birdinroom.blog.51cto.com/</font>
|
合并视频文件
1
|
printf
"file '%s'\n"
mp4/*.mp4|ffmpeg -f concat -i - -c copy output012.mp4
|
分割文件
1
|
ffmpeg -i tig.mov -c copy -map 0 -f segment -segment_time 300 parts
/tig_
%d.flv
|
获取视频第一帧截图
1
2
3
|
timeout 3 ffmpeg -i
test
.mp4 -y -f image2 -ss 00:00:00 -vframes 1 -s 320*480
test
.jpg
timeout 3 ffmpeg -ss 00:00:00 -i test_video.ts -vcodec mjpeg -vframes 1 -an -f rawvideo -s 240x480 -y
test
.jpg
|
1
|
ffmpeg -ss 00:10:05 -i gongfuyujia.mp4 -f image2 -vframes 1 -s 1024*960 -y test6.jpg
|
mac下ffmpeg采集摄像头和麦克风 推流到rtmp服务器端
1
2
|
ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -i
"0:0"
-tune zerolatency -vcodec libx264 -preset faster -acodec libmp3lame -ar 44100 -ac 1 -b:
v
3m -b:a 128K -f flv rtmp:
//localhost/rtmpdemo/test1
ffplay
"rtmp://localhost/rtmpdemo/test1 live=1"
|
多ts文件合并成mp4
1
|
ffmpeg -i concat:1.ts|2.ts|3.ts|4.ts|5.ts -bsf:a aac_adtstoasc -c copy -vcodec copy 1.mp4
|
本文转自birdinroom 51CTO博客,原文链接:http://blog.51cto.com/birdinroom/1661088,如需转载请自行联系原作者