internal/mjpeg/README.md
Important. For a stream in MJPEG format, your source MUST contain the MJPEG codec. If your stream has the MJPEG codec, you can receive an MJPEG stream or JPEG snapshots via the API.
You can receive an MJPEG stream in several ways:
With this example, your stream will have both H264 and MJPEG codecs:
streams:
camera1:
- rtsp://rtsp:[email protected]/av_stream/ch0
- ffmpeg:camera1#video=mjpeg
Output a stream in MJPEG format. In FFmpeg, this format is called mpjpeg because it contains HTTP headers.
ffplay http://192.168.1.123:1984/api/stream.mjpeg?src=camera1
Receiving a JPEG snapshot.
curl http://192.168.1.123:1984/api/frame.jpeg?src=camera1
width/w and/or height/h parameters.rotate param with 90, 180, 270 or -90 values.hardware/hw param read more.cache param (1m, 10s, etc.) to get a cached snapshot.
cache parameter.cache parameter.cache parameter does not check the image dimensions from the cache and those specified in the query.Stream as ASCII to Terminal. This format is just for fun. You can boast to your friends that you can stream cameras even to the server console without a GUI.
The demo video features a combination of several settings for this format with added audio. Of course, the format doesn't support audio out of the box.
Tips
text parametergo2rtc.yaml - transcoding to MJPEG, terminal size - 210x59 (16/9), fps - 10
streams:
gamazda: ffmpeg:gamazda.mp4#video=mjpeg#hardware#width=210#height=59#raw=-r 10
API params
color - foreground color, values: empty, 8, 256, rgb, SGR
30 (black), 37 (white), 38;5;226 (yellow)back - background color, values: empty, 8, 256, rgb, SGR
40 (black), 47 (white), 48;5;226 (yellow)text - character set, values: empty, one character, block, list of chars (in order of brightness)
%20 (space), block (keyword for block elements), ox (two chars)Examples
% curl "http://192.168.1.123:1984/api/stream.ascii?src=gamazda"
% curl "http://192.168.1.123:1984/api/stream.ascii?src=gamazda&color=256"
% curl "http://192.168.1.123:1984/api/stream.ascii?src=gamazda&back=256&text=%20"
% curl "http://192.168.1.123:1984/api/stream.ascii?src=gamazda&back=8&text=%20%20"
% curl "http://192.168.1.123:1984/api/stream.ascii?src=gamazda&text=helloworld"
Raw YUV frame stream with YUV4MPEG header.
ffplay http://192.168.1.123:1984/api/stream.y4m?src=camera1
ffmpeg -re -i BigBuckBunny.mp4 -c mjpeg -f mpjpeg http://localhost:1984/api/stream.mjpeg?dst=camera1