seafile icon indicating copy to clipboard operation
seafile copied to clipboard

Video thumbnail feature broken

Open mumpitzstuff opened this issue 5 years ago • 4 comments

New moviepy versions can not be used for video thumbnails. The latest working version is 0.2.3.4. 0.2.3.5 will produce a lot of error entries in seahub.log.

2019-03-07 23:26:30,627 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /thumbnail/c6072f86-aa46-4$Traceback (most recent call last):
  File "/home/seafile/seafile-server-6.3.4/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/handlers/base.py", line 132, i$    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-6.3.4/seahub/seahub/auth/decorators.py", line 70, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/seafile/seafile-server-6.3.4/seahub/seahub/thumbnail/views.py", line 56, in thumbnail_create
    success, status_code = generate_thumbnail(request, repo_id, size, path)
  File "/home/seafile/seafile-server-6.3.4/seahub/seahub/thumbnail/utils.py", line 116, in generate_thumbnail
    thumbnail_file, file_size)
  File "/home/seafile/seafile-server-6.3.4/seahub/seahub/thumbnail/utils.py", line 149, in create_video_thumbnails
    clip = VideoFileClip(inner_path)
  File "/usr/local/lib/python2.7/dist-packages/moviepy/video/io/VideoFileClip.py", line 91, in __init__
    fps_source=fps_source)
  File "/usr/local/lib/python2.7/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 33, in __init__
    fps_source)
  File "/usr/local/lib/python2.7/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 256, in ffmpeg_parse_infos
    proc = sp.Popen(cmd, **popen_params)
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

1.0.0 can not be installed because of missing dependencies (python3 required).

If the right version is installed and multiple mp4 files already exists within the seahub library, seahub starts a lot ffmpeg processes but they will never be finished. Seahub starts more and more of these processes which results in a server crash at the end.

Video thumbnails can not be used at all and it is very dangerous to active them.

mumpitzstuff avatar Mar 09 '19 23:03 mumpitzstuff

I modified /seahub/seahub/thumbnails/utils.py (seafile 6.3.4) and removed the whole moviepy dependency. moviepy seems to be full of bugs. I just replaced a few lines of code to call ffmpeg directly as subprocess. The video thumbnail feature works like a charm now!

Please add something similar to your official release.

utils.zip

mumpitzstuff avatar Mar 25 '19 11:03 mumpitzstuff

The following default value should be set to 1 because sometimes videos are shorter than 5s (seahub tries to recreate the thumbnail every time you reload the page, but always get an error):

# Use the frame at 5 second as thumbnail
THUMBNAIL_VIDEO_FRAME_TIME = 5

The user can set it to 5 or any other value if needed. Or just extract the very first frame from the video as default. This should work for all types of videos.

mumpitzstuff avatar Mar 25 '19 12:03 mumpitzstuff

@mumpitzstuff can you submit a pr for this? I don't understand the dependency on moviepy.

jonatino avatar Oct 01 '20 08:10 jonatino

Isn't video thumbnail deprecated as of 7.1? ctrl+f for ENABLE_VIDEO_THUMBNAIL in seafile-manual

laur89 avatar Oct 16 '20 17:10 laur89