Generic FFMPEG implementation / stream other video sources

  • Getting alexa to play video thats not from a paid service is a pain. You have to open a web browser on the Show, then navigate to some streaming website.

    User’s like myself have content on our local network, and some even have a HD Homerun for streaming live TV over LAN.

    Anyways, I would love to setup a “fake” camera, named Discovery channel, that points to an HD homerun feed for the Discovery channel. Or a “fake” camera named Seinfeld that starts a randomized playlist of Seinfeld videos on my computer.

    With FFmpeg, someone with some scripting abilities could make this happen but I don’t know what format monocle might expect. I don’t think RTSP is possible with FFMPEG alone, but maybe it is possible with FFServer? Alternatively, I believe an RTSP stream from VLC, or emby/plex may be possible.

    Hopefully you see where I’m going with all of this. The live cameras are great, but arbitrary video from anywhere would be so sweeeet.

  • So I figured out how to get a rtsp server running via VLC where monocle successfully displays Live TV from my HD homerun. Unfortunately, this solution requires the VLC rtsp server running all the time. I really only want it to run when monocle receives the request, then I’d like it to stop when playback stops.

    I’m requesting that a beforeLiveStreamStart command line hook could be added, and also I’m not sure if the onLiveStreamEnd hook is possible. If it’s not, no big deal, I can just kill the rtsp server after an hour or so.

    I would also be willing to help by submitting a pull request if the source is on github.

    Anyways, for those who want to know, here’s how I created the rtsp transcoding server. FWIW, this method should work on unsupported IP cameras, and arbitrary video files if the beforeLiveStreamStart hook was added.

    vlc -vvv --sout-avcodec-strict=-2 --sout '#transcode{venc=x264{preset=ultrafast},vcodec=h264,vb=1800,acodec=aac,ab=128,samplerate=48000}:rtp{sdp=rtsp://}'

    To explain the above, the bit is my live TV HDHomerun address, that you could sub for an unsupported camera feed or a local video path, and the rtsp:// bit is the local rtsp server address, where is the local IP of the computer running VLC.

    Anyways, I’m looking forward to hearing from the devs about the possibilty of a pre-stream CLI hook 🙂


  • So I wrote a simple script to tail the log and watch for the start/stop events and run my own rtsp server. But since the server isn’t running when I initiate the command, it fails 😞

    So, tailing logs won’t work. Is the monocle-proxy open sourced anywhere so I can alter it for my personal use?

  • @jed

    Hi ,

    Monocle Gateway is not currently open sourced. However, I’m willing to work with you to include some hooks or APIs that can allow you to “know” when a stream is requested and when it is disconnected. We will need to hash out some details on the best way to make this work. Currently the only way to know when a stream is no longer in use is by the TCP disconnect from the Alexa/FireTV devices. So this means someone may need to track how many connections are active/live before shutting down your RTSP server/stream.

    Thanks, Robert

  • @Monocle

    Hey Robert,

    Thanks so much for the reply. I don’t really need a stream end command as much as I would really need is a beforeStreamStarts command line option.

    If the software could call a CLI entry and pass the camera name to it, then wait for a return value before it connects to the rtsp stream, I can use that CLI entry to start my own rtsp server.

    I think doing so would open up a wealth of options for people to make their own video sources.

    Thanks again and I just sent a donation to the project, it’s really great

  • Hey Robert,

    Is this in the forecast at all? FWIW, I’m still very interested.


Log in to reply