nadermx / backgroundremover

Background Remover lets you Remove Background from images and video using AI with a simple command line interface that is free and open source.
https://www.backgroundremoverai.com
MIT License
6.43k stars 534 forks source link

windows video convertion failed #102

Closed skylerush closed 3 months ago

skylerush commented 8 months ago

I've successfully installed the necessary library and configured FFmpeg for video conversion, which worked seamlessly for other file types. However, when attempting to convert a video file, I encountered an unexpected and perplexing error that has proven challenging to resolve. Despite my efforts, I'm still seeking a solution to this particular issue.

PS H:\pythontest> backgroundremover -i "t.mp4" -tv -o "output.mov"
FRAME RATE DETECTED: 60/1 (if this looks wrong, override the frame rate)
FRAME RATE: 60 TOTAL FRAMES: 475
WORKER FRAMERIPPER ONLINE
WORKER 0 ONLINE
Process Process-2:
Traceback (most recent call last):
  File "C:\Python310\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\Python310\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\backgroundremover\utilities.py", line 57, in capture_frames
    for idx, frame in enumerate(iter_frames(file_path)):
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\backgroundremover\bg.py", line 206, in iter_frames
    return mpy.VideoFileClip(path).resize(height=320).iter_frames(dtype="uint8")
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\video\fx\resize.py", line 152, in resize
    newclip = clip.fl_image(fl)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\video\VideoClip.py", line 490, in fl_image
    return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\Clip.py", line 136, in fl
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "<decorator-gen-61>", line 2, in set_make_frame
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\decorators.py", line 14, in outplace
    f(newclip, *a, **k)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\video\VideoClip.py", line 644, in set_make_frame
    self.size = self.get_frame(0).shape[:2][::-1]
  File "<decorator-gen-11>", line 2, in get_frame
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\Clip.py", line 93, in get_frame
    return self.make_frame(t)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\Clip.py", line 136, in <lambda>
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\video\VideoClip.py", line 490, in <lambda>
    return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\video\fx\resize.py", line 150, in <lambda>
    fl = lambda pic: resizer(pic.astype('uint8'), newsize)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\moviepy\video\fx\resize.py", line 37, in resizer
    resized_pil = pilim.resize(newsize[::-1], Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
Traceback (most recent call last):
  File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\Scripts\backgroundremover.exe\__main__.py", line 7, in <module>
Process Process-3:
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\backgroundremover\cmd\cli.py", line 196, in main
Traceback (most recent call last):
  File "C:\Python310\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
    utilities.transparentvideo(os.path.abspath(args.output.name), os.path.abspath(args.input.name),
  File "C:\Python310\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\backgroundremover\utilities.py", line 40, in worker
    time.sleep(0.1)
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\backgroundremover\utilities.py", line 234, in transparentvideo
KeyboardInterrupt
    matte_key(temp_file, file_path,
  File "C:\Users\Sagi\AppData\Roaming\Python\Python310\site-packages\backgroundremover\utilities.py", line 127, in matte_key
    time.sleep(0.1)
KeyboardInterrupt
Exception ignored in atexit callback: <function _exit_function at 0x000001E38AAB6B00>
Traceback (most recent call last):
  File "C:\Python310\lib\multiprocessing\util.py", line 357, in _exit_function
    p.join()
  File "C:\Python310\lib\multiprocessing\process.py", line 149, in join
    res = self._popen.wait(timeout)
  File "C:\Python310\lib\multiprocessing\popen_spawn_win32.py", line 108, in wait
    res = _winapi.WaitForSingleObject(int(self._handle), msecs)
KeyboardInterrupt:
skylerush commented 8 months ago

maybe it is related to the OS? because I saw here some folks that were able to convert it fine with ubuntu

nadermx commented 8 months ago

What OS are you using? And also did you install python3.x-dev x being what ever version of python you are using?

On Mon, Oct 16, 2023 at 4:05 PM sagi @.***> wrote:

maybe it is related to the OS? because I saw here some folks that were able to convert it fine with ubuntu

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/102#issuecomment-1765188579, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXAB74UBYLKXYM7NNMDX7WHPFAVCNFSM6AAAAAA6CXKWR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGE4DQNJXHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

skylerush commented 8 months ago

I’m using python 3.10 and OS is windows 10

Unrud commented 6 months ago

moviepy is incompatible with Pillow>=10, because Image.ANTIALIAS was removed.

pip install "Pillow<10"