zackmawaldi / YouTube-shorts-generator

Automatically download Reddit videos, edit them, and upload them to YouTube.
MIT License
323 stars 62 forks source link

OSError: MoviePy error: failed to read the duration of file temp_clips/main_clip.mp4. #5

Open LawOff opened 2 years ago

LawOff commented 2 years ago
Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 285, in ffmpeg_parse_infos
    line = [l for l in lines if keyword in l][index]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 38, in <module>
    r.render(directory, "main_clip.mp4", "output.mp4", config.video['dimensions'])
  File "/home/ec2-user/YouTube-shorts-generator/render.py", line 20, in render
    main_clip = VideoFileClip(clip_dir)
  File "/home/ec2-user/.local/lib/python3.7/site-packages/moviepy/video/io/VideoFileClip.py", line 91, in __init__
    fps_source=fps_source)
  File "/home/ec2-user/.local/lib/python3.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 36, in __init__
    fps_source)
  File "/home/ec2-user/.local/lib/python3.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 291, in ffmpeg_parse_infos
    filename, infos))
OSError: MoviePy error: failed to read the duration of file temp_clips/main_clip.mp4.
Here are the file infos returned by ffmpeg:

ffmpeg version 4.2.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --
enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-l
ibmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvo
rbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --en
able-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
temp_clips/main_clip.mp4: Is a directory

Here is the complete error that I receive on the Amazon Linux, I didn't have this problem on Windows, or raspberrypi OS, so I think I installed ffmpeg wrong.

In the error it shows me version "4.2.2-static", but I installed the "5.0.1-static".

Thanks.

LawOff commented 2 years ago

Update:

I updated moviepy to latest dev version:

pip install moviepy==2.0.0.dev2

it was supposed to fix, but still the same error

zackmawaldi commented 2 years ago

Weird. I personally have no idea what's up, seems like a bug.

Here are two resources that I skimmed. Deeper reading is needed:

https://stackoverflow.com/questions/42121508/moviepy-unable-to-read-duration-of-file

https://github.com/Zulko/moviepy/issues/116

Kizuno18 commented 2 years ago

same issue here, it is creating main_clip.mp4 but its a folder

Ahsan221B commented 1 year ago

@LawOff @Kizuno18 Were you able to fix it? I'm having the same trouble on my end. I am on MacOS.

Kizuno18 commented 1 year ago

@LawOff @Kizuno18 Were you able to fix it? I'm having the same trouble on my end. I am on MacOS.

unfortunatelly i dont know much, so i dont found a solution.