redvid
redvid copied to clipboard
no sound on downloaded videos
downloaded videos are not having sound, seems Ffmpeg is not working properly
I replaced the get_and_mux() function to use moviepy instead of ffmpeg for muxing video and audio directly in Python.
def get_and_mux(self):
"""
Video or muxed video with audio if exists (using moviepy)
"""
self.get_video()
video_path = os.path.join(self.temp, 'video.mp4')
output_path = self.file_name
if self.audio:
self.get_audio()
audio_path = os.path.join(self.temp, 'audio.m4a')
try:
video_clip = VideoFileClip(video_path)
audio_clip = AudioFileClip(audio_path)
final_clip = video_clip.set_audio(audio_clip)
final_clip.write_videofile(output_path, codec="libx264", audio_codec="aac")
video_clip.close()
audio_clip.close()
except Exception as e:
raise BaseException(f"Error during video and audio merging: {e}")
else:
try:
video_clip = VideoFileClip(video_path)
video_clip.write_videofile(output_path, codec="libx264")
video_clip.close()
except Exception as e:
raise BaseException(f"Error during video processing: {e}")
# Clean Temp folder
Clean(self.temp)
Can you provide urls of the videos having the issue?