def concat_videos(concat_software, vid_num, filename):
    global VIDEO_FORMAT,title
    if concat_software == 'ffmpeg':
        f = open('ff.txt', 'w')
        ff = ''
        cwd = os.getcwd()
        for i in range(vid_num):
            ff += 'file \'{cwd}/{i}.flv\'\n'.format(cwd = cwd, i = i)
        # ff = ff.encode("utf8")
        f.write(ff)
        f.close()
        logging.debug(ff)
        logging.info('Concating videos...')

        execute_sysencode_cmd('ffmpeg -f concat -i ff.txt -c copy "' + filename + '".mp4')
        VIDEO_FORMAT = 'mp4'
        if os.path.isfile((str(i) + '.mp4').decode("utf-8")):
            try:
                # os.remove('ff.txt')
                print((str(i) + '.flv').decode("utf-8"))
                os.remove((str(i) + '.flv').decode("utf-8"))
                for i in range(vid_num):
                    os.remove((str(i) + '.flv').decode("utf-8"))
                    #execute_sysencode_cmd('rm -r ' + str(i) + '.flv')
                logging.info('Done, enjoy yourself!')
            except Exception:
                logging.warning('Cannot delete temporary files!')
                return ['']
        else:
            print('ERROR: Cannot concatenate files, trying to make flv...')
            execute_sysencode_cmd('ffmpeg -f concat -i ff.txt -c copy "' + filename + '".flv')
            VIDEO_FORMAT = 'flv'
            if os.path.isfile((str(i) + '.flv').decode("utf-8")):
                logging.warning('FLV file made. Not possible to mux to MP4, highly likely due to audio format.')
                #execute_sysencode_cmd('rm -r ff.txt')
                # os.remove('ff.txt')
                print(('ff.txt').decode("utf-8"))
                os.remove(('ff.txt').decode("utf-8"))
                for i in range(vid_num):
                    #execute_sysencode_cmd('rm -r ' + str(i) + '.flv')
                    os.remove((str(i) + '.flv').decode("utf-8"))
            else:
                logging.error('Cannot concatenate files!')
    elif concat_software == 'avconv':
        pass

#----------------------------------------------------------------------
str,str->None
dataset/ETHPy150Open cnbeining/Biligrab/biligrab.py/concat_videos