How to set nvgstcapture-1.0 nvjpegenc quality

I can set nvjpegenc quality with gst-launch-1.0 via:

gst-launch-1.0 -e nvarguscamerasrc ! "video/x-raw(memory:NVMM),width=4032,height=3040,framerate=1/2" ! nvjpegenc quality=100 ! multifilesink location=gst.jpg

But I’m unable to find a way to pass that quality parameter to nvgstcapture-1.0. Can anyone point me in the right direction? Thanks!

hello dustinkerstein,

there’s no quality options for nvgstcapture, it’s by default using hardware encoder.
you can enable the options to choose the encoder type.
for example,

  -J, --image-enc                   Image encoder type (0=jpeg_SW[jpegenc] 1=jpeg_HW[nvjpegenc])

Thanks Jerry. If I were to modify the nvgstcapture sources, do you know where I would be able to pass in quality settings to nvjpegenc? Thanks again.

Hi,
You would need to set the property to nvjpegenc:

  quality             : Quality of encoding
                        flags: readable, writable
                        Integer. Range: 0 - 100 Default: 85

Please grep g_object_set() in source code to get sample code of setting property.

Perfect! Here’s the code to accomplish that in nvgstcapture.c inside get_image_encoder():

switch (app->encset.image_enc) {
    case FORMAT_JPEG_SW:
      *iencoder = gst_element_factory_make (NVGST_SW_IMAGE_ENC, NULL);
      break;
    case FORMAT_JPEG_HW:
      *iencoder = gst_element_factory_make (NVGST_DEFAULT_IMAGE_ENC, NULL);
      g_object_set (*iencoder, "quality", 100, NULL);
      break;
    default:
      *iencoder = gst_element_factory_make (NVGST_DEFAULT_IMAGE_ENC, NULL);
      break;
  }

Thanks!

1 Like