Audio and video ffmpeg command picture and video conversion

Take a picture

ffmpeg -i test.mp4 -y -f image2 -ss 00:00:02 -vframes 1 -s 640x360 test.jpg
ffmpeg -i test.mp4 -y -f image2 -ss 00:00:02 -vframes 1 -s 640x360 test.bmp
-i 输入
-y 覆盖
-f 格式
image2 一种格式
-ss 起始值
-vframes 帧 如果大于1 那么 输出加%03d test%03d.jpg 
-s 格式大小size

Convert video to picture (one picture per frame):

ffmpeg -i test.mp4 -t 5 -s 640x360 -r 15 frame%03d.jpg 

Convert pictures to videos:

ffmpeg -f image2 -i frame%03d.jpg -r 25 video.mp4

Generate GIF images from videos

ffmpeg -i test.mp4 -t 5 -r 1 image1.gif
ffmpeg -i test.mp4 -t 5 -r 25 -s 640x360 image2.gif

Convert GIF to video

ffmpeg -f gif -i image2.gif image2.mp4

I recommend a Lingsheng Academy project class. I personally think the teacher taught it well. I would like to share it with you:
Lingsheng Platinum Learning Card (including infrastructure/high-performance storage/golang cloud native/audio and video/Linux kernel)
https://xxetb.xet .tech/s/VsFMs

Guess you like

Origin blog.csdn.net/qq_40135848/article/details/132591129