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

"list index out of range" error or Arch Linux x86-64 #3

Closed
smikims opened this issue Jan 25, 2014 · 10 comments
Closed

"list index out of range" error or Arch Linux x86-64 #3

smikims opened this issue Jan 25, 2014 · 10 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@smikims
Copy link

smikims commented Jan 25, 2014

When the interline parameter of TextClip is not specified or is above about -19 (the specific number seems to depend on font and font size), I get this error:

Traceback (most recent call last):
File "movie3.py", line 18, in
font='Courier').
File "/usr/lib/python2.7/site-packages/moviepy/video/VideoClip.py", line 842, in init
ImageClip.init(self, tempfile, transparent=transparent)
File "/usr/lib/python2.7/site-packages/moviepy/video/VideoClip.py", line 651, in init
img = ffmpeg_reader.read_image(img,with_mask=transparent)
File "/usr/lib/python2.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 152, in read_image
vf = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
File "/usr/lib/python2.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 17, in init
self.load_infos(print_infos)
File "/usr/lib/python2.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 55, in load_infos
line = [l for l in lines if ' Video: ' in l][0]
IndexError: list index out of range

@Zulko
Copy link
Owner

Zulko commented Jan 25, 2014

Could you please post one example which works and one that doesn't ? I can't reproduce the bug (but maybe someone else can) and I can't imagine where it comes from. The only logical explanation is that ImageMagick cannot do some interline for some fonts and doesn't produce a picture at all (do you have a temporary image file in your directory after running the script ? Something like TEMP_MPY....png ?)

@smikims
Copy link
Author

smikims commented Jan 25, 2014

Here's one that produces bad overlapping text:

text = TextClip("In my nightmares\nI see rabbits.",
                fontsize=20, color='white',
                font='Courier', interline=-16).\
            set_pos((20,190)).\
            set_duration(olaf.duration)

And here's the one that produced the error message above:

text = TextClip("In my nightmares\nI see rabbits.",
                fontsize=20, color='white',
                font='Courier').\
            set_pos((20,190)).\
            set_duration(olaf.duration)

And yes, there is a temp.png in the current working directory, which contains the text with correct spacing in the middle of the image and everything else is transparent.

@Zulko
Copy link
Owner

Zulko commented Jan 25, 2014

Ok. could you please in this folder type this in a terminal and tell me what it prints ?

ffmpeg -i temp.png

thanks for your patience :)

@smikims
Copy link
Author

smikims commented Jan 25, 2014

Here you go:

ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 15 2014 20:51:13 with gcc 4.8.2 (GCC) 20131219 (prerelease)
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[png @ 0xae9ae0] unsupported bit depth 16 and color type 4
[image2 @ 0xae9040] decoding for stream 0 failed
[image2 @ 0xae9040] Could not find codec parameters for stream 0 (Video: png, 193x35): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
temp.png: could not find codec parameters

@Zulko
Copy link
Owner

Zulko commented Jan 25, 2014

Ok, apparently your ffmpeg does not like the output of your ImageMagick, so I would say that this is not really a MoviePy issue. Are your ffmpeg and your ImageMagick recent ? If not I would suggest to first download a recent ffmpeg binary to replace the former (or put it in a different folder, see moviepy docs), and see if it works.

An alternative explanation would be that for some reason ImageMagick decides to output a grey-level picture. This could be fixed, but I don't think it is the issue.

@smikims
Copy link
Author

smikims commented Jan 25, 2014

I already had the latest, but just to make sure I got the latest static build from the ffmpeg website and the results were the same.

@jackMort
Copy link

try change this line: https://github.com/Zulko/moviepy/blob/master/moviepy/video/VideoClip.py#L832
to:

        "-type",  "truecolormatte", "PNG32:%s" % tempfile]

@Zulko
Copy link
Owner

Zulko commented Jan 31, 2014

Smikims, do you confirm that it solves the problem ?

@dbrgn
Copy link

dbrgn commented Feb 1, 2014

I'm having the same problems (also on ArchLinux), and the fix by @jackMort helps.

@Zulko
Copy link
Owner

Zulko commented Feb 1, 2014

Ok, I commited the change on Github and PyPI, thanks all, thanks jackMort. I am closing the issue for now.

@Zulko Zulko closed this as completed Feb 1, 2014
mbeacom pushed a commit that referenced this issue Feb 15, 2017
pull most recent from Zulko/moviepy
ghost pushed a commit that referenced this issue Feb 23, 2017
tburrows13 pushed a commit that referenced this issue Mar 2, 2017
* Changed the `col` paramater of `ColorClip` to `color` and added a DeprecationWarning if the users tries to use `col`

* Update VideoFileClip.py

* Added warnings

