Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <input type="file" accept="video/*" capture id="file"><br>
<video id='local-video' style="vertical-align: top; width:320px; height:240px; border: black 1px solid;" controls playsinline></video>
<script src=""></script>





                document.getElementById("file").addEventListener('change', changeFile);
const video = document.getElementById('local-video');
function changeFile(e) {
  const file =[0];
  console.error("file", file);
  const pos ='.');
  let ext = (pos === -1) ? '' :;
  dodo3(file, ext);

async function dodo3(blob, ext) {
  video.muted = false;
  video.autoplay = false;
  video.src = URL.createObjectURL(blob);
  const voice_ranges = [[2,4],[6,8],[10,12],[14,16]];
  console.error("voice_ranges", voice_ranges);
  const blobBuffer = await blob.arrayBuffer();
  console.error("blobBuffer", blobBuffer)
  const inputfilename = 'input' + ext;
  await ffmpeg.FS('writeFile', inputfilename, new Uint8Array(blobBuffer));
  let filelist = "";
  for(let i=0;i<voice_ranges.length;i++){
    const splitfilename = 'output' + i + ext;
//    await'-i', inputfilename, '-ss', sec2time(voice_ranges[i][0]), '-t', sec2time(voice_ranges[i][1] - voice_ranges[i][0]), splitfilename);
    await'-i', inputfilename, '-c', 'copy', '-ss', sec2time(voice_ranges[i][0]), '-t', sec2time(voice_ranges[i][1] - voice_ranges[i][0]), splitfilename);
    filelist += 'file ' + splitfilename + "\n";
  const listfilename = 'list.txt';
  await ffmpeg.FS('writeFile', listfilename, filelist);
  const outputfilename = 'output' + ext;
  await'-f', 'concat', '-i', listfilename, '-c', 'copy', outputfilename);
  const data = ffmpeg.FS('readFile', outputfilename);
  ffmpeg.FS('unlink', inputfilename);
  ffmpeg.FS('unlink', outputfilename);
  video.src = URL.createObjectURL(new Blob([data.buffer]));;

function zeroPadding(NUM, LEN){
	return ( Array(LEN).join('0') + NUM ).slice( -LEN );

function sec2time(sec){
  const hours = Math.floor(sec / 3600);
  sec -= hours * 3600;
  const minutes = Math.floor(sec / 60);
  sec -= minutes * 60;
  const seconds = Math.floor(sec);
  const millseconds = Math.floor(1000 * (sec - seconds));
  return zeroPadding(hours, 2)+":"+zeroPadding(minutes, 2)+":"+zeroPadding(seconds, 2)+"."+zeroPadding(millseconds, 3)

(async () => {
  const { createFFmpeg } = FFmpeg;
  window.ffmpeg = createFFmpeg({ log: true });
  await ffmpeg.load();
  console.error("ffmpeg loaded");