How to export p5.js animations to a video format with CCapture.js | Tutorial #7

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ต.ค. 2024
  • This tutorial shows how to export a p5.js animation to a video format with the javascript library CCapture.js. There are multiple exporting options. This tutorial shows how to export to webm and GIF.
    If you want to improve your coding skills further, head over to codiwy.com. It is totally free to get started, and there will fresh content available every week.
    Source code on GitHub:
    github.com/col...
    Webm is a web based format but it can easily be converted to mp4 or similar through this webpage:
    cloudconvert.com/
    If you want more examples of things you can do in p5.js, just head over to Instagram:
    / colorfulcoding
    Get the CCapture.js library from here:
    github.com/spi...
    p5.js documentation:
    p5js.org/refer...
    If you don't know how to get started, here's a video covering that:
    • Get started with p5.js...
    If you have any questions or requests for future projects, feel free to leave a comment below 👇

ความคิดเห็น • 37

  • @fredchen9572
    @fredchen9572 2 ปีที่แล้ว +1

    Awesome tutorial! Thanks.
    This is exactly what I want

  • @matiaspina8471
    @matiaspina8471 ปีที่แล้ว

    Thanks for the tutorial, it was super helpful!

  • @dianasilvadesigns
    @dianasilvadesigns 2 ปีที่แล้ว +2

    would be great if i actually knew how to open my animation on google

  • @AlexXiuhuitl
    @AlexXiuhuitl ปีที่แล้ว

    Awesome tutorial! It was really helpful, tho I remain a question
    How can I change the resolution of the final video, it all depends on the canvas size?

    • @ColorfulCoding
      @ColorfulCoding  ปีที่แล้ว

      Yes, that is correct. The bigger the canvas, the higher the resolution.

  • @BenYoungAI
    @BenYoungAI 3 ปีที่แล้ว +1

    I followed your video to record a 400x400 canvas at 60fps. I can save a webm video that's less than 2 seconds but anything more than this and the animation freezes without saving any video. I tried to lower the framerate to 30, but I get the same results. Is there any way to work around this freezing? Is my computer just not powerful enough? I'm using a 2016 Macbook Pro with 8GB of memory.

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว

      Your computer should be more than capable to do that. It's hard to say whithout seeing the code, but try going through the video again and make sure everything is as it should be :)

  • @hasansiddique9998
    @hasansiddique9998 3 ปีที่แล้ว +2

    hey there, whenever i try to save the recording i get this TypeError download is not a function. i have installed the download package and loaded it in the index.html file but still get the same error. Any idea on how to overcome this problem?

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว

      Hmm I don't know. It is difficult to say without looking at the code. Are you sure you have used the right path in the link? :)

  • @nothinglastsforever0000
    @nothinglastsforever0000 ปีที่แล้ว

    How did you open the chrome like that?

  • @honeypotdataminer1880
    @honeypotdataminer1880 2 ปีที่แล้ว

    where are you getting that frameCount value from?

  • @MertCalkan
    @MertCalkan 11 หลายเดือนก่อน

    Is it recording with sound

  • @23ombzb
    @23ombzb ปีที่แล้ว

    Hello friend, I hope you can answer me. I happen to have seen your other video where you teach how to make an audio visualizer. I want to export the video with this tutorial, but it turns out that when I see the export everything is very fast.

    • @ColorfulCoding
      @ColorfulCoding  ปีที่แล้ว +1

      I think that has to do with the speed at which CCapture records the canvas. When recording it moves through the frames slower than it normally do. However, the music that the animation reacts to, is playing at normal speed during the recording. So when you play the recorded video, it will be faster than the music. Hope that makes sense.

    • @23ombzb
      @23ombzb ปีที่แล้ว

      @@ColorfulCoding That's exactly what happens, but I have no idea how to fix it. And hey thanks for answering me so quickly

    • @23ombzb
      @23ombzb ปีที่แล้ว

      I wait your answer :(

    • @ColorfulCoding
      @ColorfulCoding  ปีที่แล้ว

      You could try to slow down the song using either playback rate (p5js.org/examples/sound-playback-rate.html) or speed (p5js.org/reference/#/p5.MediaElement/speed).

    • @23ombzb
      @23ombzb ปีที่แล้ว

      ​@@ColorfulCoding I solved the problem, it was the speed of the audio as you said. But I had problems with the tone changing the wave too much, although I managed to fix it with FL Studio. My last question, how can I get the audio to start right away?
      Thanks friend, from here to this week I will join your page as a member to take the courses.

  • @jubrazkhan255
    @jubrazkhan255 3 ปีที่แล้ว

    This ccapture video+audio recoding possible

    • @indraperkasa
      @indraperkasa 3 ปีที่แล้ว

      can you share your process? i tried to capture my pj5s animation that contain video with audio. but no sound, visual only.

  • @agustincarpanetto9504
    @agustincarpanetto9504 3 ปีที่แล้ว

    Hey😄 how’s it going? I’m having an issue when I try to do it with the png format because it doesn’t download anything. All the frames are saved but after the process finishes the images doesn’t appear anywhere? What can I do?

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว +1

      Hmm, I havn't used the png format very much. Have you linked the 'tar.js' file in your html file? Exporting to gif should also give you all the frames separately, if that is what you want :)

    • @agustincarpanetto9504
      @agustincarpanetto9504 3 ปีที่แล้ว

      @@ColorfulCoding Yeah I linked it in body and in head the complete library. I don’t know why it doesn’t function. Anyways, what I have to do in order to get all the frames separately? Gifs? The thing is that I need the png with full quality to go to FFMPEG

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว

      @@agustincarpanetto9504 I'm not sure how good the quality will be when you export to gif. All you need to know should be covered in the video :)

  • @danielstrobel8369
    @danielstrobel8369 3 ปีที่แล้ว

    Hi,
    is there a simple way to use p5 as webcam source for programs like zoom, google meet, etc?

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว

      In JavaScript you can use the navigator.getUserMedia to access the webcam. You can find lots of examples online :)

    • @danielstrobel8369
      @danielstrobel8369 3 ปีที่แล้ว

      @@ColorfulCoding For webcam input I use createCapture().
      navigator.getUserMedia is deprecated by now.
      But thats not what I meant. I want to use p5 as digital camera output.
      Now I found a way by capturing the screen with OBS. But for this the p5-window has to be open.

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว

      Ah sorry, I meant this one: developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

  • @dunocgame864
    @dunocgame864 3 ปีที่แล้ว

    Hello a question how can I use Ccapture.js using only the canvas tag without the p5.js

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว

      I don't think you can do that without p5.js. At least not without making some kind of draw function yourself. But then you should just use the library :)

    • @dunocgame864
      @dunocgame864 3 ปีที่แล้ว

      @@ColorfulCoding and Delay the call of the setup and draw until another function finishes and that p5.js is executed at the moment of loading the web page

    • @ColorfulCoding
      @ColorfulCoding  3 ปีที่แล้ว

      @@dunocgame864 hmm, I haven't tried that before, but maybe you could use JavaScript to add the script later

    • @dunocgame864
      @dunocgame864 3 ปีที่แล้ว +1

      @@ColorfulCoding Hello Sorry I did not answer after trying a while I managed to save the gif and png with only the canvas
      Hola Disculpad no a ver respondido luego de probar un rato logre guardar el gif y png con solo el canvas api
      link: github.com/DunoCgame/ExampleCcapture/blob/main/index.html