0

To this question I am referring to the example from http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python/

To be exactly, to these codes I refer.

from moviepy.editor import *

clip = (VideoFileClip("frozen_trailer.mp4")
        .subclip((1,22.65),(1,23.2))
        .resize(0.3))
clip.write_gif("use_your_head.gif")

The code above selects the part between 1’22.65 (1 minute 22.65 seconds) and 1’23.2.

My question: How to define the ending part backwards? How to define the subclip, so it cut e.g. the beginning 1’22.65, and cut the last 3 minute 20.15 seconds?

I have many MP4s with different length, but they have same beginning and ending parts. It will be very convenient.

Thanks!

Rt Rtt
  • 595
  • 2
  • 13
  • 33
  • 1
    The only thing I can think of is getting the length of the video and subtracting a set length from this number with a datetime object. Is there a way to get a length of a movie in your specific library of choice? – mustachioed Dec 23 '17 at 04:42
  • @ateesdalejr Oh! That is a very good idea! Thanks for the hint! I have not thought about that. :-) – Rt Rtt Dec 23 '17 at 04:46
  • not Python, but I have a Bash example of using ffprobe and ffmpeg to do what, I think, you want - https://github.com/Offbeatmammal/VTrim ... same logic can apply to a python script – Offbeatmammal Dec 25 '17 at 22:09

0 Answers0