Last active
September 23, 2020 10:03
-
-
Save avinayak/dd656b3b60e13ba831ab1b9e638d8cc1 to your computer and use it in GitHub Desktop.
recording p5js skecthes in editor.p5js.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Add the snippet below in sketch.js | |
### optional: convert to mp4 using ffmpeg -fflags +genpts -i input.webm -r 24 out.mp4 | |
function record(){chunks.length=0;let e=document.querySelector("#defaultCanvas0").captureStream(300),t=new MediaRecorder(e);t.ondataavailable=(e=>{e.data.size&&chunks.push(e.data)}),t.onstop=exportVideo,setTimeout(()=>{t.stop()},1e4),t.start()}function exportVideo(e){var t=new Blob(chunks),o=document.createElement("video");o.id="recorded",o.controls=!0,o.src=URL.createObjectURL(t),document.body.appendChild(o),o.play()}chunks=[],record(); |
ffmpeg -i 0908ccc8-62d1-42f9-8968-380ccd97c9a4.webm -crf 23 video.mp4
loseless
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function record(){chunks.length=0;let e=document.querySelector("#defaultCanvas0").captureStream(300),t=new MediaRecorder(e);t.ondataavailable=(e=>{e.data.size&&chunks.push(e.data)}),t.onstop=exportVideo,setTimeout(()=>{t.stop()},1e4),t.start()}function exportVideo(e){var t=new Blob(chunks),o=document.createElement("video");o.id="recorded",o.controls=!0,o.src=URL.createObjectURL(t),document.body.appendChild(o),o.play()}chunks=[],record();