1def concatenate():
2 stringa = "ffmpeg -i \"concat:"
3 elenco_video = glob.glob("*.mp4")
4 elenco_file_temp = []
5 for f in elenco_video:
6 file = "temp" + str(elenco_video.index(f) + 1) + ".ts"
7 os.system("ffmpeg -i " + f + " -c copy -bsf:v h264_mp4toannexb -f mpegts " + file)
8 elenco_file_temp.append(file)
9 print(elenco_file_temp)
10 for f in elenco_file_temp:
11 stringa += f
12 if elenco_file_temp.index(f) != len(elenco_file_temp)-1:
13 stringa += "|"
14 else:
15 stringa += "\" -c copy -bsf:a aac_adtstoasc output.mp4"
16 print(stringa)
17 os.system(stringa)
18
19concatenate()
20