毕设需要对图片和视频进行格式转换与部分处理,将过程中用到的ffmpeg库部分整理如下:
以下命令行为例进行参数的讲解(在终端执行):
ffmpeg -y -i "1.mp4" -r 1 -q:v 2 -ss 00:00:26 -t 00:00:02 -s 1920*1080 -f image2 %d.jpg image_path
ffmpeg -i input.flv output.mp4
input.flv --> the name and the format of the input. Note don't use the absolute path of the file, just use the file name.
output.mp4 --> the output video's name and format.
ffmpeg -threads2 -y -r 10 -i /tmpdir/image%04d.jpg -i audio.mp3 -absf aac_adtstoasc output.mp4
-threads 2 --> run 2 processes at the same time.
-y --> overwrite the output file.
-r 10 --> set the fps. '10' means 10 images showed 1 second in the video.
ffmpeg -loop 1 -f image2 -i /tmpdir/image%04d.jpg -vcodec libx264 -r 10 -t 10 test.mp4
Wait further :https://blog.csdn.net/wangshuainan/article/details/77914508