MJPEG

Sometimes called MJPG.

Demo RTP streams:

  • http://173.14.66.201/anony/mjpg.cgi Northgate Launder Land

  • list TTrix

  • http://cam.butovonet.ru/mjpg/video.mjpg

  • http://user:allesfrisch.99@62.68.193.82:8002/mjpg/video.mjpg

  • http://gccvideo.dynalias.com/mjpg/video.mjpg?camera=1

  • http://80.32.204.149:8080/mjpg/video.mjpg?camera=1

  • http://195.67.26.73/mjpg/video.mjpg?camera=1

  • http://96.10.1.168/view/view.shtml?id=1149614&imagepath=%2Fmjpg%2F1%2Fvideo.mjpg&size=1

Used by IP cameras, Digital cameras

File storage:

No official container. Non official can be AVI or MOV based where frame data is a JPEG file Each frames start with 0xffd8ff (JPEG magick number)

A single frame of MJPEG video may or may not contain the associated JPEG Huffman tables. For QuickTime formats, Apple has defined two types of coding: MJPEG-A and MJPEG-B. MJPEG-B no longer retains valid JPEG Interchange Files An other way is to store as HTTP stream without first headers (before first boundary) see https://github.com/waveform80/picamera/issues/335 An other way is to store all JPEG frames concatenated in one file

HTTP stream (multipart message):

Content-Type: multipart/x-mixed-replace;boundary=xxboundaryxx

--xxboundaryxx

Content-Type: image/jpeg
Content-Length: 1000

JIFFdata..frame1.1000

--xxboundaryxx

Content-Type: image/jpeg
Content-Length: 1000

JIFFdata..frame2.1000

--xxboundaryxx

Additional headers can be used to discard browser cache:

Connection: keep-alive
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

See also

Tools and libs

From VLC sources:

  • VLC_CODEC_MJPG and MFVideoFormat_MJPG

  • https://github.com/videolan/vlc/blob/fbaa27ae2d7fcf5ccee7f0ca424ec0cc5bf01f4c/modules/access/v4l2/linux/videodev2.h#L580

  • https://github.com/videolan/vlc/blob/fbaa27ae2d7fcf5ccee7f0ca424ec0cc5bf01f4c/modules/demux/mjpeg.c

  • https://github.com/videolan/vlc/blob/fbaa27ae2d7fcf5ccee7f0ca424ec0cc5bf01f4c/modules/mux/mpjpeg.c

  • https://github.com/videolan/vlc/blob/7f4fa0414e6421fef7ac884f7a28ef0bbc03e956/modules/demux/mkv/matroska_segment_parse.cpp#L1421-L1423

  • https://github.com/videolan/vlc/blob/46b6e7af7640bc827a37c482948cf8de7034b57c/modules/mux/mp4/libmp4mux.c#L1116

  • https://github.com/videolan/vlc/blob/fb9ba9cbb37a56b7e4ee401d50380cfb3d6dca2e/modules/demux/mp4/essetup.c#L531-L533

  • https://github.com/videolan/vlc/blob/fbaa27ae2d7fcf5ccee7f0ca424ec0cc5bf01f4c/modules/mux/ogg.c#L396

  • https://github.com/videolan/vlc/blob/df5663381bb7b54dc1b6b4e38d541f246de9ba45/modules/access/live555.cpp#L1074-L1077

From ffmpeg sources:

  • https://github.com/FFmpeg/FFmpeg/blob/c493a531edfd7b6956c563e19eb3a851b76797de/doc/bitstream_filters.texi#L129-L170

  • https://github.com/FFmpeg/FFmpeg/tree/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavcodec/mjpeg*

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavcodec/vaapi_encode_mjpeg.c

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavcodec/jpegtables.c

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavcodec/sp5xdec.c

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/rtpenc_jpeg.c

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/ingenientdec.c

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavcodec/ljpegenc.c

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/rawdec.c#L125-L190

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/rtpdec_jpeg.c

  • https://github.com/FFmpeg/FFmpeg/blob/6d09d6edbc464454a620e3ecf64fe752b5cfa9cc/libavformat/riff.c#L180-L212

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/smjpeg.c

  • https://github.com/FFmpeg/FFmpeg/blob/2343f23e4d7e0d0f6adfd83d7d769a7a115dbd17/libavformat/matroska.c#L79

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/swfenc.c#L214

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/rtp.c#L61

  • https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavdevice/vfwcap.c#L87-L90

  • https://github.com/FFmpeg/FFmpeg/blob/73651090ca1183f37753ee30a7e206ca4fb9f4f0/libavcodec/codec_desc.c#L86-L100

Last updated

Was this helpful?