def gstreamer_pipeline(
    capture_res=(3264, 2464),  # pi cam resolution
    display=(640, 480),  # screen resolution
    framerate=21,
    flip_method=0,
):
    """
    sets up a string to enable the picam

    Parameters
    ----------
    capture_res:tuple
        int,int format
        the resolution of the captured frame
    display:tuple
        int,int format
        the resolution of the frame returned
    framerate:int
        the number of frames returned
    flip_method:int
        whether to flip the frame

    Returns
    -------
    str
        a setup string for opening a picam stream
    """
    return (
        "nvarguscamerasrc ! "
        "video/x-raw(memory:NVMM), "
        "width=(int)%d, height=(int)%d, "
        "format=(string)NV12, framerate=(fraction)%d/1 ! "
        "nvvidconv flip-method=%d ! "
        "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
        "videoconvert ! "
        "video/x-raw, format=(string)BGR ! appsink"
        % (
            capture_res[0],
            capture_res[1],
            framerate,
            flip_method,
            display[0],
            display[1],
        )
    )