def vf_fade(cutin, cutout, fadein, fadeout, color='black'):
    """
    Genterate FFmpeg video fade filter string
    https://ffmpeg.org/ffmpeg-filters.html#fade
    :param cutin: (number) position in the original video where segment starts
    :param cutout: (number) position in the original video where segment ends
    :param fadein: (number) length of video where fade-in applied, in sec
    :param fadeout: (number) length of video where fade-out applied, in sec
    :param color: (str)
    :return: (str) ffmpeg video filter string
    """
    a = cutin, fadein, color, cutout - fadeout, fadeout, color
    return 'fade=t=in:st={}:d={}:c={},fade=t=out:st={}:d={}:c={}'.format(*a)
