Giter Site home page Giter Site logo

web-capture's Introduction

web-capture

依赖库&编译工具

  • ffmpeg-3.4.8
  • emscripten-2.0.21

支持编码

  • H.264
  • H.265
  • Mpeg2
  • Mpeg4
  • VP8
  • VP9

支持格式

  • Mkv
  • Mov
  • Avi
  • Mp4
  • Webm

注意事项

  • 建议基于 Ubuntu 系统进行编译安装,已知 WindowsMac都会出现各种文件丢失和环境不一致导致的问题

  • 编译前需要下载 ffmpeg-3.4.8.tar.xz 并解压至与 web-capture 同级的目录

  • emsdk 安装目录需要与 web-capture 同级

demo运行

npm install

npm run server

http://localhost:3000/demo/index.html

使用

可以参考 demo/index.html, 示例如下

 window.webCapture.capture(file, timeInput.value * 1000, (dataURL, imageInfo) => {

    const { width, height, duration } = imageInfo;

    resultContainer.innerHTML = `<img src="${dataURL}" />`

    infoContainer.innerHTML = `耗时:${Date.now() - startTime}ms<br>宽度:${width}<br>高度:${height}<br>时长:${duration / 1000000}s`;
})

本地编译

npm run build

通过 npm run build 编译项目,最终产物在 dist 目录下

参考文章

https://www.jianshu.com/p/d08c0cff8a77 https://juejin.im/entry/5afd7963f265da0ba3524439 http://dranger.com/ffmpeg/tutorial01.html https://zhuanlan.zhihu.com/p/40786748 https://blog.csdn.net/shixin_0125/article/details/106937186 https://www.cnblogs.com/renhui/p/6922971.html https://cloud.tencent.com/developer/article/1393972 https://www.jianshu.com/p/3c95b0471d3a

web-capture's People

Contributors

dependabot[bot] avatar jordiwang avatar

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.