I finally managed to get it work by using the following elements:
nvvidconv_osd = gst_element_factory_make ("nvvideoconvert", "nvvidconv_osd");
nvosd = gst_element_factory_make ("nvdsosd", "nv-onscreendisplay");
queue_sink = gst_element_factory_make ("queue", "queue_sink");
nvvidconv_sink = gst_element_factory_make ("nvvideoconvert", "nvvidconv_sink");
So, essentially I used nvvideoconvert twice and didn’t use nvvidconv at all.