Display Video Stream From Display Connected to OctoPi


I have an OctoPi set up and running an new Raspberry Pi 3B+. Its running the printer well and successfully serving the webcam's video feed over my local network. What I would like to do is to add a small video display to the OctoPi that would display the video feed. I do not want to run any user interface from the display. I simply want the display to turn on and start displaying the video feed when ever I turn the OctoPi on. The video feed over the local network would continue as before.

Does the OctoPi distro include an application that would display the video stream to a physically attached display? Can mjpg-streamer handle this? Do an I need another application like OMXPlayer for this?

I've got…
Version 0.15.1, running on Raspberry Pi 3 Model B Plus Rev 1.3

Thanks for your input!


There's nothing built-in which would stream that to a local monitor (to include an LCD/TFT). OctoPrint technically doesn't include the webcam support; that's part of the OctoPi image that Guy maintains using the mjpg_streamer functionality.

That said, there's nothing that would prevent you from adding a local LCD/TFT screen to your Raspberry to display that to it.

Read the Overview section here to get a feel for how this would work. Instead of using the URL for http://octopi.local at the end, instead you'd use http://octopi.local:8080/?action=stream.


@OutsourcedGuru, thanks for the leads. I got some reading to do!


@OutsourcedGuru, I think I followed your lead, only I'm trying to use mplayer instead of Chromium. Its working - kinda. Read below for a long winded writeup of where I am and what's still not working. I hope I haven't steered too far off topic for the OctoPi forum.

Here’s My Problem
Mplayer takes a very long time to start displaying a video stream on a PiTFT display. What can I do to have Mplayer start the display of the video stream on the PiTFT promptly and reliably?

My Goal
I have a Raspberry Pi that functions as an OctoPi 3D printer server. One of its functions that it currently does very well is provide a live video stream, from an attached usb webcam, over my local network, so I can moniter the 3D printer remotely. I want to add the ability to have the live video stream also display from a small PiTFT display attached to the Raspberry Pi using Mplayer.

What I’ve Accomplished So Far
I successfully added the PiTFT display and installed Mplayer. I’ve been able to play a video saved on the Raspberry Pi on the PiTFT display very nicely. I have partly succeeded in having mplayer display the streaming video generated by mpg-streamer on the PiTFT. The video starts on the PiTFT eventually, but only after a long delay.

Hardware/Software Specs
Running Linux octopi 4.14.34-v7+.
The Raspberry Pi 3 B+ with an Adafruit 2.2" PiTFT HAT display attached.
I do not have an HDMI display, I use ssh over a local network to interface with the device.
From the Raspberry Pi, mjpg-streamer is generating a video stream from an attached usb webcam. From other computers on the local network I can view the video streaming from the webcam through a web browser pointed to http://octopi.local/webcam/?action=stream.

After I power up the Raspberry Pi, jpg-streamer immediately starts serving up a live video stream available over the local network.
After I launch mplayer via command line over ssh, mplayer is eventually able to display the video stream on the attached PiTFT display. However, there is always a long delay from the time the command is given and the time the video starts on the PiTFT - always several minutes, sometimes an hour or more. I have not noticed any consistency in the delay because often get tiered of waiting, walk away from the device to do something else, and return to find the video running.

Console input and output

pi@octopi:~ $ mplayer -vo fbdev -vf scale=320:240 -framedrop -ao null -msgcolor -prefer-ipv4 -nolirc http://octopi.local:8080/?action=stream
MPlayer 1.3.0 (Debian), built with gcc-6.2.1 (C) 2000-2016 MPlayer Team
Playing http://octopi.local:8080/?action=stream.
Resolving octopi.local for AF_INET...
Connecting to server octopi.local[]: 8080...
Cache size set to 320 KBytes
Cache fill: 0.00% (0 bytes)
libavformat version 57.56.101 (external)
Mismatching header version 57.56.100
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]

Many, many more lines like this…

Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Stream not seekable!
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
libavformat file format detected.
Stream not seekable!
[mjpeg @ 0x75ef6978]Found EOI before any SOF, ignoring
[lavf] stream 0: video (mjpeg), -vid 0
VIDEO: [MJPG] 640x480 0bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s)
Opening video filter: [scale w=320 h=240]
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.64.101 (external)
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG)
Audio: no sound
Starting playback...
[mjpeg @ 0x75ef6978]Found EOI before any SOF, ignoring
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x76905418]bicubic scaler, from yuv422p to bgra using C
VO: [fbdev] 320x240 => 320x240 BGRA
Movie-Aspect is undefined - no prescaling applied.
VO: [fbdev] 320x240 => 320x240 BGRA
V:2177.3 0/ 0 28% 54% 0.0% 0 0 1%

And then the video starts on the PiFTF display.

Some Mplayer Options I have Tried Without Effect
-cache 1024
-cashe-min 50


If it were me, I would temporarily de-couple all this into two Raspberry Pi computers. One would serve up OctoPrint and have the standard mjpg_streamer service running from the OctoPi image. The second would get the TFT screen and would just do what you've done to display it as before.

If it still has the same startup delay then the problem is with Mplayer. If it's now faster/better then it sounds like you were earlier overburdening the original Pi (you'd probably want to keep this setup but revert the serving Pi back to vanilla OctoPi without the PIXEL/Desktop).