Cut a movie second by second with ffmpeg

on

My friend Noe Rodriguez wanted to make a social experiment. We would take an old mexican movie and cut it second by second and then post it to Twitter. I found it interesting so we divided the workload, I made the bot while he got the frames. This is the resulting code and experiences. You can look at the experiment here @RisaNvacaciones. If you want to know how to make a simple twitter bot with python go here.

Install ffmpeg

First we need to download ffmpeg. We have the option to download either Static or Shared. The main difference is that the Static version takes a determined number of RAM to work with while the Shared version gets the RAM dynamically given by the system. Also Static build results in one big library, that contains all functions from FFmpeg package. Shared build results in a few libraries (and these libraries may depend on other non-FFmpeg libraries), each library exports different functions.
For our system we used the Shared version.

After we have downloaded and extracted ffmpeg make a new file inside called ffmpeg.py the folder and add the following code.

Then add your movie file inside the ffmpeg folder aswell. Then change the movieFile inside your ffmpeg.py file to the name or your movie file. (You can also add the full dir to your file if you know how to).

To run script you just have to run


python ffmpeg.py

And that should be all you need to cut a movie second by second with ffmpeg. If you have any question leave it in the comments.