Skip to content

Instantly share code, notes, and snippets.

@marc-hanheide
Last active November 15, 2023 06:53
Show Gist options
  • Save marc-hanheide/7b3557f487f1353b2b7c to your computer and use it in GitHub Desktop.
Save marc-hanheide/7b3557f487f1353b2b7c to your computer and use it in GitHub Desktop.
VLC screen streaming mjpeg
DISPLAY=:0 cvlc -vvv --no-audio screen:// --screen-fps 1 --sout "#transcode{vcodec=MJPG,vb=800}:standard{access=http,mux=mpjpeg,dst=:18223/}" --sout-http-mime="multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a"
@xtianhb
Copy link

xtianhb commented Jan 26, 2019

Thanks! I've been a lot of time looking for this!

@lazna
Copy link

lazna commented Feb 24, 2021

Using your solution, and its working fine. But when I want saving such stream simultaneously into the file by ffmpeg, it produce errormessage:

[mpjpeg @ 00000270439cdf00] Expected boundary '--' not found, instead found a line of 15 bytes
http://10.12.32.141:1002: Invalid data found when processing input

expect is because of special boundary settings in your vlc-stream.sh. Could you please explain what the 'boundary' string exactly doing?

@marc-hanheide
Copy link
Author

Using your solution, and its working fine. But when I want saving such stream simultaneously into the file by ffmpeg, it produce errormessage:

[mpjpeg @ 00000270439cdf00] Expected boundary '--' not found, instead found a line of 15 bytes
http://10.12.32.141:1002: Invalid data found when processing input

expect is because of special boundary settings in your vlc-stream.sh. Could you please explain what the 'boundary' string exactly doing?

I think that's not what it's for... This really was designed to provide the right format to stream directly into an <img> element, with the "boundary" separating different jpg frames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment