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

Anyone can help? thanks #131

Closed chihunglo closed 3 months ago

chihunglo commented 3 months ago

When I try to remove background from a video, I always get this error, even I install Pillow 9.5.0 and still same:

Traceback (most recent call last): File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\Scripts\backgroundremover-script.py", line 33, in <module> sys.exit(load_entry_point('backgroundremover==0.2.6', 'console_scripts', 'backgroundremover')()) File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\lib\site-packages\backgroundremover\cmd\cli.py", line 239, in main remove( File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\lib\site-packages\backgroundremover\bg.py", line 184, in remove img = Image.open(io.BytesIO(data)).convert("RGB") File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\Image.py", line 3309, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x0000017DEBDC1EE0>

But I can remove photo's background, How can I fix this problem? thank you

nadermx commented 3 months ago

What is the command you are using with background remover?

On Wed, Mar 13, 2024, 7:55 PM chihunglo @.***> wrote:

When I try to remove background from a video, I always get this error, even I install Pillow 9.5.0 and still same:

Traceback (most recent call last): File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\Scripts\backgroundremover-script.py", line 33, in sys.exit(load_entry_point('backgroundremover==0.2.6', 'console_scripts', 'backgroundremover')()) File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\lib\site-packages\backgroundremover\cmd\cli.py", line 239, in main remove( File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\lib\site-packages\backgroundremover\bg.py", line 184, in remove img = Image.open(io.BytesIO(data)).convert("RGB") File "C:\Users\Simon\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\Image.py", line 3309, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x0000017DEBDC1EE0>

But I can remove photo's background, How can I fix this problem? thank you

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

chihunglo commented 3 months ago

backgroundremover -i "C:\cat\c4_02.avi" -tv -o "D:\Software\AI\backgroundremover\output.mp4" (I try many video, but still same error)

Thank you

nadermx commented 3 months ago

You can only make .mov for transparent background, your trying to make a .mp4

On Wed, Mar 13, 2024, 8:00 PM chihunglo @.***> wrote:

backgroundremover -i "C:\cat\c4_02.avi" -tv -o "D:\Software\AI\backgroundremover\output.mp4" Thank you

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

chihunglo commented 3 months ago

You can only make .mov for transparent background, your trying to make a .mp4 On Wed, Mar 13, 2024, 8:00 PM chihunglo @.> wrote: backgroundremover -i "C:\cat\c4_02.avi" -tv -o "D:\Software\AI\backgroundremover\output.mp4" Thank you — Reply to this email directly, view it on GitHub <#131 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXFZF4ERQZOLZYWRSXLYYEADJAVCNFSM6AAAAABEVHCQEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJWGI2TKMJQGY . You are receiving this because you commented.Message ID: @.>

Thanks, even I try backgroundremover -i "C:\cat\c4_02.avi" -tv -o "D:\Software\AI\backgroundremover\output.mov" but still get same error.

Traceback (most recent call last): File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Simon\anaconda3\envs\backgroundremover\Scripts\backgroundremover.exe\__main__.py", line 7, in <module> File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\site-packages\backgroundremover\cmd\cli.py", line 239, in main remove( File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\site-packages\backgroundremover\bg.py", line 184, in remove img = Image.open(io.BytesIO(data)).convert("RGB") File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\site-packages\PIL\Image.py", line 3309, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x0000022668FA1F90>

nadermx commented 3 months ago

Can you try converting your .Avi to .MP4 and converting it? I off hand don't remember if I put a validation for the input type of video

On Wed, Mar 13, 2024, 10:07 PM chihunglo @.***> wrote:

You can only make .mov for transparent background, your trying to make a .mp4 … <#m7805038489837978924> On Wed, Mar 13, 2024, 8:00 PM chihunglo @.> wrote: backgroundremover -i "C:\cat\c4_02.avi" -tv -o "D:\Software\AI\backgroundremover\output.mp4" Thank you — Reply to this email directly, view it on GitHub <#131 (comment) https://github.com/nadermx/backgroundremover/issues/131#issuecomment-1996255106>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXFZF4ERQZOLZYWRSXLYYEADJAVCNFSM6AAAAABEVHCQEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJWGI2TKMJQGY https://github.com/notifications/unsubscribe-auth/ABYACXFZF4ERQZOLZYWRSXLYYEADJAVCNFSM6AAAAABEVHCQEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJWGI2TKMJQGY . You are receiving this because you commented.Message ID: @.>

Thanks, even I try backgroundremover -i "C:\cat\c4_02.avi" -tv -o "D:\Software\AI\backgroundremover\output.mov" but still get same error.

Traceback (most recent call last): File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Simon\anaconda3\envs\backgroundremover\Scripts\backgroundremover.exe__main__.py", line 7, in File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\site-packages\backgroundremover\cmd\cli.py", line 239, in main remove( File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\site-packages\backgroundremover\bg.py", line 184, in remove img = Image.open(io.BytesIO(data)).convert("RGB") File "C:\Users\Simon\anaconda3\envs\backgroundremover\lib\site-packages\PIL\Image.py", line 3309, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x0000022668FA1F90>

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

chihunglo commented 3 months ago

thank you, I find the problem now, I just pip uninstall pillow and install pillow again and this problem fixed, thank you so much (I don't know why, but just reinstall pillow will fix my problem)