-
-
Save yeetim/c7f04fb07aa1add271cd256d37180848 to your computer and use it in GitHub Desktop.
ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg功能极其强大,堪比图像处理的ImageMagik。下面是一些常用的命令,记下备用。 | |
1:得到视频信息 | |
ffmpeg -i input.xxx | |
2: 将图像序列转换为视频 | |
ffmpeg -f image2 -i prefix%d.jpg output.xxx | |
3:将视频转换为图像序列 | |
ffmpeg -i input.xxx -r FPS -qscale 1 -vsync 0 $prefix%d.jpg | |
其中FPS为每秒抽多少帧 | |
4:将视频转换为yuv格式 | |
ffmpeg -i input.avi ouput.yuv | |
强制指定像素格式为yuv420p | |
ffmpeg -i input.avi -pix_fmt yuv420p output.yuv | |
5:通过摄像头录制视频(windows) | |
ffmpeg -f vfwcap -r 15 -i 0 output.avi | |
6:播放视频 | |
ffplay input.avi | |
ffplay -s 640×480 input.yuv | |
7:旋转视频90度 | |
ffmpeg -vf ”transpose=1″ -i input.mp4 output.mp4 | |
8:截取音频的中指定时间的一段 | |
ffmpeg -ss starttime -t totalseconds -i inout.mp3 -acodec copy output.mp3 | |
-ss -t都支持hh:mm:ss格式 | |
9:截取视频的中指定时间的一段 | |
ffmpeg -i input.avi -vcodec copy -acodec copy -ss 00:01:10 -t 10 output.avi | |
-ss 开始时间 | |
-t 持续时间 | |
10:视频压缩(转换编码方式) | |
ffmpeg -i input.avi -vcodec libx264 -acodec copy output.avi | |
11:控制输出视频解析度 | |
-s 1920x1080 | |
12:控制输出视频的质量 | |
-crf 18 | |
0质量最高,51质量最差,默认值为23 | |
13:拼接多段视频 | |
ffmpeg -i concat:"input1.avi|input2.avi" -vcodec copy -acodec copy output.avi | |
14:通过rtsp下载视频 | |
ffmpeg -rtsp_transport tcp -i rtsp://admin:[email protected] -an saved.mp4 | |
15:Linux屏幕录制 | |
ffmpeg -f x11grab -r 30 -s 1920x1000 -i $DISPLAY -y output.mkv | |
mencoder也很强大 | |
1.多视频拼接: | |
mencoder -oac copy -ovc copy -idx -o output.avi video1.avi video2.avi | |
如果在视频文件中没有找到索引的话,那么 -idx 选项会要求 mencoder 建立它 | |
-o 选项指定输出文件的名称。最后几个参数为需要合并的几个视频片段 | |
2.定点定帧截图的方法: | |
mplayer -ss START_TIME -noframedrop -nosound -vo jpeg -frames N NAME_OF_VIDEO_FILE | |
-frames后面指定截几帧 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment