[Python] mp4 generated with moviepy only appears as audio in vscode, and only video in finder

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    I have a few video clips I am concatenating with moviepy. However, upon making the video file and saving it, it is not behaving expectedly.

    I am using VSCode as my editor, and when I click on the generated mp4 in VSCode, I can only play the audio of the file. It is the expected audio.

    On the other hand, when I navigate to the file in Finder, the mp4 only displays as a video with no audio. I am bewildered as to why this is.

    When I share the video, it still is just visual with no audio.

    Here is the code I am using to save:

    titleClip = __createClip(script.titleSCFile, script.titleAudioClip, marginSize)
    print("screenshot file: ", script.titleSCFile)# screenshot file: screenshots/<filename>.png
    print("Duration: ",script.titleAudioClip.duration) #Duration: 3.55
    titleClip.write_videofile(
    'test_combine_aud_and_vid.mp4',
    codec = 'mpeg4',
    bitrate = config["Video"]["Bitrate"], #8000k
    threads = config["Video"]["Threads"] #12
    )


    The __createClip function takes in a png, an audio file, and turns it into a video clip:

    def __createClip(screenShotFile, audioClip, marginSize):
    imageClip = ImageClip(
    screenShotFile,
    duration=audioClip.duration
    ).set_position(("center", "center"))
    imageClip = imageClip.resize(width=(w-marginSize))
    videoClip = imageClip.set_audio(audioClip)
    videoClip.fps = 1
    return videoClip


    I tried saving the clips before concatenating, and they have the same error. The video and audio files are of the same length too.

    I expected the mp4 to be appear the same in both locations, with audio and video. This issue occurs with every image file and audio clip that I try.

    Continue reading...

Compartilhe esta Página