convert all the png files in a folder to video

7,745

Option 1: Rename

  1. First rename all of the inputs so they have zero-padding (001.png...450.png).

  2. Then run ffmpeg:

    ffmpeg -framerate 25 -i %03d.png output.avi
    

    or

    ffmpeg -framerate 25 -pattern_type glob -i "*.png" output.avi
    

Option 2: Sort

Use a more complicated command to sort the files and then pipe to ffmpeg:

cat $(find . -maxdepth 1 -name "*.png" | sort -V) | ffmpeg -framerate 25 -i - output.avi
Share:
7,745

Related videos on Youtube

Mona Jalal
Author by

Mona Jalal

contact me at [email protected] I am a 5th-year computer science Ph.D. Candidate at Boston University advised by Professor Vijaya Kolachalama in computer vision as the area of study. Currently, I am working on my proposal exam and thesis on the use of efficient computer vision and deep learning for cancer detection in H&E stained digital pathology images.

Updated on September 18, 2022

Comments

  • Mona Jalal
    Mona Jalal over 1 year

    I have ~450 frames named 1...450. However, there are some missing frames for example frame 10, 30, and so on do not exists.

    I want to create an AVI video in the same order as 1...450.png. How should I do that?

    • schrodingerscatcuriosity
      schrodingerscatcuriosity over 4 years
      Check this
  • Mona Jalal
    Mona Jalal over 4 years
    if I use sort, I don't need to use zero-padding right?
  • llogan
    llogan over 4 years
    @MonaJalal Yes. You can run find . -maxdepth 1 -name "*.png" | sort -V and it will show you the order that will be given to ffmpeg.