This service adds some extra flags to ffmpeg so it won't spam the logs with all the debug info that was dumped to your console when testing it above. Again, the User= line may need to be adjusted. Second, create /etc/systemd/system/rvice with these contents. ĭescription=FFMPEG streaming server service This will work fine for a default Pi install, but may need to be tuned for your setup. Note that the User= line specifies the user to run ffserver as. I set up two systemd services to automatically run ffserver and ffmpeg.įirst, create /etc/systemd/system/rvice with these contents. Running automatically at startupĪgain, if you've got mjpg-streamer configured to run at boot, this is the part where you make sure that's been disabled before continuing. I'm running ffmpeg to get video from the first attached webcam with this command: ffmpeg -input_format mjpeg -video_size 640x480 -framerate 5 -i /dev/video0 -c:v copy You can check everything's working by browsing to to view the 5fps live stream. Then run the server (as a background process so we can keep using this session) with: ffserver & Create it with these contents # ffserver configuration for an mjpeg stream The ffserver configuration file is located at /etc/nf. It's important to make sure mjpg-streamer is stopped before trying this. We're setting up ffserver to use the same port as the default mjpg-streamer port. Second, an ffmpeg process is launched that pulls video from the webcam and feeds it to ffserver. First, an ffserver process is run that sets up the actual streaming server, which serves an mjpeg stream and static jpg images. On the other hand, now that I know how easy this is to get running, my next step is to look in to replacing the mjpeg stream with a low bitrate h264 stream, to take advantage of the hardware encoder on the Pi. But on older Pis this extra load may be a problem. I've had no problems running this setup for a few prints around 1.5-2 hours each. On my Raspberry Pi 3B+ running a USB webcam (Logitech C920), ffmpeg is consuming ~20% CPU, and pushes the load average up around 0.2-0.3. This method will likely involve some transcoding, so I expect it to be more CPU-intensive than mjpg-streamer. If you've successfully installed OctoPrint following, then you'll be fine. It expects a basic knowledge of Linux - how to create and edit text files, and how to run commands. This guide explains how I set up ffmpeg as a drop-in replacement for mjpeg-streamer. So I did a little reading and figured out how to set up a streaming mjpeg server using tools I already had installed on my Pi - ffmpeg. I'd been wanting to add a webcam to my OctoPrint setup for a little while now, but I'm a professional sysadmin (ie, really, really lazy), and having to build and install mjpg-streamer manually just did not appeal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |