Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. const { StreamCamera, Codec } = require("pi-camera-connect");
  2. var avconv = require('avconv');
  3.  
  4. const streamCamera = new StreamCamera({
  5. codec: Codec.H264
  6. });
  7.  
  8. const runApp = async () => {
  9.  
  10. const videoStream = streamCamera.createStream();
  11. await streamCamera.startCapture();
  12.  
  13. var URL = "HIDDEN_URL";
  14.  
  15. var params = [
  16. '-i', 'pipe:0', // Tell avconv to expect an input stream (via its stdin)
  17. '-f', 'flv',
  18. '-strict', 'experimental',
  19. URL
  20. ];
  21.  
  22. var process = avconv(params);
  23.  
  24. process.on('error', function(data) {
  25. console.log("Stream Error", data.toString());
  26. });
  27.  
  28. process.on('data', function(data) {
  29. console.log("Stream data", data.toString());
  30. });
  31.  
  32. process.once('exit', function(exitCode, signal, metadata) {
  33. console.log("Stream Exit", exitCode.toString());
  34. });
  35.  
  36. process.on('progress', function(progress) {
  37. console.log("Stream progress", progress.toString());
  38. });
  39.  
  40. videoStream.pipe(process);
  41.  
  42. }
  43.  
  44. runApp();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement