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.45k stars 535 forks source link

Video/gif output not working. #41

Closed LuckyDarms closed 1 year ago

LuckyDarms commented 1 year ago

Been playing around with it for a couple hours now and I'm not having any luck outputting video or gif files. Every time it returns a 0kb file. Using ffmpeg 5.1.1. I'm happy to provide any other details you need, but I can say that when I run the command there's no apparent errors.

nadermx commented 1 year ago

Are you on windows? I am working on a backlog of issues, I will get back to this at some point. If it is windows, you could help a bit by trying to get a version working on local since I think it is a issue specifically with how I am making a temp file in linux vs windows.

LuckyDarms commented 1 year ago

Actually, I was working with a local version (Yes, on windows). Using the standard pip installation method I was having problems even getting started, until I just downloaded the master file as a zip and ran it from there. I'm gonna be stuck at work all day but if there's a specific log file you need just let me know.

nadermx commented 1 year ago

specifically this https://stackoverflow.com/a/44974958/4180276

On Fri, Sep 16, 2022 at 10:35 AM Johnathan Nader @.***> wrote:

I am in no rush for this, I meant to say that I am working down my list of project issues, havent gotten to this project yet. But the fix should not be complicated. I believe it has to do with these few lines working with linux but not windows, https://github.com/nadermx/backgroundremover/blob/main/backgroundremover/utilities.py#L165

On Fri, Sep 16, 2022 at 9:26 AM LuckyDarms @.***> wrote:

Actually, I was working with a local version (Yes, on windows). Using the standard pip installation method I was having problems even getting started, until I just downloaded the master file as a zip and ran it from there. I'm gonna be stuck at work all day but if there's a specific log file you need just let me know.

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

nadermx commented 1 year ago

I am in no rush for this, I meant to say that I am working down my list of project issues, havent gotten to this project yet. But the fix should not be complicated. I believe it has to do with these few lines working with linux but not windows, https://github.com/nadermx/backgroundremover/blob/main/backgroundremover/utilities.py#L165

On Fri, Sep 16, 2022 at 9:26 AM LuckyDarms @.***> wrote:

Actually, I was working with a local version (Yes, on windows). Using the standard pip installation method I was having problems even getting started, until I just downloaded the master file as a zip and ran it from there. I'm gonna be stuck at work all day but if there's a specific log file you need just let me know.

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

Quantum-Electrodynamics commented 1 year ago

This problem also occurs on colab.

russkiimike commented 1 year ago

This problem also occurs on colab.

Yeah I run into this on colab too

hokascha commented 1 year ago

same here on Ubuntu linux:

$ backgroundremover -fr 60 -i /media/NVMe/nextcloud/SofortUpload/2023/03/PXL_20230323_115515428.mp4 -tv -o /media/Lager/test.mov
/media/NVMe/nextcloud/SofortUpload/2023/03/PXL_20230323_115515428.mp4
FRAME RATE: 60 TOTAL FRAMES: 198
WORKER 0 ONLINE
WORKER FRAMERIPPER ONLINE
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-liblensfun --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rawvideo, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: 87244 kb/s
    Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 568x320, 87244 kb/s, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
[swscaler @ 0x561ae4d66d80] Warning: data is not aligned! This can lead to a speed loss
Output #0, mp4, to '/tmp/tmpzvkvt1o5/matte.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 568x320, q=2-31, 2000 kb/s, 60 fps, 15360 tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.54.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: -1
frame=  198 fps=2.7 q=2.0 Lsize=     397kB time=00:00:03.28 bitrate= 991.1kbits/s speed=0.0449x    
video:396kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.423906%
FINISHED ALL FRAMES (198)!
Starting alphamerge
after call
Process finished

results in a 0 bytes file.

hokascha commented 1 year ago

Updating FFmpeg to version 5.1.2 works for me. On Ubuntu 20.04 you have to add a PPA to make this work, see https://ubuntuhandbook.org/index.php/2022/02/install-ffmpeg-5-0-ubuntu/

nadermx commented 1 year ago

I'll have to put in a validation to check ffmpeg version, since it only works with 4.4+ and the apt package currently installs 4.2

El jue, 23 de mar de 2023 10:49, Hokascha @.***> escribió:

Updating FFmpeg to version 5.1.2 works for me. On Ubuntu 20.04 you have to add a PPA to make this work, see https://ubuntuhandbook.org/index.php/2022/02/install-ffmpeg-5-0-ubuntu/

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

nadermx commented 1 year ago

try newest release https://github.com/nadermx/backgroundremover/releases/tag/v0.2.1

ammaraslam10 commented 1 year ago
Traceback (most recent call last):
  File "runpy.py", line 193, in _run_module_as_main
  File "runpy.py", line 85, in _run_code
  File "C:\abc\env\Scripts\backgroundremover.exe\__main__.py", line 7, in <module>
  File "C:\abc\env\lib\site-packages\backgroundremover\cmd\cli.py", line 224, in main
    framerate=args.framerate)
  File "C:\abc\env\lib\site-packages\backgroundremover\utilities.py", line 186, in transparentgif
    framerate)
  File "C:\abc\env\lib\site-packages\backgroundremover\utilities.py", line 78, in matte_key
    info = ffmpeg.probe(file_path)
  File "C:\abc\env\lib\site-packages\ffmpeg\_probe.py", line 20, in probe
    p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "subprocess.py", line 729, in __init__
  File "subprocess.py", line 1017, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified

Any idea? (I'm on 0.2.1) backgroundremover -i "temp/vid.mp4" -tg -o "temp/vid-tp.gif"

nadermx commented 1 year ago

what version of windows? CAn you make just the mk?

On Mon, May 15, 2023 at 5:53 PM ammaraslam10 @.***> wrote:

Traceback (most recent call last): File "runpy.py", line 193, in _run_module_as_main File "runpy.py", line 85, in _run_code File "C:\abc\env\Scripts\backgroundremover.exe__main.py", line 7, in File "C:\abc\env\lib\site-packages\backgroundremover\cmd\cli.py", line 224, in main framerate=args.framerate) File "C:\abc\env\lib\site-packages\backgroundremover\utilities.py", line 186, in transparentgif framerate) File "C:\abc\env\lib\site-packages\backgroundremover\utilities.py", line 78, in matte_key info = ffmpeg.probe(file_path) File "C:\abc\env\lib\site-packages\ffmpeg_probe.py", line 20, in probe p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "subprocess.py", line 729, in init__ File "subprocess.py", line 1017, in _execute_child FileNotFoundError: [WinError 2] The system cannot find the file specified

Any idea? backgroundremover -i "temp/vid.mp4" -tg -o "temp/vid-tp.gif"

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/41#issuecomment-1548646882, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXDIK47KTUZ3225CFGDXGKQW3ANCNFSM6AAAAAAQL6VIJ4 . You are receiving this because you modified the open/close state.Message ID: @.***>

nadermx commented 1 year ago

did you upgrade also?

md-rifatkhan commented 5 months ago

still same