2

Using an IP cam, grabbing the h264 stream the picture looks fine. Want to use the MJPEG stream, but the image is washed out, lack of contrast, blacks show as dark gray and whites show as light gray. Chroma looks ok (bright blue is dull blue, yellow is yellow, etc). Problem evident in VLC, FFplay, FFmpeg.

ffplay rtsp://cam/h264/stream

Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 1280x720, 30 fps, 30 tbr, 90k tbn, 180k tbc

ffplay rtsp://cam/mjpeg/stream

Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 90k tbc

If the cam is mis-reporting its scale or colorspace, are there ways to override? I tried this, had no effect on the picture:

ffmpeg -i rtsp://cam/mjpeg/stream -vf scale=in_range=tv  -f matroska - | ffplay -

Any advice appreciated!

My ffmpeg version is upgraded to 4.1-win64-static, was 3.4.

MAXdB
  • 41

1 Answers1

2

The setparams filter, available since ffmpeg ver 4.0, can change the color range flag of the input, without altering the actual pixel data. You can use it to flag your MJPEG stream as limited range.

setparams=range=limited

P.S. Skip re-encoding the video, that's expensive and will lose a bit more quality, add -c:v rawvideo.

Gyan
  • 38,955