Giter Club home page Giter Club logo

remove_background_for_video's Introduction

remove_background_for_video

To remove background of video, in order to play on keynote, I try many methods, from ffmpeg, website online tools. to iMovie.

Here is the final methods I use:

Step 1: screenshot of kenote as background

Step 2: put background and PNGs into one folder and change route in terminal

  • cd

Step 3: use ffmpeg to convert background and PNGs into mp4

  • Input: png + pngs
  • Codes: ffmpeg -i background.png -r 10 -i network_%03d.png -filter_complex "[0]scale=2180:1120, overlay=560:30" my2_1.mp4 -y, PERFECT!.
  • Remark: frame rate = 10
  • Useful resources: just codes, PNG+PNGs

Step 4: create subtitle

  • Use R to derive start date and end date of each time window and write in txt.
  • Use python to read txt and write SRT file as subtitle.

Step 5: Add subtitles:

Other refrences:

  1. Video tutorial for transparent website video for a golf ball on Mac. Output is mov. Tool: Adobe after effects(not free), Shutter Encoder. The very important step is done by Adobe after effects.
  2. Use ffmpeg to replace green background with transparent background.
  3. Use iMovie to combine video and png, replace green background with selected png.
  4. Videezy: video resources.
  5. Use ffmpeg to import images with alpha to a video with alpha in stackoverflow, codes are ffmpeg -i network_%03d.png -vcodec png my2.mov. Cannot display.
  6. Online tool deposiphotos, which can transform black background to green background.
  7. Use ffmpeg to output alpha mov, found in CSDN, codes are ffmpeg -f image2 -r 10 -i network_%03d.png -vf fps=25 -vcodec png my2.mov -y. Cannot display.
  8. Combind 2 videos and make one transparent, found in CSDN blog.
  9. Use ffmpeg to import images with alpha to generate video with alpha, found in CSDN, codes are ffmpeg -r 10 -i network_%03d.png -vcodec qtrle my2.mov -y, cannot play. ffmpeg -r 10 -i network_%03d.png -vcodec ffvhuff my2.avi -y, cannot play. ffmpeg -r 10 -i network_%03d.png -vcodec huffyuv my2.avi -y`, cannot play.
  10. Use ffmpeg to import images to make a mov and set framerate as 10, codes are ffmpeg -r 10 -i network_%03d.png -pix_fmt yuva420p my3film.mov. Can work but not transparent.
  11. Different formats supporting video with alpha in IOS and Android, found in CSDN. Seems like IOS only supports H265 with alpha channel.
  12. Use ffmpeg, inputs are a mp4 and a png, output is mp4, codes usecolorchannelmixer, found in Youtube.
  13. RiskMakes personal website for ffmpeg.
  14. Use ffmpeg to remove green background and replace it with transparent background. Use vp9, output is webm. Codes are ffmpeg -i my2film.mp4 -c:v vp9 -filter:v "chromakey=0x000000:0.1:0.2" my1.webm -y. Cannot play.
  15. Using ffmpeg to make an H.265 file compatible with Quicktime, found in RiskMakes website, codes are ffmpeg -i input.mp4 -codec copy -tag:v hvc1 output.mp4. My version ffmpeg -i my2.mov -codec copy -tag:v hvc1 my2_1.mov cause error.
  16. Use ffmpeg to create transparent timer.
  17. Use ffmpeg to create transparent scrolling credits.
  18. Use ffmpeg to convert pngs to a mp4, codes are ffmpeg -r 10 -i network_%03d.png -pix_fmt yuv420p my1.mp4.
  19. Chinese tutorials for how to install and use ffmpeg, very clear.
  20. Encoder Apple ProRes supports alpha channel and can play on Quicktime, codes areffmpeg -r 10 -i network_%03d.png -c:v prores:v -profile 4 -pix_fmt yuv444p10 my1.mov -y. or ffmpeg -r 10 -i network_%03d.png -c:v prores_ks -profile:v 4 -pix_fmt yuv444p10 my1.mov -y . Not transparent.

Create a background using one png ffmpeg -loop 1 -i background.png -c:v libx264 -t 17 -pix_fmt yuv420p -vf scale=1320:640 my2.mp4 -y.

Add pngs to video:

  • ffmpeg -i my2.mp4 -i network_001.png -filter_complex "[0:v][1:v]overlay" -vcodec libx264 my2_1.mp4 -y. png too big
  • ffmpeg -i my2.mp4 -r 10 -i network_%03d.png -filter_complex "[0:v][1:v]overlay" -vcodec libx264 my2_1.mp4 -y. only 1 png
  • ffmpeg -i my2.mp4 -framerate 10 -pattern_type glob -i "network_%03d.png" -filter_complex "[1:v][0:v]scale2ref=iw:ih[ovr]; [ovr][0:v]blend=all_mode='overlay':all_opacity=0.7[v]" -map [v] my2_1.mp4 -y as in here.
  • ffmpeg -i my2.mp4 -i network_001.png -filter_complex "[0:v][1:v]overlay=50:50:enable='between(t,0,1)'" -pix_fmt yuv420p -c:a copy my2_1.mp4 -y as in Youtube. Time in (0,1), scale not solved.
  • ffmpeg -i my2.mp4 -i network_001.png -filter_complex "[1]scale=50:50;[0:v][1:v]overlay=50:50:enable='between(t,0,1)'" -pix_fmt yuv420p -c:a copy my2_1.mp4 -y, scaled, but awful.
  • ffmpeg -i background.png -i network_%03d.png -filter_complex "overlay" my2_1.mp4 -y, works but no scaled, thanks to this.
  • ffmpeg -i background.png -r 10 -i network_%03d.png -filter_complex "overlay" my2_1.mp4 -y, change frame rate, works but no scaled.
  • ffmpeg -i background.png -r 10 -i network_%03d.png -filter_complex "[1:v]scale=1080:1080, overlay" my2_1.mp4 -y scale background, background on the top
  • ffmpeg -i background.png -r 10 -i network_%03d.png -filter_complex "[0:v]scale=1080:1080, overlay=50:50" my2_1.mp4 -y scale pngs, pngs on the top
  • ffmpeg -i background.png -r 10 -i network_%03d.png -filter_complex "[0:v]scale=1080:1080, overlay" my2_1.mp4 -y scale pngs, pngs on the top
  • ffmpeg -i background.png -r 10 -i network_%03d.png -filter_complex "[0]scale=2180:1120, overlay=560:30" my2_1.mp4 -y PERFECT!
  • ffmpeg -i background.png -r 10 -i network_%03d.png -filter_complex "[0:v]scale=720:740, overlay=(main_w-overlay_w)/4:(main_h-overlay_h)/4" my2_1.mp4 -y, no movie

remove_background_for_video's People

Contributors

wzj5163 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.