def get_codec_name(args, codec_type='video'):
    """
    Search list of arguments for the codec name.
    :param args: list of ffmpeg arguments
    :param codec_type: string, type of codec to check for.
    :returns: string, name of codec.
    """
    try:
        query = '-codec:v' if codec_type == 'video' else '-codec:a'
        codec_index = args.index(query) + 1
    except ValueError:
        return ''
    return args[codec_index]