VideoFileClip is not defined

HI, I’m on 6.2 pro beta.

When i click on thumbnail view on a video clip, the page takes a long time to load

I also have this log in seahub_django_request.log

2017-11-16 18:37:56,283 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /thumbnail/9fffc77a-6201-4fff-a805-26a0b9e3ba5d/create/
Traceback (most recent call last):
  File "/home/cc/seafile/seafile-pro-server-6.2.0/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/cc/seafile/seafile-pro-server-6.2.0/seahub/seahub/auth/decorators.py", line 70, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/cc/seafile/seafile-pro-server-6.2.0/seahub/seahub/thumbnail/views.py", line 57, in thumbnail_create
    success, status_code = generate_thumbnail(request, repo_id, size, path)
  File "/home/cc/seafile/seafile-pro-server-6.2.0/seahub/seahub/thumbnail/utils.py", line 116, in generate_thumbnail
    thumbnail_file, file_size)
  File "/home/cc/seafile/seafile-pro-server-6.2.0/seahub/seahub/thumbnail/utils.py", line 149, in create_video_thumbnails
    clip = VideoFileClip(inner_path)
NameError: global name 'VideoFileClip' is not defined

Regards,

Gautier

I just updated to 6.2.10 and enabled the video thumbnails…same issue here.

Seahub.log shows:

2018-03-31 02:04:36,751 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /thumbnail/2f4e6b32-40ce-4688-a72d-4c7f44819253/create/
Traceback (most recent call last):
  File "/protected-path/haiwen/seafile-pro-server-6.2.10/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/protected-path/haiwen/seafile-pro-server-6.2.10/seahub/seahub/auth/decorators.py", line 70, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/protected-path/haiwen/seafile-pro-server-6.2.10/seahub/seahub/thumbnail/views.py", line 57, in thumbnail_create
    success, status_code = generate_thumbnail(request, repo_id, size, path)
  File "/protected-path/haiwen/seafile-pro-server-6.2.10/seahub/seahub/thumbnail/utils.py", line 116, in generate_thumbnail
    thumbnail_file, file_size)
  File "/protected-path/haiwen/seafile-pro-server-6.2.10/seahub/seahub/thumbnail/utils.py", line 149, in create_video_thumbnails
    clip = VideoFileClip(inner_path)
NameError: global name 'VideoFileClip' is not defined

Being that it’s an unhandled exception, this may be a bug. In this particular case, it seems that a call to a variable name VideoFileClip was not defined globally before using it. It’s a very common programming mistake that I’ve been guilty of myself.

Does that mean the thumnailing of videos is not working at all ? If not, any ideas how to fix ?

Unfortunately, I’m not a Seafile programmer. I could dig into the code and figure it out eventually, and then issue a pull request for a proposed solution. Only problem is, while I know how to read C++ programs and python programs, I’m neither a C programmer or a python programmer. My experience is with C# these days.

This is something that the developers would need to fix, if it is indeed a bug. But, I will look into the code as soon as I can.

Ok… I tracked it down. VIDEOFILECLIP gets defined by an import via moviepy, which uses ffmpeg.

What Linux flavor and version are you using, and on what platform?

I’m using Ubuntu 16.04 LTS on a root server…

Ok… I’ve found a blurb on it from a previous post on Github. Someone with Ubuntu 16.04 had the same exact issue, as well as others on other platforms. Several solutions are detailed here, most commonly involving changing the enable thumbnails option to false. You can read the entire thread here, but the guy with 16.04 has the very last entry on the thread, though some of the other proposed solutions may work for you.

Your version of Ubuntu is also old. You may try upgrading to the latest release. That could also possibly fix the problem.

Thank you, i could solve the problem and the video thumbnails are working as a charm :slight_smile:

There are multiple versions of python installed on this machine. I installed moviepy for python3 instead of python2.7.

2 Likes

@shoeper and @DerDanilo

This one can be marked as solved. I don’t have that capability, but I think one of you two do… right?

I do, but also have to post at least 8 characters.

1 Like