redvid icon indicating copy to clipboard operation
redvid copied to clipboard

no sound on downloaded videos

Open itsdiy0 opened this issue 1 year ago • 2 comments

downloaded videos are not having sound, seems Ffmpeg is not working properly

itsdiy0 avatar Feb 27 '25 06:02 itsdiy0

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)

Lancelot65 avatar Apr 21 '25 13:04 Lancelot65

Can you provide urls of the videos having the issue?

elmoiv avatar Apr 23 '25 20:04 elmoiv