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

anime4k not working in Docker image #1131

Closed
arximboldi opened this issue Jun 26, 2024 · 3 comments
Closed

anime4k not working in Docker image #1131

arximboldi opened this issue Jun 26, 2024 · 3 comments

Comments

@arximboldi
Copy link

16:17:34.503452 | INFO     | Video2X 5.0.0-beta7
16:17:34.503660 | INFO     | Copyright (C) 2018-2024 K4YT3X and contributors.
16:17:34.503740 | INFO     | Reading input video information
16:17:34.560257 | WARNING  | No progress bar available for this processor
16:17:34.563567 | ERROR    | [Errno 2] No such file or directory: 'xvfb-run'
Traceback (most recent call last):

  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
           │         │     └ {'__name__': '__main__', '__doc__': '\nCopyright (C) 2018-2024 K4YT3X and contributors.\n\nThis program is free software: you...
           │         └ <code object <module> at 0x7f0b0e322870, file "/usr/local/lib/python3.9/dist-packages/video2x/__main__.py", line 3>
           └ <function _run_code at 0x7f0b6b008430>
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
         │     └ {'__name__': '__main__', '__doc__': '\nCopyright (C) 2018-2024 K4YT3X and contributors.\n\nThis program is free software: you...
         └ <code object <module> at 0x7f0b0e322870, file "/usr/local/lib/python3.9/dist-packages/video2x/__main__.py", line 3>

  File "/usr/local/lib/python3.9/dist-packages/video2x/__main__.py", line 232, in <module>
    sys.exit(main())
    │   │    └ <function main at 0x7f0b0e323700>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>

> File "/usr/local/lib/python3.9/dist-packages/video2x/__main__.py", line 197, in main
    video2x.upscale(
    │       └ <function Video2X.upscale at 0x7f0b0e3233a0>
    └ <video2x.video2x.Video2X object at 0x7f0b66b38370>

  File "/usr/local/lib/python3.9/dist-packages/video2x/video2x.py", line 415, in upscale
    self._run(
    │    └ <function Video2X._run at 0x7f0b0e33faf0>
    └ <video2x.video2x.Video2X object at 0x7f0b66b38370>

  File "/usr/local/lib/python3.9/dist-packages/video2x/video2x.py", line 168, in _run
    standalone_processor().process_video(
    └ <class 'anime4k_python.anime4k.Anime4K'>

  File "/usr/local/lib/python3.9/dist-packages/anime4k_python/anime4k.py", line 64, in process_video
    subprocess.run(command, check=True)
    │          │   └ ['xvfb-run', '-a', 'mpv', '--no-sub', '--glsl-shaders=/usr/local/lib/python3.9/dist-packages/anime4k_python/shaders/Anime4K_M...
    │          └ <function run at 0x7f0b6ac9a550>
    └ <module 'subprocess' from '/usr/lib/python3.9/subprocess.py'>

  File "/usr/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
         │      │            └ {}
         │      └ (['xvfb-run', '-a', 'mpv', '--no-sub', '--glsl-shaders=/usr/local/lib/python3.9/dist-packages/anime4k_python/shaders/Anime4K_...
         └ <class 'subprocess.Popen'>
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    │    │              │     │           │           └ True
    │    │              │     │           └ None
    │    │              │     └ None
    │    │              └ ['xvfb-run', '-a', 'mpv', '--no-sub', '--glsl-shaders=/usr/local/lib/python3.9/dist-packages/anime4k_python/shaders/Anime4K_M...
    │    └ <function Popen._execute_child at 0x7f0b6ac9b4c0>
    └ <Popen: returncode: 255 args: ['xvfb-run', '-a', 'mpv', '--no-sub', '--glsl-...>
  File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
          │                    │          │        └ 'xvfb-run'
          │                    │          └ 'No such file or directory'
          │                    └ 2
          └ <class 'OSError'>

@arximboldi
Copy link
Author

Btw, I have the impression that the way anime4k via animecpp is executed is a bit dated, as one can directly do the processing via mpv or ffmpeg. I haven't managed to do it just with the later, but I have read in some places that it should be possible:
bloc97/Anime4K#200

I use this bash function now to invoke via mpv. It has the problem that it doesn't preserve the subtitle tracks, something that could be maybe solved via ffmpeg.

function anime4k()
{
    echo == INPUT:  $1
    echo == OUTPUT: $2
    mpv "$1" \
        --no-sub \
        --glsl-shaders="~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/Anime4K_Restore_CNN_VL.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_VL.glsl:~~/shaders/Anime4K_Restore_CNN_M.glsl:~~/shaders/Anime4K_AutoDownscalePre_x2.glsl:~~/shaders/Anime4K_AutoDownscalePre_x4.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl" \
        -vf=gpu="w=1440:h=1080" \
        --o="$2"
}

Anyway for now this works for me so it's not the end of the world, but it would be cool to have just one tool for all algorithms!

@arximboldi
Copy link
Author

arximboldi commented Jun 29, 2024

Ah ok! So it seems the backend written by out beloved @k4yt3x already has some support for using ffmpeg under the hood: https://github.com/media2x/anime4k-python

Maybe I can use that mode instead...

@k4yt3x k4yt3x closed this as completed Oct 8, 2024
@k4yt3x
Copy link
Owner

k4yt3x commented Oct 8, 2024

Try the new docker image.

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

2 participants