Convert an image to a video-FFMPEG

Source: Internet
Author: User

FFmpeg is a powerful tool that can be used to convert video formats, including video container formats and video encoding formats. The video mentioned here includes video and audio. You can change other video parameters, such as frame rate-Number of frames played per second, and video size-size. You can also convert images into videos.

Converting an image to a video actually uses the built-in video encoding format to encode your image. FFMPEG supports many medium video formats and wants to know which encoding formats FFMPEG supports, you can use the FFMPEG-codecs command to view the information.

Your image can be JPG, BMP, or tiff. You can test other formats by yourself.

Run CMD and CD to the directory where your FFmpeg is located. If you do not have FFMPEG, you can download it through the following link:

<Temporary vacancy, followed by connection>

Now, with this software, we can start generating videos. Assume that your image is under c: \ temp. Then, you can use the following command to convert the images in this directory into videos. The requirement here is that all your images are named by natural numbers, such as 001,002,003. The first few zeros depend on the number of your images. For example, if there are 109 images, 3-1 = 2 zeros, from 001 to 109. If there are 1009 images, they are 0001 to 1009.

FFmpeg-F image2-I c: \ temp \ 10902d.jpg test.mp4

You can specify the encoding format:

FFmpeg-F image2-I c: \ temp \ 10902d.jpg-Vcodec libx264
Test.mp4

You may also want to specify the output frame rate:

FFmpeg-F image2-I c: \ temp \ 10902d.jpg-Vcodec libx264-R 10
Test.mp4

In this example, test.mp4 plays 10 frames per second.

If you want to specify the bit rate:

FFmpeg-F image2-I c: \ temp \ 10902d.jpg-Vcodec libx264-R 10-B 200 K
Test.mp4


Note that the unit of KB is bit/s.

Maybe you have to ask what the parameters of the last generated file look like, for example, the parameters we just set and the parameters we have not set:

This command can help you solve the problem:

FFmpeg-I test.mp4


Refer to what my test.mp4 parameters are:

G: \ Download \ FFMPEG \ ffmpeg-git-a254452-win32-static \ bin> FFMPEG-I test.mp4
FFmpeg version N-32726-ga254452, copyright (c) 2000-2011 the FFMPEG developers
Built on Sep 19 2011 19:49:13 with GCC 4.6.1
Configuration: -- enable-GPL -- enable-version3 -- enable-runtime-cpudetect -- ena
Ble-avisynth -- enable-bzlib -- enable-frei0r -- enable-libopencore-amrnb -- enable-
Libopencore-amrwb -- enable-libfreetype -- enable-libgsm -- enable-libmp3lame -- ena
Ble-libopenjpeg -- enable-librtmp -- enable-libschroedinger -- enable-libspeex -- en
Able-libtheora -- enable-libvo-aacenc -- enable-libvo-amrwbenc -- enable-libvorbis
-- Enable-libvpx -- enable-libx264 -- enable-libxavs -- enable-libxvid -- enable-zlib

Libavutil 51. 16. 1/51. 16. 1
Libavcodec 53. 16. 0/53. 16. 0
Libavformat 53. 12. 0/53. 12. 0
Libavdevice 53. 4. 0/53. 4. 0
Libavfilter 2. 43. 2/2. 43. 2
Libswscale 2. 1. 0/2. 1. 0
Libpostproc 51. 2. 0/51. 2. 0
Input #0, mov, MP4, m4a, 3GP, 3g2, mj2, from 'test.mp4 ':
Metadata:
Major_brand: isom
Minor_version: 512
Compatible_brands: isomiso2avc1mp41
Creation_time: 00:00:00
Encoder: lavf53.12.0
Duration: 00:00:10. 00, start: 0.000000, bitrate: 2540 kb/s
Stream #0.0 (UND): Video: h264 (high) (avc1/0x31637661), yuvj420p, 1280x720
[Sar dar], 2539 kb/s, 10 FPS, 10 TBR, 10 TBN, 20 TBC
Metadata:
Creation_time: 00:00:00
At least one output file must be specified

The preceding figure shows the basic information of FFMPEG:

Including version, Compilation Time, used compiler, and configuration options.

Focus on the green part, which is something you will care about:

Duration indicates the video duration. Here, the video duration is 10 seconds, and the bitrate is the bit rate.

Video: video encoding format. The frame rate is 10 FPS.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.