GilangAlRusliadi commited on
Commit
a4996df
·
1 Parent(s): 9bca4cd
Files changed (1) hide show
  1. others.py +10 -15
others.py CHANGED
@@ -282,20 +282,15 @@ def join_video(name, thumbnail_file, video_file):
282
 
283
  # Tentukan jalur ke file audio yang akan digunakan untuk intro
284
  audio_file = 'sound.wav'
285
-
286
- # Temukan file gambar yang sesuai
287
- image_file = thumbnail_file
288
-
289
- # Periksa apakah file gambar ada
290
- if image_file:
291
- # Tentukan jalur ke file output
292
- output_file = f'{output_dir}/{name}.mp4'
293
- # Gunakan ffmpeg untuk membuat video 1 detik dari file gambar dan audio
294
- os.system(f"ffmpeg -loop 1 -i {image_file} -i {audio_file} -c:v libx264 -b:v 850k -bufsize 1000k -r 30 -b:a 160k -ar 44100 -ac 2 -t 1 -pix_fmt yuv420p -vf scale=1280:720 -shortest {name}.mp4")
295
- # Gunakan ffmpeg untuk menggabungkan intro dan video
296
- with open('input.txt', 'w') as f:
297
- f.write(f"file '{name}.mp4'\n")
298
- f.write(f"file '{video_file}'\n")
299
- os.system( f"ffmpeg -f concat -safe 0 -i input.txt -c:v libx264 -b:v 850k -bufsize 1000k -r 30 -b:a 160k -ar 44100 -ac 2 -c:a aac -pix_fmt yuv420p -vf scale=1280:720 {output_file}")
300
 
301
  return output_file
 
282
 
283
  # Tentukan jalur ke file audio yang akan digunakan untuk intro
284
  audio_file = 'sound.wav'
285
+
286
+ # Tentukan jalur ke file output
287
+ output_file = f'{output_dir}/{name}.mp4'
288
+ # Gunakan ffmpeg untuk membuat video 1 detik dari file gambar dan audio
289
+ os.system(f"ffmpeg -loop 1 -i {thumbnail_file} -i {audio_file} -c:v libx264 -b:v 850k -bufsize 1000k -r 30 -b:a 160k -ar 44100 -ac 2 -t 1 -pix_fmt yuv420p -vf scale=1280:720 -shortest {name}.mp4")
290
+ # Gunakan ffmpeg untuk menggabungkan intro dan video
291
+ with open('input.txt', 'w') as f:
292
+ f.write(f"file '{name}.mp4'\n")
293
+ f.write(f"file '{video_file}'\n")
294
+ os.system( f"ffmpeg -f concat -safe 0 -i input.txt -c:v libx264 -b:v 850k -bufsize 1000k -r 30 -b:a 160k -ar 44100 -ac 2 -c:a aac -pix_fmt yuv420p -vf scale=1280:720 {output_file}")
 
 
 
 
 
295
 
296
  return output_file