
Recherche avancée
Autres articles (70)
-
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community. -
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (7158)
-
lavc/encode : shorten code by using a local variable
6 juillet 2023, par Anton Khirnov -
avformat/flvdec : stop shadowing local variables
20 mai 2024, par Timo Rothenpieler -
Making a movie out of pictures in correct order
6 novembre 2022, par astrogabShort version


How can one combine files
img1000.png
,img5000.png
,img10000.png
,img11000.png
in the right order into a movie ?

Longer version


I am using ffmpeg to make a movie out of snapshots of a simulation. There should be for instance 5 images per second. The names are :


image0200.png
image0300.png
image0400.png
image0500.png
image1000.png
image1500.png
image2000.png
...
image8500.png
image9000.png
image9500.png
image10000.png
image15000.png



i.e., they are sequential but there are irregular gaps in the numbers. The numbers are formatted according to
'%04d'
but go above 9999. I have tried

ffmpeg -y -loglevel debug -nostats \
-r:v 5 -thread_queue_size 1024 -f image2 \
-pattern_type glob -i "*[0-9][0-9][0-9][0-9].png" \
-r:v 30 -preset veryslow -pix_fmt yuv420p -crf 28 \
-an AMDG.mp4



and many, many other variations but either only two frames end up being visible in the movie (even though the images are found when using -debug) or only the files up to
image9500.png
are used (andglob
does not seem to allow[0-9]{4,}
as for regex), or, with

ffmpeg -y -loglevel debug -nostats \
 -r:v 5 \
 -thread_queue_size 1024 -f image2 -pattern_type glob \
 -i "image[0-9][0-9][0-9][0-9].png" \
 -r:v 5 \
 -thread_queue_size 1024 -f image2 -pattern_type glob \
 -i "image[1-9][0-9][0-9][0-9][0-9].png" \
 -r:v 30 -preset veryslow -pix_fmt yuv420p -crf 28 \
 -map 0 -map 1 \
 -an AMDG.mp4



there are apparently two streams in the output movie and only one of them is being played. (I realised in the process
-map 0 -map 1
was needed in order for both input streams to be used.)

In one of the variations of options I found (now I have lost what it was exactly !) all images were included but the order was not the desired one :
image1000.png
was shown beforeimage10000.png
. Apparently a newer version of ffmpeg (I haveffmpeg version 3.4.8-0ubuntu0.2
) has the ability to sort likesort -V
, so thatimage10000
come afterimage1000
, but reinstalling ffmpeg is in general not a practical option. Also renaming the files is not practical and creating e.g. soft links with sequential names in the format '%05d' starting at 0 and in steps of 1 (so that-i '%05d'
could be used) is of course not elegant.

With the
-concat
filter as in https://unix.stackexchange.com/questions/77016/ffmpeg-pattern-type-glob-not-loading-files-in-correct-order, i.e.,

ffmpeg -y -loglevel debug -nostats -r:v 5 \
 -thread_queue_size 1024 -f image2 -f concat \
 -safe 0 -i <(find . -maxdepth 1 -regex 'image*.png' \
 -exec echo "file $(pwd)/"{} \; | sort -V) \
 -r:v 30 -codec:v libx264 -preset veryslow -pix_fmt yuv420p -crf 28 \
 -an \
 AMDG.mp4



the processing took a long time and made the whole system sluggish, while producing a movie of 60 kB showing only two different images.


I have the impression that there are several issues at once... Thanks if you can help !