[PR #6242] Feature: mjpeg streaming for terminal control background #26620

Closed
opened 2026-01-31 09:17:10 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6242

State: closed
Merged: No


This PR adds a rudimentary mjpeg receiver to allow the terminal control background to display a stream.

Update:

Motivation for this feature

The example screenshots and video are a little bit gimmicky but there could be some very useful scenarios for the ability to employ an information rich terminal background:

  • Network monitoring tools could cause the background to display results, e.g. a ping could cause a host in a network map to change colour,

  • Quick video calls (my own goal). For developers who spend a lot of time in a console it's advantageous to avoid context switches to other applications for minor tasks. If a quick video call could be done "in-terminal" that could be a small efficiency gain,

  • Infrequent graphical notifications. A video stream of 1 frame/second or less could be used to show notifications for configurable events. Again this could be a context switch saving for people that permanently have a terminal open. GitHub notifications would be a good use case. I do 90% of my git interactions from the command line. If the results of commit CI jobs were automatically displayed in the terminal background (that I keep open solely for git interactions) it could save me reading an email and visiting a web page.

It's perhaps easier to illustrate than to explain. The two screenshots below show stills of two different streams. Small mp4 captures are here and here (the second one's a bit spooky).

terminal_mjpeg_test_pattern

terminal_mjpeg_max

To test out the feature the steps are:

  • Set the backgroundImage to a file path with ;mjpeg:1234 appended. The 1234 represents a loopback port that the mjpeg receiving socket will listen on. For example:

"backgroundImage": "C:/Users/aaron/Pictures/gravatar_400x400.png;mjpeg:10010"

  • Start a source stream to the listening port. For example:

ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=10 -vf "drawtext=fontfile=/Windows/Fonts/arial.ttf: expansion=normal: text='%{localtime}': r=25: x=1100: y=50: fontcolor=black" -vcodec mjpeg -pix_fmt yuvj420p -huffman 0 -f rtp rtp://127.0.0.1:10010

Known Issues:

  • Only one terminal control can listen on a port at a time so starting a second terminal with the same backgroundImage setting will not be able to create a listening socket.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6242 **State:** closed **Merged:** No --- This PR adds a rudimentary mjpeg receiver to allow the terminal control background to display a stream. **Update:** Motivation for this feature The example screenshots and video are a little bit gimmicky but there could be some very useful scenarios for the ability to employ an information rich terminal background: - Network monitoring tools could cause the background to display results, e.g. a ping could cause a host in a network map to change colour, - Quick video calls (my own goal). For developers who spend a lot of time in a console it's advantageous to avoid context switches to other applications for minor tasks. If a quick video call could be done "in-terminal" that could be a small efficiency gain, - Infrequent graphical notifications. A video stream of 1 frame/second or less could be used to show notifications for configurable events. Again this could be a context switch saving for people that permanently have a terminal open. GitHub notifications would be a good use case. I do 90% of my git interactions from the command line. If the results of commit CI jobs were automatically displayed in the terminal background (that I keep open solely for git interactions) it could save me reading an email and visiting a web page. It's perhaps easier to illustrate than to explain. The two screenshots below show stills of two different streams. Small mp4 captures are [here](https://github.com/sipsorcery/sipsorcery-mediafiles/raw/master/terminal/terminal_mjpeg1.mp4) and [here](https://github.com/sipsorcery/sipsorcery-mediafiles/raw/master/terminal/terminal_mjpeg2.mp4) (the second one's a bit spooky). ![terminal_mjpeg_test_pattern](https://user-images.githubusercontent.com/197660/83198189-9fd40680-a136-11ea-9f83-1cbaf2a88446.png) ![terminal_mjpeg_max](https://user-images.githubusercontent.com/197660/83198191-a2366080-a136-11ea-9f51-faa5568c8fd7.png) To test out the feature the steps are: - Set the `backgroundImage` to a file path with `;mjpeg:1234` appended. The `1234` represents a loopback port that the mjpeg receiving socket will listen on. For example: `"backgroundImage": "C:/Users/aaron/Pictures/gravatar_400x400.png;mjpeg:10010"` - Start a source stream to the listening port. For example: `ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=10 -vf "drawtext=fontfile=/Windows/Fonts/arial.ttf: expansion=normal: text='%{localtime}': r=25: x=1100: y=50: fontcolor=black" -vcodec mjpeg -pix_fmt yuvj420p -huffman 0 -f rtp rtp://127.0.0.1:10010` Known Issues: - Only one terminal control can listen on a port at a time so starting a second terminal with the same `backgroundImage` setting will not be able to create a listening socket.
claunia added the pull-request label 2026-01-31 09:17:10 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26620