Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.1k stars 1.51k forks source link

write_audiofile failed with import mediapipe #2005

Open roachsinai opened 1 year ago

roachsinai commented 1 year ago

Code example:

import sys
from moviepy.editor import VideoFileClip
import mediapipe as mp

print(sys.argv[1])
video = VideoFileClip(sys.argv[1])
audio = video.audio
audio.write_audiofile(sys.argv[2])

Run:

python ttt.py 123.mp4 1.mp3

Expected Behavior

Extract audio from 123.mp4 and saved as 1.mp3.

Actual Behavior

$ python ttt.py 123.mp4 1.mp3
123.mp4
MoviePy - Writing audio in 1.mp3

Audio do saved as 1.mp3 but only use 200+ KB, and the file is not playable.

What's more no tqdm like bar appear when script runing.

Specifications

TheHimanshuRastogi commented 12 months ago

While exporting the audio don't forget to pass bitrate and audio_codec, Use this: audio.write_audiofile(sys.argv[2], audio_codec='aac', bitrate='5M').

roachsinai commented 12 months ago

While exporting the audio don't forget to pass bitrate and audio_codec, Use this: audio.write_audiofile(sys.argv[2], audio_codec='aac', bitrate='5M').

Doesn't work either with import mediapipe as mp.

TheHimanshuRastogi commented 12 months ago

So why are you inmporting mediaipe as mp Even there’s no use of it?

roachsinai commented 12 months ago

So why are you inmporting mediaipe as mp Even there’s no use of it?

The code I posted is just to show how to reproduce this issue. I do use mediapipe in my local script.