Comments (16)
The following command generates a video that scale-up the video for the background image. It may help in some cases. At least work for me. I spent some time writing this command, just want to share it to save your time if you need it.
ffmpeg -i test_fightclub.mp4 -i fight_matte_image.mov -i green.png -filter_complex '[1][0]scale2ref[mask][main];[main][mask]alphamerge[vid];[vid][2:v]scale2ref[fg][bg];[bg][fg]overlay[out]' -map [out] fight_image_complete_scale2ref.mp4
now I can generate following output with the code:
from backgroundremover.
Hey,it also works with a PNG image: ffmpeg -i stress.mp4 -i matte.mp4 -i vert.png -filter_complex '[1][0]scale2ref[mask][main];[main][mask]alphamerge[vid];[2:v][vid]overlay[out]' -map [out] complete2.mp4
("vert" is green in French)
from backgroundremover.
I had this open on superuser as I had gotten stuck. I'll fix the '-tov' ffmpeg command and close this issue.
from backgroundremover.
hey @j2l,
I have used following command to combine the mate, video and the background video.
ffmpeg -i video.mp4 -i matte.mp4 -i background.mp4 -filter_complex '[1][0]scale2ref[mask][main];[main][mask]alphamerge[vid];[2:v][vid]overlay[out]' -map [out] complete.mp4
It works but has some rescaling issues. But the main point the code should give a proper output. it is working for image but now working for the video. any idea @nadermx ?
by the way here is the output:
from backgroundremover.
same issue:
backgroundremover -i 15_terminator.mp4 -tov green.mp4 -o g_out.mov usage: backgroundremover [-h] [-m {u2net,u2net_human_seg,u2netp}] [-a [ALPHA_MATTING]] [-af ALPHA_MATTING_FOREGROUND_THRESHOLD] [-ab ALPHA_MATTING_BACKGROUND_THRESHOLD] [-ae ALPHA_MATTING_ERODE_SIZE] [-az ALPHA_MATTING_BASE_SIZE] [-wn WORKERNODES] [-gb GPUBATCHSIZE] [-fr FRAMERATE] [-fl FRAMELIMIT] [-mk [MATTEKEY]] [-tv [TRANSPARENTVIDEO]] [-tov [TRANSPARENTVIDEOOVERVIDEO]] [-toi [TRANSPARENTVIDEOOVERIMAGE]] [-tg [TRANSPARENTGIF]] [-tgwb [TRANSPARENTGIFWITHBACKGROUND]] [-i [INPUT]] [-bi [BACKGROUNDIMAGE]] [-bv [BACKGROUNDVIDEO]] [-o [OUTPUT]] backgroundremover: error: argument -tov/--transparentvideoovervideo: invalid <lambda> value: 'green.mp4'
from backgroundremover.
So far, I didn't find a way to make it work and python code looks the same as -tv
so I don't see why the file is not loaded as overlay.
Let me know @celikmustafa89 if you find some way 😉
from backgroundremover.
So far, I didn't find a way to make it work and python code looks the same as
-tv
so I don't see why the file is not loaded as overlay.
Let me know @celikmustafa89 if you find some way 😉
Hi,
I found the way of running it.
backgroundremover -i terminator.mp4 -toi -bv green.mp4 -o out_vid.mov
however the output is not good. I was expecting the original video with the green background but it is a grayscale output. :S :S
from backgroundremover.
may be it is because of the version of FFmpeg ?? I do not know.
from backgroundremover.
I had the same, its the alpha matte (mask for the alpha channel).
For an image with the same size as the video it shrinks the video and only keep the matte:
from backgroundremover.
I had the same, its the alpha matte (mask for the alpha channel).
For an image with the same size as the video it shrinks the video and only keep the matte:
how should we run the code to get a proper output? any idea?
from backgroundremover.
I had the same, its the alpha matte (mask for the alpha channel).
For an image with the same size as the video it shrinks the video and only keep the matte:
how should we run the code to get a proper output? any idea?
No idea 😕
from backgroundremover.
Your exact command worked for me!
from backgroundremover.
actually i have some rescale problem with original and background video. by the way my green background is not an image. it is a green backgorund video which shows only green. could you do the merge of original video, matte and a green.png (image)? please share the code?
from backgroundremover.
I also used a green background video and applied your code with my videos: ffmpeg -i stress.mp4 -i matte.mp4 -i vert.mp4 -filter_complex '[1][0]scale2ref[mask][main];[main][mask]alphamerge[vid];[2:v][vid]overlay[out]' -map [out] complete.mp4
It doesn't fix the backgroundremove issue so I keep the issue open for @nadermx or someone who finds the bug. It's way above my skills 😄
If I can help you more, let me know.
from backgroundremover.
Cool!
Thank you!
from backgroundremover.
Thank you!
from backgroundremover.
Related Issues (20)
- Running backgroundremover on live server it take longer time and nothing happen and hanging the server. HOT 2
- backgroundremover -i "1.mp4" -toi "a.png" -o "output.mov" HOT 1
- Background removal exception
- efficiency HOT 1
- Great god, come on!
- How to use in a Android App ? HOT 1
- How to use as a library ? HOT 2
- Does this software support batch JPG processing? HOT 1
- Anyone can help? thanks HOT 6
- Error initializing filter 'alphamerge' with args 'shortest=1' HOT 3
- May I ask how to make a model
- Video removal produces mask only? HOT 4
- transparent mov not created HOT 1
- video over image not working HOT 1
- Server Requirements? HOT 2
- Mismatch Between GitHub and PyPI Versions of backgroundremover v0.2.7 HOT 3
- Solved - ValueError: invalid literal for int() with base 10: '9222,\n\n' HOT 2
- API rotates image HOT 6
- It doesn't use GPU and runs much slower on Intel CPU
- How to start http server. ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backgroundremover.