Kagami / ffmpeg.js

Port of FFmpeg with Emscripten
Other
3.29k stars 335 forks source link

create video from jpeg ipcam snapshot #179

Open realrecordzLab opened 2 years ago

realrecordzLab commented 2 years ago

I have this code from node-onvif library. It will take a jpeg snapshot from the selected ip cam stream. I need to convert snapshots into a video and then stream it to the moblie app made using capacitor.js framework. Will be this possible using this library? I'm looking to issues and examples but not sure what I need to use. I only need video and no audio.

device.init().then(() => {
  // Get the data of the snapshot
  console.log('fetching the data of the snapshot...');
  return device.fetchSnapshot();
}).then((res) => {
  // Save the data to a file
  fs.writeFileSync('snapshot.jpg', res.body, {encoding: 'binary'});
  console.log('Done!');
}).catch((error) => {
  console.error(error);
});

At the moment I'm pasing the returned jpeg object from the ipcam directly to the front end but it's a bit inefficient.