Skip to content

bug when convert from webm to mp4 #2420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
elid34 opened this issue Apr 21, 2025 · 0 comments
Open

bug when convert from webm to mp4 #2420

elid34 opened this issue Apr 21, 2025 · 0 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@elid34
Copy link

elid34 commented Apr 21, 2025

my code

from moviepy import VideoFileClip

def convert_webm_to_mp4(input_path, output_path=None):
    if output_path is None:
        output_path = input_path.rsplit('.', 1)[0] + '.mp4'

    try:
        clip = VideoFileClip(input_path)
        clip.write_videofile(output_path, codec='libx264', audio_codec='aac')

        print(f"Conversion complete! MP4 saved to: {output_path}")
    except Exception as e:
        print(f"Error during conversion: {e}")


if __name__ == "__main__":
    convert_webm_to_mp4("input_file.webm")

Expected Behavior

convert the file and save it in the output_path

Actual Behavior

print me this error

Error during conversion: Error passing ffmpeg -i command output:

Input #0, matroska,webm, from 'convert_site.webm':
  Metadata:
    encoder         : QTmuxingAppLibWebM-0.0.1
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0(eng): Video: vp8, yuv420p(progressive), 1920x1016, SAR 1:1 DAR 240:127, 29.75 fps, 29.75 tbr, 1k tbn (default)
At least one output file must be specified

Steps and code to Reproduce the Problem

ffmpeg -y -i input.webm -movflags faststart -pix_fmt yuv420p -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 192k output.mp4

Specifications

  • Python Version: 3.11.2
  • MoviePy Version: 2.1.1
  • Platform Name: Linux parrot
  • Platform Version: 6.12.12-amd64
@elid34 elid34 added the bug Issues that report (apparent) bugs. label Apr 21, 2025
@elid34 elid34 changed the title but when convert from webm to mp4 bug when convert from webm to mp4 Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

1 participant