-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: mjpeg streaming for terminal control background #6242
Conversation
New misspellings found, please review:
To accept these changes, run the following commands
✏️ Contributor please read this
See the
|
You're going to want to rebase and push before you take advice from the bot, otherwise you're going to hit a conflict. The conflicts shouldn't be hard to resolve |
New misspellings found, please review:
To accept these changes, run the following commands
✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The :check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉
|
New misspellings found, please review:
To accept these changes, run the following commands
✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The :check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉
|
This is quite interesting. A few quick reads on it:
I want to discuss this with @zadjii-msft and @DHowett before going much further forward on this. |
Thanks for taking a look.
I can think of a few ways to deal with it but they increase the scope of the PR and the original intent was to see if this feature was likely to be accepted before adding extras. If it was a blocker I could fix it. Solutions off the top of my head (in increasing order of scope creep):
I don't think the shunting idea would be ideal. Displaying the same mjpeg feed in multiple panes doesn't seem that useful and could get annoying depending on the feed.
If there is such a property I've never found it and if it does exist I'd love to hear about it. I have a demo VoIP softphone application that's been floating around for years and I've always updated the video stream using the exact same approach of setting a bitmap image source.
This PR goes further than streaming an mp4 or other static content (which can already be achieved with the existing MediaPlayElement) and allows the streaming of live content. The simplest live content is mjpeg but if that was incorporated and useful then it could be the initial step in VoIP, WebRTC and other live streaming sources.
Yes same, hence the header comments. It's always a quandary when "leveraging" existing source code. I do think in this case the scope of the changes I've made to the various ffmpeg source blocks make the |
@DHowett Has there been any progress for the legal aspects of this PR? I'd love to start using this. |
Hey, sorry it's been like half a year since we took a look at this. We discussed this a bit as a team recently. The consensus was that as neat as this feature is, we're not really comfortable shipping it directly in the Terminal. It probably makes the most sense as an extension (#4000), but we're not confident that we could support this adequately in the Terminal itself. I've added this to the mega list of extension ideas in #4000. We'll make sure to keep this PR in mind when we do get to extensions, because it's a GREAT example of something that developers should be able to do. Sorry again for leaving you on Read for so long! |
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).
To test out the feature the steps are:
backgroundImage
to a file path with;mjpeg:1234
appended. The1234
represents a loopback port that the mjpeg receiving socket will listen on. For example:"backgroundImage": "C:/Users/aaron/Pictures/gravatar_400x400.png;mjpeg:10010"
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:
backgroundImage
setting will not be able to create a listening socket.