alexlaverty / python-reddit-youtube-bot

Automated Reddit Youtube Video Bot
https://www.youtube.com/channel/UCzIwW92D_rM5_yvWBsquSbw
83 stars 19 forks source link

Error on a specific subreddit #66

Closed sebbourgeois closed 1 year ago

sebbourgeois commented 1 year ago

Not a critical issue as, so far, it happens only on this subreddit : https://www.reddit.com/r/antiwork/comments/132vcgs/elon_musk_cuts_twitters_parental_leave_from_20/

2023-04-30 13:53:31 INFO     Created Audio File : assets/work_dir/132vcgs/selftext_0.mp3
Traceback (most recent call last):
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 340, in ffmpeg_parse_infos
    line = [l for l in lines if "Duration:" in l][-1]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sb/videos-creation/python-reddit-youtube-bot/app.py", line 321, in <module>
    process_submissions(submissions)
  File "/home/sb/videos-creation/python-reddit-youtube-bot/app.py", line 49, in process_submissions
    process_submission(submission)
  File "/home/sb/videos-creation/python-reddit-youtube-bot/app.py", line 92, in process_submission
    vid.create(video_directory=video.folder_path,
  File "/home/sb/videos-creation/python-reddit-youtube-bot/video_generation/video.py", line 251, in create
    selftext_audioclip = AudioFileClip(selftext_audio_filepath)
  File "<decorator-gen-48>", line 2, in __init__
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/audio/io/AudioFileClip.py", line 75, in __init__
    self.reader = FFMPEG_AudioReader(
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/audio/io/readers.py", line 60, in __init__
    infos = ffmpeg_parse_infos(filename, decode_file=decode_file)
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 344, in ffmpeg_parse_infos
    raise IOError(
OSError: MoviePy error: failed to read the duration of file assets/work_dir/132vcgs/selftext_0.mp3.
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-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-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
[mp3 @ 0x66d1380] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 0x66d1380] Failed to read frame size: Could not seek to 1026.
assets/work_dir/132vcgs/selftext_0.mp3: Invalid argument

Exception ignored in: <function FFMPEG_AudioReader.__del__ at 0x7fd7589756c0>
Traceback (most recent call last):
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/audio/io/readers.py", line 269, in __del__
    self.close()
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/audio/io/readers.py", line 260, in close
    if self.proc:
AttributeError: 'FFMPEG_AudioReader' object has no attribute 'proc'