FFMPEG Consumer mjpeg quality

Im using a udp stream with mjpeg codec.

My Configuration:

<channel>
      <video-mode>720p2500</video-mode>
      <consumers>
        <ffmpeg>
          <path>udp://127.0.0.1:9996</path>
          <args>-format mjpeg -codec:v mjpeg -qscale:v 2 -pixel_format:v yuvj422p</args>
        </ffmpeg>
      </consumers>
    </channel>

The quality is a bit blocky. Usually ffmpeg owns an option “qscale” to change this. But caspar logs that this option is not being used:

ffmpeg[udp://127.0.0.1:9996] Initialized.
[2021-11-28 22:42:45.385] [info]    Initialized channels.
[2021-11-28 22:42:45.386] [info]    Initialized controllers.
[2021-11-28 22:42:45.386] [info]    Initialized osc.
[2021-11-28 22:42:45.386] [warning] [ffmpeg] [swscaler @ 000001D4CBF97B40] deprecated pixel format used, make sure you did set range correctly
[2021-11-28 22:42:45.386] [warning] 
[2021-11-28 22:42:45.387] [warning] ffmpeg[udp://127.0.0.1:9996] Unused option qscale=2:v

How is the way to enhance mjpeg quality in casparcg?

I had several issues when I was trying to stream with casparcg and ffmpeg arguments. Try moving the -format argument at the end of your args (just an idea that helped me once). Also maybe you could try -q:v instead of -qscale:v.

Or try setting the desired bitrate that fits your needs with -b:v

Thank you for your tips,

-codec:v mjpeg -filter:v scale=640:-1 -b:v 6M -pixel_format:v yuvj422p -format mjpeg

did it

The quality changes with b:v

1 Like