Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Nahuel Taibo
    @nahueltaibo
    Im thinking to use this awesome library to stream in realtime the rpi camera to an html5 video tag.. would this be ok?
    <video width="640" height="480" controls>
    <source src="/api/video" type="video/mp4">
    Your browser does not support the video tag.
    </video>
    and on the controller...
    [HttpGet]
    public async Task<FileStreamResult> Get()
    {
            MMALCamera cam = MMALCamera.Instance;
    
            //using (var vidCaptureHandler = new VideoStreamCaptureHandler("/home/pi/videos/", "h264"))
            using (var vidCaptureHandler = new MemoryStreamCaptureHandler())
            {
                var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
    
    
    
    
                //var urlBlob = "/dev/video";
                //var urlBlob = "https://localhost/feed.mp4";
                var urlBlob = "https://anthonygiretti.blob.core.windows.net/videos/earth.mp4";
    
                //var stream = await _client.GetStreamAsync(urlBlob);
    
                var stream = vidCaptureHandler.CurrentStream;
    
                // Take video for 3 minutes.
                await cam.TakeVideo(vidCaptureHandler, cts.Token);
            }
    
            // Only call when you no longer require the camera, i.e. on app shutdown.
            cam.Cleanup();
    
            return new FileStreamResult(stream, "video/mp4");
        }
    urlBlob is just old code from a previous test, so not used
    Ian Auty
    @techyian
    Hi, I would recommend using a protocol such as RTMP to stream your video feed. Essentially you'd setup an RTMP server to process the video stream from your Pi, and then use a javascript client such as Flowplayer (https://demos.flowplayer.com/basics/rtmp.html) to display the stream.
    There is an example in the wiki explaining how to use RTMP with MMALSharp (https://github.com/techyian/MMALSharp/wiki/Advanced-Examples#RTMP-Streaming). You need to install ffmpeg from source and include the H.264 codec support; this blog post explains how to do this: http://jollejolles.com/installing-ffmpeg-with-h264-support-on-raspberry-pi/
    Hope that helps
    Let me know if you have any issues getting set up
    In regards to the RTMP server, I have used Nginx RTMP server with success in the past: https://github.com/arut/nginx-rtmp-module/wiki/Getting-started-with-nginx-rtmp
    Nahuel Taibo
    @nahueltaibo
    The issue is that RTMP is not supported by modern browsers out of the box (you need flash to play it). I
    I am working on a DIY smart doorbell, based on net core, so the raspberry pi would host a net core website, that should stream the rpi camera when a button is pressed (and in the long run, when motion is detected too)
    but for that I need a way to send the video to the client within the html page he opens
    makes no sense to open a different tool, to stream the video