Bod has asked for the wisdom of the Perl Monks concerning the following question:

Can you give any recommendations for a Perl video streaming module?
Usually, I would ask Google but all I get are video tutorials for learning Perl.

Here is what I am vaguely thinking of doing in case anyone can offer any specific help.

We have a bluetit nesting in our new birdbox. Being above the back door, it cannot be seen from inside the house and we thought it would be nice to be able to observe its comings and going. Nice for us, perhaps not so much for the bluetits. So, I've bought a WiFi camera, built a little box for it and set it up opposite the birdbox. It works OK but the only way to use the camera is to use the mobile app. I thought it might be nice to be able to do something else with the stream, perhaps monitor it for movement or display it on a bigger screen.

So I thought about trying to capture the video stream using a Perl script on a computer permanently hooked up to the network. Once I've got the stream, it should be relatively trivial to do whatever I want with it.

The other thing I need to do is power the camera with a solar panel instead of having to bring it inside to charge every few hours.

Any suggestions appreciated although this is nothing more than a fun project...perhaps better labelled as a means to procrastination!

Replies are listed 'Best First'.
Re: Video streaming module
by kcott (Archbishop) on Apr 20, 2022 at 02:18 UTC

    G'day Bod,

    I'm certainly no expert on the subject but I have used "OBS - Open Broadcaster Software" (at basic user level only). This might be suitable for the streaming side of your project.

    A "CPAN search for OBS" indicates a number of modules that might be useful for your Perl needs.

    Anyway, those are just suggestions. Others may have much better ideas.

    — Ken

Re: Video streaming module
by Corion (Patriarch) on Apr 20, 2022 at 08:16 UTC

    I found ffmpeg quite good for producing/capturing video streams. Depending on the Wifi camera, it most likely produces an RTSP stream, and ffmpeg can record these to disk (for later viewing or re-encoding):

    ffmpeg -i rtsp://@192.168.241.1:62159 -r 15 C:/DB_Videos/2013-04-30 17 +_18_34.703.mp4
    ffmpeg -i rtsp://@192.168.241.1:62156 -acodec copy -vcodec copy c:/abc +.mp4

    I haven't found any good abstraction for ffmpeg on CPAN yet, and my attempts haven't crystallized into anything worthwhile yet either.

      Not really an abstraction for ffmpeg, but a bit of PDL that can interface with it: PDL::IO::Pic. I can envision (ha!) additional functionality for the rmpeg function that could interface to a stream (obviously relying largely on ffmpeg capability). Today, that's a synchronous read rather than a stream.

      What do people think would some sample (maybe pseudo-)code look like that would solve this? I anticipate a write-stream as well, but don't want to bias people's thinking.

      I wrote VideoLAN::LibVLC which could do the job but the portions I implemented are more focused on playback.

      An API for ffmpeg would most likely be named "libav".

Re: Video streaming module
by soonix (Chancellor) on Apr 20, 2022 at 07:49 UTC
    From the link you provided, I see that the camera opens up its own WIFI network. If it can't be attached to an existing WLAN, you might need an additional device to bridge between the camera's WLAN and your "normal" network, or a "dual homed" streaming server. Pertinent modules for that might be Win32::Netsh::Wlan and/or Win32::Wlan.

      The camera opens its own WiFi network so the app can connect to it and configure it. As part of that configuration, the camera is added to the same WiFi network as the mobile device was on before switching to the camera WiFi.

      Once configured, the camera uses the house WiFi network.

        Ah. Sounds easy to configure. One of the commenters seemed to have difficulties anyway :-) - Are there provisions to change the WIFI password, or connect to a different WIFI?
Re: Video streaming module
by cavac (Prior) on Apr 22, 2022 at 08:16 UTC