reab5555 commited on
Commit
68302f1
·
verified ·
1 Parent(s): bd2c03e

Update visualization.py

Browse files
Files changed (1) hide show
  1. visualization.py +3 -2
visualization.py CHANGED
@@ -283,6 +283,7 @@ def create_heatmap(t, mse_embeddings_filtered, mse_posture_filtered, mse_voice_f
283
 
284
  return heatmap_frame
285
 
 
286
  def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_voice, output_folder, desired_fps, most_frequent_person_frames):
287
  print(f"Creating heatmap video. Output folder: {output_folder}")
288
 
@@ -331,8 +332,8 @@ def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_v
331
  final_clip = VideoClip(combine_video_and_heatmap, duration=video.duration)
332
  final_clip = final_clip.set_audio(video.audio)
333
 
334
- # Write the final video
335
- final_clip.write_videofile(heatmap_video_path, codec='libx264', audio_codec='aac', fps=video.fps)
336
 
337
  # Close the video clips
338
  video.close()
 
283
 
284
  return heatmap_frame
285
 
286
+
287
  def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_voice, output_folder, desired_fps, most_frequent_person_frames):
288
  print(f"Creating heatmap video. Output folder: {output_folder}")
289
 
 
332
  final_clip = VideoClip(combine_video_and_heatmap, duration=video.duration)
333
  final_clip = final_clip.set_audio(video.audio)
334
 
335
+ # Write the final video using x264 codec
336
+ final_clip.write_videofile(heatmap_video_path, codec='libx264', audio_codec='aac', fps=video.fps, preset='medium', ffmpeg_params=['-crf', '23'])
337
 
338
  # Close the video clips
339
  video.close()