FFmpeg 使用
添加关键帧
被压缩过的视频丢失关键帧导致seekTo无效,需要给视频添加关键帧
ffmpeg -i 2.mp4 -c:v libx264 -x264opts keyint=5 -y keyint10.mp4
修改分辨率
-i /sdcard/bankinfo/-484870439.mp4 -vf scale=1920:1080 -threads 5 -preset ultrafast -y /sdcard/bankinfo/-484870439.resolution.mp4
旋转视频
90
-i /sdcard/bankinfo/-484870439.mp4 -vf transpose=1 -threads 5 -preset ultrafast /sdcard/bankinfo/-484870439.rotate.mp4
180
-i /sdcard/bankinfo/-484870439.mp4 -vf transpose=1,transpose=1 -threads 5 -preset ultrafast /sdcard/bankinfo/-484870439.rotate.mp4
270
-i /sdcard/bankinfo/-484870439.mp4 -vf transpose=2 -threads 5 -preset ultrafast /sdcard/bankinfo/-484870439.rotate.mp4
截取
-i /sdcard/bankinfo/-484870439.mp4 -filter:v crop=1920:780:0:0: -threads 5 -preset ultrafast -strict -2 -c:a copy /sdcard/bankinfo/-484870439.crop.mp4
按时间剪切
建议重新编码,否则无法精确
-i /sdcard/bankinfo/-484870439.mp4 -ss 00:00.000 -to 00:40.000 -threads 5 -preset ultrafast /sdcard/bankinfo/-484870439/-484870439.openmouth.mp4
将视频转换为图片
-i /sdcard/bankinfo/-484870439.mp4 -threads 5 -preset ultrafast /sdcard/bankinfo/-484870439/frame_%05d.png
将图片转换为视频
-i /sdcard/bankinfo/-147259681/temp/frame_%d.png -vcodec mpeg4 -b:v 3000k -threads 5 -preset ultrafast /sdcard/bankinfo/-147259681.reduce.mp4