2

Hello guys !

I'm working on a personal project, and I have a little problem which is the following one: I'm using the moviepy module to build videos, with sound; When I execute my program, I have the result that I expected, I mean the video I wanted to have, and I can read it well from my PC as a mp4 video using VLC.

But,

When I try to export this video to my iPhone (I tried to use Google Drive, Dropbox, emails, etc), the sound disappear.

What makes me think the mistake comes from my code ?

When I'm on my phone, I can read the video very well straightly from Google Drive (or something else), but when I trying to save it on my gallery (pictures/videos), the sound disappears at this moment. Even when I post my video directly from Dropbox to Instagram, it says that "this video has no sound".

Obviously, I've tried different .mp4 videos (not created with moviepy), and it works very well.

I'm so exhausted of spending hours trying to figured out where the problem could come from, that's why I'm asking for your help.

Here is the function that build my videos with the sound, and where I'm 100% sure the the problem is from :

    def build_sentence_video(self):
        logo = mpy.ImageClip(self.logo_path).set_position('center', 0).resize(width=100, height=100).set_position((10,5))
        clip = mpy.VideoClip(self.make_simple_frame, duration=10)

        video = mpy.CompositeVideoClip([clip, logo], size=VIDEO_SIZE).on_color(color=WHITE, col_opacity=1).set_duration(4)
        video_with_new_audio = video.set_audio(AudioFileClip(self.audio, buffersize=200000, fps=44100))
        video_with_new_audio.write_videofile(self.fr_word+".mp4",
                                            fps=2,
                                           )

Sorry in advance if my english is awful. Thank you for your help !

  • How is the audio actually being encoded? [This suggests](https://stackoverflow.com/q/9168954/6179432) that Quicktime doesn't like MP3 and that AAC is the most widely compatible – berardig Feb 05 '20 at 02:04
  • 2
    @mikewatt That was the problem, thank you very much !! I changes the last line of my function by adding video_with_new_audio.write_videofile(self.fr_word+".mp4", fps=2, audio_codec='aac') and it now works on my iPhone, thank you again ! – Youcef Bouterfass Feb 06 '20 at 03:21

0 Answers0