implement same, different files

This commit is contained in:
Xaloc 2020-05-13 15:20:11 +02:00
parent 7a40b46f81
commit d5e186d574

View File

@ -9,13 +9,13 @@ sep = input("Are audio and video in the Same or Different files? [S|D]")
sep = sep.lower() sep = sep.lower()
if not(sep=='s' or sep=='d'): if not(sep=='s' or sep=='d'):
raise ValueError("The answer should be S or D") raise ValueError("The answer should be S or D")
#video #video o video+so si junt
i=0 i=0
while True: while True:
v = i v = i
i += 1 i += 1
#url del video!!!!!!!!!!!!!! #url del video!!!!!!!!!!!!!! o video+so si junt
url= 'https://house-fastly-signed-us-east-1-prod.brightcovecdn.com/media/v1/hls/v4/clear/3695997568001/0df46668-c157-40a2-aeab-845c32d4eae3/d7cb636b-ca37-4bed-9248-0e494c526027/5x/segment'+str(v)+'.ts?fastly_token=NWUxNzNiNWFfMmM3NDk0NGU1NjE4NWM0MTE3MWQ4NjY1MGIwMGNhOGE2ZWI2NTc1NmQ2N2E1ODc3YjhjNzkxMjlhOWQyZTUzM18vL2hvdXNlLWZhc3RseS1zaWduZWQtdXMtZWFzdC0xLXByb2QuYnJpZ2h0Y292ZWNkbi5jb20vbWVkaWEvdjEvaGxzL3Y0L2NsZWFyLzM2OTU5OTc1NjgwMDEvMGRmNDY2NjgtYzE1Ny00MGEyLWFlYWItODQ1YzMyZDRlYWUzL2Q3Y2I2MzZiLWNhMzctNGJlZC05MjQ4LTBlNDk0YzUyNjAyNy8%3D' #url from media request without de number and .ts at the end url= 'https://house-fastly-signed-us-east-1-prod.brightcovecdn.com/media/v1/hls/v4/clear/3695997568001/0df46668-c157-40a2-aeab-845c32d4eae3/d7cb636b-ca37-4bed-9248-0e494c526027/5x/segment'+str(v)+'.ts?fastly_token=NWUxNzNiNWFfMmM3NDk0NGU1NjE4NWM0MTE3MWQ4NjY1MGIwMGNhOGE2ZWI2NTc1NmQ2N2E1ODc3YjhjNzkxMjlhOWQyZTUzM18vL2hvdXNlLWZhc3RseS1zaWduZWQtdXMtZWFzdC0xLXByb2QuYnJpZ2h0Y292ZWNkbi5jb20vbWVkaWEvdjEvaGxzL3Y0L2NsZWFyLzM2OTU5OTc1NjgwMDEvMGRmNDY2NjgtYzE1Ny00MGEyLWFlYWItODQ1YzMyZDRlYWUzL2Q3Y2I2MzZiLWNhMzctNGJlZC05MjQ4LTBlNDk0YzUyNjAyNy8%3D' #url from media request without de number and .ts at the end
url=str(url) url=str(url)
print(url) print(url)
@ -34,35 +34,38 @@ while True:
os.system("cat *"+str(v)+".ts >> all.ts") os.system("cat *"+str(v)+".ts >> all.ts")
os.system("ffmpeg -i all.ts -acodec copy -vcodec copy video.mp4") os.system("ffmpeg -i all.ts -acodec copy -vcodec copy video.mp4")
if sep=='s':
os.system("mv video.mp4 output.mp4")
os.system("rm *.ts") os.system("rm *.ts")
#so if sep=='d':
i=0 #so
while True: i=0
v = i while True:
i += 1 v = i
i += 1
#url del so!!!!!!!!!!!!!!
url= 'https://house-fastly-signed-us-east-1-prod.brightcovecdn.com/media/v1/hls/v4/clear/3695997568001/0df46668-c157-40a2-aeab-845c32d4eae3/600d909e-91a6-4f5c-b70b-2fe049618325/5x/segment'+str(v)+'.ts?fastly_token=NWUxNzNiNWFfNDI3ZDlkODIxM2U2YjBmY2E3MDlhYzhkOTcxYWI3YWRlOGUyOTgzYmQzZjJlZDYyYWRhNGIyMDJmZjZhNjMwYl8vL2hvdXNlLWZhc3RseS1zaWduZWQtdXMtZWFzdC0xLXByb2QuYnJpZ2h0Y292ZWNkbi5jb20vbWVkaWEvdjEvaGxzL3Y0L2NsZWFyLzM2OTU5OTc1NjgwMDEvMGRmNDY2NjgtYzE1Ny00MGEyLWFlYWItODQ1YzMyZDRlYWUzLzYwMGQ5MDllLTkxYTYtNGY1Yy1iNzBiLTJmZTA0OTYxODMyNS8%3D' #url from media request without de number and .ts at the end #url del so!!!!!!!!!!!!!!
url=str(url) url= 'https://house-fastly-signed-us-east-1-prod.brightcovecdn.com/media/v1/hls/v4/clear/3695997568001/0df46668-c157-40a2-aeab-845c32d4eae3/600d909e-91a6-4f5c-b70b-2fe049618325/5x/segment'+str(v)+'.ts?fastly_token=NWUxNzNiNWFfNDI3ZDlkODIxM2U2YjBmY2E3MDlhYzhkOTcxYWI3YWRlOGUyOTgzYmQzZjJlZDYyYWRhNGIyMDJmZjZhNjMwYl8vL2hvdXNlLWZhc3RseS1zaWduZWQtdXMtZWFzdC0xLXByb2QuYnJpZ2h0Y292ZWNkbi5jb20vbWVkaWEvdjEvaGxzL3Y0L2NsZWFyLzM2OTU5OTc1NjgwMDEvMGRmNDY2NjgtYzE1Ny00MGEyLWFlYWItODQ1YzMyZDRlYWUzLzYwMGQ5MDllLTkxYTYtNGY1Yy1iNzBiLTJmZTA0OTYxODMyNS8%3D' #url from media request without de number and .ts at the end
print(url) url=str(url)
try: print(url)
urlopen(url) try:
wget.download(url) urlopen(url)
print('\n next \n') wget.download(url)
except HTTPError as e: print('\n next \n')
if e.code == 403: except HTTPError as e:
wget.download(url) if e.code == 403:
continue wget.download(url)
else: continue
print('\n end \n') else:
break print('\n end \n')
break
os.system("cat *"+str(v)+".ts >> all.ts")
os.system("cat *"+str(v)+".ts >> all.ts")
os.system("ffmpeg -i all.ts -acodec copy -vcodec copy so.mp4")
os.system("rm *.ts") os.system("ffmpeg -i all.ts -acodec copy -vcodec copy so.mp4")
os.system("rm *.ts")
#ajuntar
os.system("ffmpeg -i video.mp4 -i so.mp4 -c:v copy -c:a aac -strict experimental output.mp4") #ajuntar
os.system("rm video.mp4 so.mp4") os.system("ffmpeg -i video.mp4 -i so.mp4 -c:v copy -c:a aac -strict experimental output.mp4")
os.system("rm video.mp4 so.mp4")