elebumm / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨
GNU General Public License v3.0
6.55k stars 1.83k forks source link

yt_dlp Postprocessing Error #287

Closed giuliosmedile closed 2 years ago

giuliosmedile commented 2 years ago

Can't use the tool, as yt_dlp freaks out when trying to stitch the videos together.

[download] assets/mp4/background.f308.webm has already been downloaded
[download] 100% of 5.84GiB
[download] assets/mp4/background.f251.webm has already been downloaded
[download] 100% of 80.34MiB
[Merger] Merging formats into "assets/mp4/background.mp4"
ERROR: Postprocessing:   Stream #1:0 -> #0:1 (copy)
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 3204, in process_info
    replace_info_dict(self.post_process(dl_filename, info_dict, files_to_move))
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 3374, in post_process
    info = self.run_all_pps('post_process', info, additional_pps=info.get('__postprocessors'))
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 3361, in run_all_pps
    info = self.run_pp(pp, info)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 3340, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/postprocessor/common.py", line 25, in run
    ret = func(self, info, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/postprocessor/common.py", line 129, in wrapper
    return func(self, info)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/postprocessor/ffmpeg.py", line 827, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/postprocessor/ffmpeg.py", line 282, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/postprocessor/ffmpeg.py", line 321, in real_run_ffmpeg
    raise FFmpegPostProcessorError(stderr.split('\n')[-1])
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError:   Stream #1:0 -> #0:1 (copy)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 41, in <module>
    download_background()
  File "/app/video_creation/background.py", line 35, in download_background
    ydl.download("https://www.youtube.com/watch?v=n_Dv4JMiwK8")
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 3254, in download
    self.__download_wrapper(self.extract_info)(
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 3230, in wrapper
    res = func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 1386, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 1395, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 1479, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 1535, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 2640, in process_video_result
    self.process_info(new_info)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 3206, in process_info
    self.report_error('Postprocessing: %s' % str(err))
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 936, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/YoutubeDL.py", line 879, in trouble
    raise DownloadError(message, exc_info)
yt_dlp.utils.DownloadError: ERROR: Postprocessing:   Stream #1:0 -> #0:1 (copy)
SomeRandomGuy009 commented 2 years ago

Same happened to me..i had to manually download the video and move it to the asset/mp4 directory...if you're gonna do the same don't forget to rename the mp4 file to background.mp4

thepranaygupta commented 2 years ago

Same happened to me..i had to manually download the video and move it to the asset/mp4 directory...if you're gonna do the same don't forget to rename the mp4 file to background.mp4

did it work?

SomeRandomGuy009 commented 2 years ago

Same happened to me..i had to manually download the video and move it to the asset/mp4 directory...if you're gonna do the same don't forget to rename the mp4 file to background.mp4

did it work?

Yes it did..has been working smoothly ever since

SomeRandomGuy009 commented 2 years ago

Try this name once. background.temp.mp4

thepranaygupta commented 2 years ago

Same happened to me..i had to manually download the video and move it to the asset/mp4 directory...if you're gonna do the same don't forget to rename the mp4 file to background.mp4

did it work?

Yes it did..has been working smoothly ever since

yes renaming the default filename to background.mp4 worked for me as well Thanks!

giuliosmedile commented 2 years ago

Seems to be working to some extent for me, it passes the downloading and merging phase, but then hangs up again with moviepy.

Deleting original file assets/mp4/background.f308.webm (pass -k to keep)
Background video downloaded successfully!
╭──────────────────────────────────────────────────────────────────────────────╮
│ Finding a spot in the background video to chop...                            │
╰──────────────────────────────────────────────────────────────────────────────╯
Moviepy - Running:
>>> "+ " ".join(cmd)
Moviepy - Command returned an error
Traceback (most recent call last):
  File "main.py", line 22, in <module>
    chop_background_video(length)
  File "/home/smeds/Downloads/RedditVideoMakerBot-1.0.0/video_creation/background.py", line 45, in chop_background_video
    ffmpeg_extract_subclip(
  File "/home/smeds/.local/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_tools.py", line 41, in ffmpeg_extract_subclip
    subprocess_call(cmd)
  File "/home/smeds/.local/lib/python3.8/site-packages/moviepy/tools.py", line 54, in subprocess_call
    raise IOError(err.decode('utf8'))
OSError: 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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'assets/mp4/background.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf59.16.100
  Duration: 01:20:13.08, start: 0.000000, bitrate: 10571 kb/s
    Stream #0:0(eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt709), 2560x1440, 10419 kb/s, SAR 1:1 DAR 16:9, 59.90 fps, 59.94 tbr, 16k tbn, 16k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 137 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[mp4 @ 0x6f705c0] track 1: codec frame size is not set
[mp4 @ 0x6f705c0] opus in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times
thepranaygupta commented 2 years ago

Hope this is added to the documentation. @ImmaHarry @LukaHietala @FreebieII @CallumIO

Same happened to me..i had to manually download the video and move it to the asset/mp4 directory...if you're gonna do the same don't forget to rename the mp4 file to background.mp4

SomeRandomGuy009 commented 2 years ago

Seems to be working to some extent for me, it passes the downloading and merging phase, but then hangs up again with moviepy.

Deleting original file assets/mp4/background.f308.webm (pass -k to keep)
Background video downloaded successfully!
╭──────────────────────────────────────────────────────────────────────────────╮
│ Finding a spot in the background video to chop...                            │
╰──────────────────────────────────────────────────────────────────────────────╯
Moviepy - Running:
>>> "+ " ".join(cmd)
Moviepy - Command returned an error
Traceback (most recent call last):
  File "main.py", line 22, in <module>
    chop_background_video(length)
  File "/home/smeds/Downloads/RedditVideoMakerBot-1.0.0/video_creation/background.py", line 45, in chop_background_video
    ffmpeg_extract_subclip(
  File "/home/smeds/.local/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_tools.py", line 41, in ffmpeg_extract_subclip
    subprocess_call(cmd)
  File "/home/smeds/.local/lib/python3.8/site-packages/moviepy/tools.py", line 54, in subprocess_call
    raise IOError(err.decode('utf8'))
OSError: 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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'assets/mp4/background.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf59.16.100
  Duration: 01:20:13.08, start: 0.000000, bitrate: 10571 kb/s
    Stream #0:0(eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt709), 2560x1440, 10419 kb/s, SAR 1:1 DAR 16:9, 59.90 fps, 59.94 tbr, 16k tbn, 16k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 137 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[mp4 @ 0x6f705c0] track 1: codec frame size is not set
[mp4 @ 0x6f705c0] opus in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times

did u download it from the release?i git cloned it from the master branch btw

fil7er commented 2 years ago

Any news here?

ADD this line in Dockerfile after downloading the background, for containers COPY ./background.mp4 /app/assets/mp4/background.mp4

callumio commented 2 years ago

Closing due to being stale and no longer relevant