Coder Social home page Coder Social logo

Video and Canvas merging about whammy HOT 6 CLOSED

antimatter15 avatar antimatter15 commented on June 26, 2024
Video and Canvas merging

from whammy.

Comments (6)

positlabs avatar positlabs commented on June 26, 2024

I think you're going to have to draw the video into the canvas, no matter how you save the output

from whammy.

kenseii avatar kenseii commented on June 26, 2024

Thanks for the reply, is It possible to have an example that would be very helpful.

<div id="video_box">
                <div id="video_overlays">
                    <canvas class="canvas"  id="canvas"></canvas></div>
                <div>
                    <video controls="true" id="video" src="video1_1.mp4"/>
                </div>
</div>

My html looks like that

and the js looks like this:

function download_merge() {
        var encoder = new Whammy.Video(15);
        var canvas_video = document.querySelector('canvas').getContext('2d');
        canvas_video.save();
        console.log(canvas_video);

        encoder.add(canvas_video);
        console.log(encoder);
        encoder.compile(false, function(output){
            var url = (window.URL || window.URL).createObjectURL(output);
            //var url = URL.createObjectURL(output);
            console.log(url);
            document.getElementById('download_link').href = url;
        });
    }

from whammy.

positlabs avatar positlabs commented on June 26, 2024

Use requestAnimationFrame and context2d.drawImage(yourVideoElement)

from whammy.

kenseii avatar kenseii commented on June 26, 2024

Use requestAnimationFrame and context2d.drawImage(yourVideoElement)
Thank you,
should I apply the requestAnimationFrame on the text canvas or the video element?

from whammy.

positlabs avatar positlabs commented on June 26, 2024

You will need to redraw the text every time the video is drawn.

from whammy.

kenseii avatar kenseii commented on June 26, 2024

Thanks for the reply, please can you share an example of the code?

from whammy.

Related Issues (20)

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.