* Update (#3)

* Fixed copy-paste typo

Changed documentation for the color parameter to distinguish from bg_color

* Fixed missing list

(using python 3)

* fixed module hierarchy for Trajectory

* fixed addy

* small recipe

* on_color function docstring has wrong parameter

The docstring for the on_color method has a parameter of bg_color but
the function uses color as the parameter.

* Update README.rst

Changed Code Block to use Python Syntax Highlighting

* fix deprecation message

currently, the docstring is nonsense. 

```
The function ``concatenate_videoclips`` is deprecated and is kept temporarily for backwards compatibility.
Please use the new name, ``concatenate_videoclips``, instead.
```

* ImageSequenceClip: Check for fps and durations rather than fps and duration

* Add a test case.

* Add another test

* ensures int arguments to np.reshape; closes #383

* fix issue #401

*  fix issue #335

* Update maintainer section in README

* make concatenate_videoclips Python 3 compatible..  fix issue #313

* Increment release version

* CompositeVideoClip doesn't accept an argument of transparent

* move PY3 variable to compat.py

* fix movie => moviepy typo

* fix issue #341

* Fixed typo #375

#375 fixed

* fix issue #357, which makes real problem more obvious (media file does not exist

* Revert "small recipe (mirroring a video)"

* Fixed indentation

* .gitignore ignore Mac-specific files, Jetbrains settings dir

* README.rst make mention of Gitter, add PyPI and Gitter badge

* README.rst wording, formatting

* README.rst structure link targets, add co-maintainers (with @username)

* README.rst move maintainers, contributing sections; change docs x-reference name

* README.rst fix grammar

* fix issue 145.  raise Exception when concatenate method != chain or compose

* make PEP8 compatible

* fix PR #413 . (issue #357)

* create test for issue #145

* add tests/media to .gitignore

* fix Issue #385 ,  no DirectoryClip class (#434)

* fix issue #385 , no DirectoryClip class

* replace DirectoryClip with ImageSequenceClip

* fix issue 417, unicode has no attribute 'shape' error.

* add test for issue 417

* add test for issue 417

* Fixed resize documentation issue #319 (#346)

* Handle bytes when listing fonts in VideoClip.py (#306)

Handle bytes when listing fonts in VideoClip.py

* add test for PR306

* add test for PR306 (#440)

* create test file for pull requests (#433)

* Test issue 407 (video has a valid fps after concatenate function) (#443)

* Move PR test to test_PR.py file (#444)

* move PR test from test_issues.py to test_PR.py

* add code to download python_logo.png

* remove duplicate test_issue_417 function

* add testing with travis-ci (#447)

added testing via travis-ci

* put DEVNULL into compat.py (#432)

* add travis-ci badge to readme file

* pick highest fps when concatenating (#416)

* readers.py cast chunksize from float to int

* choose highest fps of clips when concatenating

* pick highest fps when concatenating

* pick highest fps when concatenating

* fps either max or none

* remove resolve markers

removed resolve markers such as HEAD, etc so that the file will compile correctly.
Remove some double blank lines, etc

* update concatenate.py; add c.fps is not None

* add test for issue 416

* fix test_issue_416

* Update Gloin (#4)

* Fixed copy-paste typo

Changed documentation for the color parameter to distinguish from bg_color

* Fixed missing list

(using python 3)

* fixed module hierarchy for Trajectory

* fixed addy

* small recipe

* on_color function docstring has wrong parameter

The docstring for the on_color method has a parameter of bg_color but
the function uses color as the parameter.

* Update README.rst

Changed Code Block to use Python Syntax Highlighting

* fix deprecation message

currently, the docstring is nonsense. 

```
The function ``concatenate_videoclips`` is deprecated and is kept temporarily for backwards compatibility.
Please use the new name, ``concatenate_videoclips``, instead.
```

* ImageSequenceClip: Check for fps and durations rather than fps and duration

* Add a test case.

* Add another test

* ensures int arguments to np.reshape; closes #383

* fix issue #401

*  fix issue #335

* Update maintainer section in README

* make concatenate_videoclips Python 3 compatible..  fix issue #313

* Increment release version

* CompositeVideoClip doesn't accept an argument of transparent

* move PY3 variable to compat.py

* fix movie => moviepy typo

* fix issue #341

* Fixed typo #375

#375 fixed

* fix issue #357, which makes real problem more obvious (media file does not exist

* Revert "small recipe (mirroring a video)"

* Fixed indentation

* .gitignore ignore Mac-specific files, Jetbrains settings dir

* README.rst make mention of Gitter, add PyPI and Gitter badge

* README.rst wording, formatting

* README.rst structure link targets, add co-maintainers (with @username)

* README.rst move maintainers, contributing sections; change docs x-reference name

* README.rst fix grammar

* fix issue 145.  raise Exception when concatenate method != chain or compose

* make PEP8 compatible

* fix PR #413 . (issue #357)

* create test for issue #145

* add tests/media to .gitignore

* fix Issue #385 ,  no DirectoryClip class (#434)

* fix issue #385 , no DirectoryClip class

* replace DirectoryClip with ImageSequenceClip

* fix issue 417, unicode has no attribute 'shape' error.

* add test for issue 417

* add test for issue 417

* Fixed resize documentation issue #319 (#346)

* Handle bytes when listing fonts in VideoClip.py (#306)

Handle bytes when listing fonts in VideoClip.py

* add test for PR306

* add test for PR306 (#440)

* create test file for pull requests (#433)

* Test issue 407 (video has a valid fps after concatenate function) (#443)

* Move PR test to test_PR.py file (#444)

* move PR test from test_issues.py to test_PR.py

* add code to download python_logo.png

* remove duplicate test_issue_417 function

* add testing with travis-ci (#447)

added testing via travis-ci

* put DEVNULL into compat.py (#432)

* add travis-ci badge to readme file

* pick highest fps when concatenating (#416)

* readers.py cast chunksize from float to int

* choose highest fps of clips when concatenating

* pick highest fps when concatenating

* pick highest fps when concatenating

* fps either max or none

* remove resolve markers

removed resolve markers such as HEAD, etc so that the file will compile correctly.
Remove some double blank lines, etc

* update concatenate.py; add c.fps is not None

* add test for issue 416

* fix test_issue_416

* Update VideoFileClip.py

* Added test

* Added return for PEP 8 compliance

* Change
tburrows13 pushed a commit that referenced this issue Mar 6, 2017
* Fixed copy-paste typo

Changed documentation for the color parameter to distinguish from bg_color

* Fixed missing list

(using python 3)

* fixed module hierarchy for Trajectory

* fixed addy

* small recipe

* on_color function docstring has wrong parameter

The docstring for the on_color method has a parameter of bg_color but
the function uses color as the parameter.

* Update README.rst

Changed Code Block to use Python Syntax Highlighting

* fix deprecation message

currently, the docstring is nonsense. 

```
The function ``concatenate_videoclips`` is deprecated and is kept temporarily for backwards compatibility.
Please use the new name, ``concatenate_videoclips``, instead.
```

* ImageSequenceClip: Check for fps and durations rather than fps and duration

* Add a test case.

* Add another test

* ensures int arguments to np.reshape; closes #383

* fix issue #401

*  fix issue #335

* Update maintainer section in README

* make concatenate_videoclips Python 3 compatible..  fix issue #313

* Increment release version

* CompositeVideoClip doesn't accept an argument of transparent

* move PY3 variable to compat.py

* fix movie => moviepy typo

* fix issue #341

* Fixed typo #375

#375 fixed

* fix issue #357, which makes real problem more obvious (media file does not exist

* Revert "small recipe (mirroring a video)"

* Fixed indentation

* .gitignore ignore Mac-specific files, Jetbrains settings dir

* README.rst make mention of Gitter, add PyPI and Gitter badge

* README.rst wording, formatting

* README.rst structure link targets, add co-maintainers (with @username)

* README.rst move maintainers, contributing sections; change docs x-reference name

* README.rst fix grammar

* fix issue 145.  raise Exception when concatenate method != chain or compose

* make PEP8 compatible

* fix PR #413 . (issue #357)

* create test for issue #145

* add tests/media to .gitignore

* fix Issue #385 ,  no DirectoryClip class (#434)

* fix issue #385 , no DirectoryClip class

* replace DirectoryClip with ImageSequenceClip

* fix issue 417, unicode has no attribute 'shape' error.

* add test for issue 417

* add test for issue 417

* Fixed resize documentation issue #319 (#346)

* Handle bytes when listing fonts in VideoClip.py (#306)

Handle bytes when listing fonts in VideoClip.py

* add test for PR306

* add test for PR306 (#440)

* create test file for pull requests (#433)

* Test issue 407 (video has a valid fps after concatenate function) (#443)

* Move PR test to test_PR.py file (#444)

* move PR test from test_issues.py to test_PR.py

* add code to download python_logo.png

* remove duplicate test_issue_417 function

* add testing with travis-ci (#447)

added testing via travis-ci

* put DEVNULL into compat.py (#432)

* add travis-ci badge to readme file

* pick highest fps when concatenating (#416)

* readers.py cast chunksize from float to int

* choose highest fps of clips when concatenating

* pick highest fps when concatenating

* pick highest fps when concatenating

* fps either max or none

* remove resolve markers

removed resolve markers such as HEAD, etc so that the file will compile correctly.
Remove some double blank lines, etc

* update concatenate.py; add c.fps is not None

* add test for issue 416

* fix test_issue_416
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

4 participants