1

We have a video provided with green background (Chroma Key) and it needs to be transparent. I am new to chroma key and video editing, doesn't know much about this. My requirement is making the video transparent to use it on web page using PHP script, so that it will work on windows, safari (mac, iOS) using web interface. We have many videos like this so we only need to do this using some script which can set videos on run time if possible.

I have looked into a-frame but unable to find any option to make the video background transparent so that the content behind the video will be visible. Also its working alone but when i am trying to implement in my project it breaks the entire html code after that.

<a-scene>
    <a-assets style="display: none">
      <video id="greenscreenvideo" src="video.mp4" loop autoplay muted/>
    </a-assets>
    <a-entity material="shader: chromakey; src: #greenscreenvideo; color: 0.1 0.9 0.2" geometry="primitive: box; width: 1; height: 1; depth: 1" click-drag position="0 1.6 -1.5"  ></a-entity>
  </a-scene>

Also tried to use ffmpeg with PHP, i tried to run comman online but it doesn't work for me. Please find the command as below:-

Anyone please help?

ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mp4
M.Bains
  • 395
  • 1
  • 2
  • 14
  • browsers don't have support for alpha channel in mp4, only in webm ... see https://github.com/samdutton/simpl/tree/gh-pages/videoalpha for working sample that works in some browsers – Offbeatmammal Jul 29 '19 at 09:45
  • @Offbeatmammal thanks for reply. I have tested this, its not working on safari. I need solution which will also work on safari. – M.Bains Jul 29 '19 at 10:01
  • afaik the only solution for what you want will be to process the video yourself and display frames onto a canvas like http://blog.aaronholmes.net/transparent-video-in-all-browsers-from-cross-domain-sources/ – Offbeatmammal Jul 29 '19 at 10:10

0 Answers0