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 video thumbnails not working #2798

Open
agevlakh opened this issue Jul 16, 2024 · 1 comment
Open

create video thumbnails not working #2798

agevlakh opened this issue Jul 16, 2024 · 1 comment

Comments

@agevlakh
Copy link

Hello. I have issue with video thumbnails. When I download video on my seafile server, only photo thumbnails works.
In seahub logs I see error:
[ERROR] seahub.thumbnail.utils:199 create_video_thumbnails [Errno 2] No such file or directory: 'ffmpeg'
2024-07-16 07:17:24,214 [ERROR] django.request:241 log_response Internal Server Error: /thumbnail/4ab2d98a-75de-4640-b5c1-82ade6dc45b0/create/

But I have installed ffmpeg and py module ffmpeg-python.
Also if I run ffmpeg in terminal I see output, also like seafile user.

Why seafile can't see ffmpeg? Please help

@malathair
Copy link

malathair commented Nov 14, 2024

I ran into this issue as well but was able to get things working after a bit of digging. For context, I am running manual seafile install on a Debian Bookworm VM rather than the containerized version

The fix for me was the following:

First I installed the ffmpeg package from the stable bookworm repo as recommended by a quick google search. Initially this did nothing, but after a reboot, the No such file or directory: 'ffmpeg' error was fixed.

After that issue was resolved, I started seeing the following in the logs:

2024-11-14 02:23:23,037 [ERROR] seahub.thumbnail.utils:199 create_video_thumbnails Command '['ffmpeg', '-ss', '1', '-vframes', '1', '/tmp/80ef82df.png', '-i', 'http://127.0.0.1:8082/files/813e57d4-4ced-48eb-bcd9-9d1a04ff8775/IMG_20241008_060007_6495.MP4']' returned non-zero exit status 69.
2024-11-14 02:23:23,038 [ERROR] django.request:241 log_response Internal Server Error: /thumbnail/b9470639-e613-4024-9d97-914920936b74/create/

I was able to resolve this by installing the latest version of ffmpeg (7.1) from Debian's testing repo instead of the package from bookworm's stable repo which is still version 5.1.6.


I did also run into an issue with two videos (before installing the latest version of ffmpeg) which were throwing the following exception:

2024-11-14 02:23:22,323 [ERROR] seahub.thumbnail.utils:210 create_video_thumbnails [Errno 2] No such file or directory: '/tmp/5b8e7217.png'
2024-11-14 02:23:22,452 [INFO] xmlschema:1274 include_schema Include schema from 'file:///opt/seafile/python-venv/lib/python3.11/site-packages/xmlschema/schemas/XSD_1.1/xsd11-extra.xsd'
2024-11-14 02:23:22,831 [ERROR] django.request:241 log_response Internal Server Error: /thumbnail/b9470639-e613-4024-9d97-914920936b74/create/
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-11.0.13/seahub/seahub/thumbnail/utils.py", line 206, in create_video_thumbnails
    ret = _create_thumbnail_common(tmp_path, thumbnail_file, size)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-11.0.13/seahub/seahub/thumbnail/utils.py", line 219, in _create_thumbnail_common
    image = Image.open(fp)
            ^^^^^^^^^^^^^^
  File "/opt/seafile/python-venv/lib/python3.11/site-packages/PIL/Image.py", line 3218, in open
    fp = builtins.open(filename, "rb")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/5b8e7217.png'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/seafile/seafile-server-11.0.13/seahub/thirdpart/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-11.0.13/seahub/thirdpart/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-11.0.13/seahub/seahub/auth/decorators.py", line 69, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-11.0.13/seahub/seahub/thumbnail/views.py", line 56, in thumbnail_create
    success, status_code = generate_thumbnail(request, repo_id, size, path)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-11.0.13/seahub/seahub/thumbnail/utils.py", line 116, in generate_thumbnail
    return create_video_thumbnails(repo, file_id, path, size,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-11.0.13/seahub/seahub/thumbnail/utils.py", line 211, in create_video_thumbnails
    os.unlink(tmp_path)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/5b8e7217.png'

This was fixed by modifing the subprocess call on line 197 of seafile-server-latest/seahub/seahub/thumbnail/uitls.py to include the -update true flag in the arguments for ffmpeg.

subprocess.check_output(['ffmpeg', '-ss', str(THUMBNAIL_VIDEO_FRAME_TIME), '-update', 'true', '-vframes', '1', tmp_path, '-i', inner_path])

This didn't resolve the issue with any of the other videos hence why I ultimately upgraded to the newer ffmpg version. Unsure if this was really necessary or if the newer version of ffmpeg would have resolved the issue with those two videos as well, but including it here in case it helps someone else.

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

No branches or pull requests

3 participants