Use PIX_FMT_NONE instead of -1 when dealing with PixelFormat variables.
Attach a file by drag & drop or click to upload