BoxiHuang / EC500

EC500: Building Software
0 stars 0 forks source link

Ffmpeg(format pictures into a video) #3

Closed BoxiHuang closed 6 years ago

BoxiHuang commented 6 years ago

Again, I had troubles here regarding to gathering all the images and format them into a single website. Again, I had troubles here regarding to gathering all the images and format them into a single website. After successfully use twitter API, my next task on my timeline is to figure out how to gather these images and format them into a video. I did a lot of research online about how to use ffmpeg and there are so many lines of code that can help. However, I am very confused how to use these examples and fit into my code

BoxiHuang commented 6 years ago

This issue has been solved after i found out i can simply use "import os" in the beginning of my code and write os.system("ffmpeg -framerate .5 -pattern_type glob -i '.jpg' out.mp4") within my code. These two steps allows me to generate a video as a output. These two steps basically equal to typing "ffmpeg -framerate .5 -pattern_type glob -i '.jpg' out.mp4" in my terminal. And the mechanism of the code basically gather all the files that have .jpg file type and merge into a video. It only looks into .jpg type files. This website also helped me a lot and i think i should give credits to this website. (https://trac.ffmpeg.org/wiki/Slideshow) Within the website, i used the example under Glob pattern section and eliminate the configuration data within that one line of code. (delete anything between jpg and out.mp4. This step should allow you to output a video in the same folder where you store pictures