1

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.

4
  • Use the setparams filter, and don't re-encode the video.
    – Gyan
    Feb 19, 2019 at 19:55
  • Gyan, can you tell me the syntax? The following didn't work: -vf setparams=range=tv (No such filter: 'setparams'); -setparams range=tv (Unrecognized option 'setparams').
    – MAXdB
    Feb 19, 2019 at 22:52
  • 1
    Your version is too old. You need at least version 4.0, or better yet use a recent build from the git master branch. You can get download it from Zeranoe.
    – llogan
    Feb 19, 2019 at 23:03
  • 1
    Thanks, llogan, I upgraded to 4.1-win64-static. Thank you Gyan, -vf setparams=range=tv is accepted as a parameter with current version. If you answer the question I'll mark it as accepted.
    – MAXdB
    Feb 19, 2019 at 23:26

1 Answer 1

1

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.

1
  • Thanks for the tip to not re-encode before sending to ffplay. Wow, a year ago!
    – MAXdB
    Jun 4, 2020 at 3:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .