'How to stream the desktop using FFMPEG , and set the output to http://127.0.0.1:8080

i am trying to use FFMPEG on windows to stream my entire desktop, through my localhost address : 127.0.0.1:8080 , and it will be accessible from another computer in the same network , using vlc by opening network url, or embed it in a source video file for exemple. i tried the commande here :

ffmpeg -f gdigrab -framerate 6 -i desktop output.mp4  

but this record the entire desktop (what i want to do) and store it in ouput.mp4 file , i tried changing it to :

    ffmpeg -f gdigrab -framerate 6 -i desktop http://127.0.0.1:8080

but i get this error :

[gdigrab @ 0000023b7ee4e540] Capturing whole desktop as 1920x1080x32 at (0,0) [gdigrab @ 0000023b7ee4e540] Stream #0: not enough frames to estimate rate; consider increasing probesize Input #0, gdigrab, from 'desktop': Duration: N/A, start: 1625841636.774340, bitrate: 398133 kb/s Stream #0:0: Video: bmp, bgra, 1920x1080, 398133 kb/s, 6 fps, 1000k tbr, 1000k tbn [NULL @ 0000023b7ee506c0] Unable to find a suitable output format for 'http://127.0.0.1:8080' http://127.0.0.1:8080: Invalid argument

but i want to set the output as : http://127.0.0.1:8080 how should i do that ?

Update : I found this command :

ffmpeg -f gdigrab -framerate 30 -i desktop -vcodec mpeg4 -q 12 -f mpegts http://127.0.0.1:8080

it seems to stream, but i am not able to open it from nor vlc nor media player



Solution 1:[1]

I used instead HLS for HTTP Live Stream with ffmpeg, for recording screen and store .ts and .m3u8 files in a folder in the local machine. And then self host the application (specify the root directory) using NancyServer, pointing to the .m3u8 file. Each time the local machine start streaming, the folder will be cleared.

Solution 2:[2]

Adapted from this helpful post, I was able to share my desktop of my server Win10 machine to my client Win10 machine.

Win10 machine stream/server:

ffmpeg -f gdigrab -framerate 60 -i desktop -vcodec mpeg4 -q 12 -f mpegts udp://20.20.5.5:6666

Win10 machine play/client:

ffplay -f mpegts udp://127.0.0.1:6666

My Win10 machine that is streaming/server ip address is 20.20.5.111 while the Win10 machine that is recieving/playing/client is 20.20.5.5.

As mentioned from another post, using localhost/127.0.0.1 was the way to get the client to stream the video.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 kyrlon