Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create multiple subclips using times from CSV file #257

Closed
jsmann94 opened this issue Feb 3, 2016 · 0 comments
Closed

Create multiple subclips using times from CSV file #257

jsmann94 opened this issue Feb 3, 2016 · 0 comments

Comments

@jsmann94
Copy link

jsmann94 commented Feb 3, 2016

I am creating a Python script which uses the MoviePy module, to take clips from a larger video and concatenate them together.

The times for the clips are detailed in a CSV file like so;

0,10

11,19

15,20

34,42 etc

What I have done is read the CSV file row by row and then using the subclip method from Moviepy created a clip which is stored in a list of clips, however I get a IndexError - list index out of range.

What could be the issue (the code works fine if I don't use the subclip method with the values from the CSV file)?

This is my code:

`video= VideoFileClip('file')

clipsArray = []

import csv
with open('csv file', 'r') as file:
reader = csv.reader(file)
for row in reader:
startTime = row[0]
endTime = row[1]
clip = fullVideo.subclip(startTime, endTime)
clipsArray.append(clip)`

The error message is:

`File "C:\Anaconda3\envs\py35\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile execfile(filename, namespace)

File "C:\Anaconda3\envs\py35\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 85, in execfile exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

File "C:/spyder2-py3/program.py", line 32, in clip = fullVideo.subclip(start, end) # Create clips for each of the timestamps

File "", line 2, in subclip

File "C:\Anaconda3\envs\py35\lib\site-packages\moviepy\decorators.py", line 86, in wrapper for (arg, name) in zip(a, names)]

File "C:\Anaconda3\envs\py35\lib\site-packages\moviepy\decorators.py", line 86, in for (arg, name) in zip(a, names)]

File "C:\Anaconda3\envs\py35\lib\site-packages\moviepy\tools.py", line 78, in cvsecs finds = re.findall(expr, time)[0]

IndexError: list index out of range`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant