This example shows how to start live streaming. It also gives pointers how to display the live stream using ffmpeg, ffplay, and other tools. Note: the Camera Controller app has to stay active to keep the stream up (the script editor can be closed).
// Use the currently connected camera: var connectResult = connectToCamera(); if (connectResult.ok) { var cameraName = connectResult.message; // Uncomment this line to stop live streaming: //stopLiveVideostream(cameraName); // Tell the camera to start live streaming var result = startLiveVideostream(cameraName); if (!result.ok) { logMessage("Streaming start error"); } else { /* * Now the live stream can be viewed using tools like ffmpeg, ffplay, VLC, etc. * Here are some example commands: * // Forward the camera stream: * ffmpeg -f mpegts -i "udp://10.5.5.101:8554?fifo_size=10000" -f mpegts -vcodec copy udp://localhost:1000 * * // Play the stream directly with ffplay: * ffplay -f mpegts -i "udp://10.5.5.101:8554?fifo_size=10000" * * // Forward the stream to YouTube Live: * ffmpeg -f mpegts -i "udp://10.5.5.101:8554?fifo_size=10000" -f flv -acodec aac "rtmp://x.rtmp.youtube.com/live2/<your YouTube Live key>" */ } } else logMessage("No camera found");