5

I want to convert an audio file from one format to another, so I used Pydub AudioSegment.

AudioSegment.from_file(input_filename, 'mp4')

The python script file runs perfectly, but when I bundle it as an executable using pyinstaller, I get the following error.

I read through Github issue pages and implemented the solutions suggested there, but that doesn't seem to work. I have placed the ffmpeg.exe and ffprobe.exe in my project directory and set the path using AudioSegment.converter

   Traceback (most recent call last):
      File "main.py", line 91, in change_format
        converted_audio = AudioSegment.from_file(input_filename, 'mp4')
      File "lib\site-packages\pydub\audio_segment.py", line 685, in from_file
      File "lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
      File "subprocess.py", line 728, in __init__
      File "subprocess.py", line 1025, in _get_handles
    OSError: [WinError 6] The handle is invalid

Please suggest ways to fix this.

jizhihaoSAMA
  • 12,336
  • 9
  • 27
  • 49
Lakshmanan Meiyappan
  • 2,413
  • 3
  • 12
  • 15

0 Answers0