ffmpeg realizes picture to video and video to picture

Introduction: Because of the needs of network planning, today I will talk about how to use ffmpeg to convert pictures to videos and videos to pictures.

1. Download ffmpeg

You can see the following three .exe files under the bin file of ffmpeg

2. Create a bat file to quickly open the command line

You can create a new folder .txt-> enter cmd in the .txt file and save it-> change the .txt suffix to .bat

You can take a look at the effect after opening the .bat file

3. Record a video yourself and put it in the bin directory

4. Convert video to picture

Open the .bat file -> enter

ffmpeg -i GGGabc.mp4 -t 5 -s 1080x1080 -r 15 %3d.jpg    

Among them -i GGGabc.mp4 means calling the GGGabc.mp4 video in the bin directory

-t 5 means select the first five seconds of the video to convert video to image

-s 1080x1080 indicates the pixel of the picture after the video is converted to the picture

-r 15 means to capture 15 pictures per second, that is, 15 frames

%3d.jpg indicates that the naming format of the generated image will be named after 001.jpg, 002.jpg....

Run the screenshot:

Screenshot of the running result:

5. Convert picture to video

Also first open .bat->enter

ffmpeg -r 15 -i %3d.jpg video.avi

-r 15 means 15 pictures per second, that is, fifteen frames per second

-i %3d.jpg means to select the naming format of the picture, which is to call 001.jpg, 002.jpg... and other pictures to form a video

video.avi is the name of the last video

Run the screenshot:

Screenshot of the running result:

 

Original text ffmpeg realizes picture to video and video to picture - know almost 

 

★The business card at the end of the article can receive audio and video development learning materials for free, including (FFmpeg, webRTC, rtmp, hls, rtsp, ffplay, srs) and audio and video learning roadmaps, etc.

see below!

 

Guess you like

Origin blog.csdn.net/yinshipin007/article/details/132340333