RedditVideoMakerBot icon indicating copy to clipboard operation
RedditVideoMakerBot copied to clipboard

IndexError: list index out of range

Open LiamGallagher737 opened this issue 2 years ago • 8 comments

Describe the bug Sometimes when it gets to the Creating the final video 🎥 stage it throws the following error, this doesn't happen on most posts but on this reddit post it happens every time it runs

Traceback (most recent call last):
  File "C:\Users\Liam\AppData\Local\Programs\Python\Python310\lib\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 "C:\Users\Liam\Desktop\RedditVideoMakerBot-2.3\main.py", line 65, in <module>
    run_many(config["settings"]["times_to_run"])
  File "C:\Users\Liam\Desktop\RedditVideoMakerBot-2.3\main.py", line 56, in run_many
    main()
  File "C:\Users\Liam\Desktop\RedditVideoMakerBot-2.3\main.py", line 48, in main
    make_final_video(number_of_comments, length, reddit_object, bg_config)
  File "C:\Users\Liam\Desktop\RedditVideoMakerBot-2.3\video_creation\final_video.py", line 75, in make_final_video    audio_clips = [AudioFileClip(f"assets/temp/mp3/{i}.mp3") for i in range(number_of_clips)]
  File "C:\Users\Liam\Desktop\RedditVideoMakerBot-2.3\video_creation\final_video.py", line 75, in <listcomp>      
    audio_clips = [AudioFileClip(f"assets/temp/mp3/{i}.mp3") for i in range(number_of_clips)]
  File "C:\Users\Liam\AppData\Local\Programs\Python\Python310\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 70, in __init__
    self.reader = FFMPEG_AudioReader(filename, fps=fps, nbytes=nbytes,
  File "C:\Users\Liam\AppData\Local\Programs\Python\Python310\lib\site-packages\moviepy\audio\io\readers.py", line 51, in __init__
    infos = ffmpeg_parse_infos(filename)
  File "C:\Users\Liam\AppData\Local\Programs\Python\Python310\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 289, in ffmpeg_parse_infos
    raise IOError(("MoviePy error: failed to read the duration of file %s.\n"
OSError: MoviePy error: failed to read the duration of file assets/temp/mp3/2.mp3.
Here are the file infos returned by ffmpeg:

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  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
[mp3 @ 00000172ee7a8d00] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 00000172ee7a8d00] Failed to read frame size: Could not seek to 1026.
assets/temp/mp3/2.mp3: Invalid argument

To Reproduce Run the bot for this post

System (please complete the following information):

  • Python Version: Python 3.10.5
  • OS: Windows 10
  • App version: 2.3

LiamGallagher737 avatar Jul 16 '22 03:07 LiamGallagher737

It fails to know how long the mp3 is. This is used to know how long the final video will be. I really don't know how to help you. I recommend you use another thread.

micziz avatar Jul 16 '22 08:07 micziz

What version are you on (It is one of the first things the bot prints)

JasonLovesDoggo avatar Jul 16 '22 12:07 JasonLovesDoggo

Check your Python version. I suspect you are running something older than the required 3.9+. That was my issue when running on Python 3.8

puttyq avatar Jul 16 '22 21:07 puttyq

Python Version is 3.10.5 App version is 2.3

LiamGallagher737 avatar Jul 16 '22 23:07 LiamGallagher737

Spoke too soon @LiamGallagher737 - I also ran into the error again. App Version 2.3 Python Version 3.10.4

OSError: MoviePy error: failed to read the duration of file assets/temp/mp3/2.mp3.

I can confirm that those post you linked has the same result for me.

puttyq avatar Jul 17 '22 07:07 puttyq

I saw something similar when TTS returned blank file Maybe this helps

efa2d19 avatar Jul 17 '22 20:07 efa2d19

Will test tomorrow

JasonLovesDoggo avatar Jul 18 '22 04:07 JasonLovesDoggo

@LiamGallagher737 @JasonLovesDoggo @puttyq Did one of you find the fix for this

ShadowUTube avatar Aug 14 '22 00:08 ShadowUTube

Still no fix???. I have the exact same problem when using TikTok's TTS

MullerTM avatar Sep 07 '22 16:09 MullerTM