Capture Video Frames And Convert Them To Images - jQuery videoCapture

File Size: 24 KB
Views Total: 388
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Capture Video Frames And Convert Them To Images - jQuery videoCapture

videoCapture is a tiny and easy-to-use jQuery plugin that provides a way to programmatically capture video frames and convert them to Base64 image data.

Can be used to generate video previews or thumbnails by capturing images at regular intervals, or to extract key frames from videos for further analysis or machine learning model training.

How to use it:

1. Download and include the videoCapture.js script after jQuery.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/videoCapture.js"></script>

2. Initialize the videoCapture and specify the path to the video.

$.videoCapture({
  video: "/path/to/video.mp4",
  second: 3, // at the third second
});

3. Save the image as Base64 encoded strings.

$.videoCapture({
  video: "/path/to/video.mp4",
  second: 3,
  success: img => {
    console.log("Video converted")
      console.info(img)
  },
});

4. Specify the image format: PNG or JPG.

$.videoCapture({
  video: "/path/to/video.mp4",
  second: 3,
  success: img => {
    console.log("Video converted")
      console.info(img)
  },
  format: "jpeg",
});

5. More callback functions.

$.videoCapture({
  video: "/path/to/video.mp4",
  second: 3,
  success: img => {
    console.log("Video converted")
      console.info(img)
  },
  format: "jpeg",
  loading: () => {},
  failed: error  => {},
});

This awesome jQuery plugin is developed by salarizadi. For more Advanced Usages, please check the demo page or visit the official website.