pasaico
pasaico

Reputation: 61

Ffmpeg SCRIPT: image sequence conversion to tiff

I have a problem with a simple script in the FOLDER have image sequence in .jpg all jpg files I would like to convert them to tiff

this is my script, but not work fine:

for I in *.jpg; do ffmpeg -start_number 000001 -f image2 -i "$I" -c:v tiff TIFF/"%6d.tif";

when I run the script, ffmpeg for every jpg continually reboots and in the output directory I have only one tif converted.

how I do not restart for each jpg ffmpeg?

thank you

Upvotes: 0

Views: 1316

Answers (1)

beroe
beroe

Reputation: 12316

In ffmpeg, the start number generally refers to your input images, not the output image. FFMPEG will also take *.jpg as input using the glob option (check the docs rather than looping through yourself and calling it 1000 times.

Currently, your script will generate the same tiff file for each of the different jpegs that you are calling, because you are just re-calling it with the same parameters.

You could try putting $I.tif at the end instead of "%6d.tif";

for I in *.jpg; do
    ffmpeg -i "$I"  -c:v tiff TIFF/${I%%.jpg}.tif
done

This part ${I%%.jpg} takes your original file name and strips off the .jpg

In Imagemagick you can simply do:

convert *.jpg tiff

Upvotes: 2

Related Questions