Published
Edited
Nov 25, 2020
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
output = processFile(f ? f : await FileAttachment("mv.mp4").blob())
Insert cell
processFile = async file => {
if (file) {
const getSize = () => file.size;
const readChunk = (chunkSize, offset) =>
new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = event => {
if (event.target.error) {
reject(event.target.error);
}
resolve(new Uint8Array(event.target.result));
};
reader.readAsArrayBuffer(file.slice(offset, offset + chunkSize));
});
return mediainfo.analyzeData(getSize, readChunk);
}
}
Insert cell
format = "object" // object, JSON, XML, HTML or text
Insert cell
mediainfo = {
const MediaInfo = await require("mediainfo.js@0.1.4/dist/mediainfo.min.js");
return new Promise((resolve, reject) =>
MediaInfo(
{
format: format,
locateFile: () =>
"https://cdn.jsdelivr.net/npm/mediainfo.js@0.1.4/dist/MediaInfoModule.wasm"
},
resolve,
reject
)
);
}
Insert cell
import { table } from "@tmcw/tables/2"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more