Repository: elebumm/RedditVideoMakerBot

Issue #236: Trim Background FFMPEG Error
Created: 2022-06-03T21:15:34Z
I've been having this error for a couple of hours now, and I have no idea what's causing it. I tried it with both Pytube and YTDL, they both got me the same error.
Code:
def trim_background_video():
    print_step("Finding a spot to trim in the background video...")
    background = VideoFileClip("assets/mp4/background.mp4")
    start_time, end_time = get_start_and_end_times(60, background.duration)
    ffmpeg_extract_subclip("assets/mp4/background.mp4", start_time, end_time, targetname="assets/mp4/clip.mp4")
    print_substep("Successfully trimmed the background video!", style="bold green")
Error:
Traceback (most recent call last):
  File "C:\Users\lucam\Documents\Programming\Python\RedditVideoMakerBot\main.py", line 18, in <module>
    trim_background_video()
  File "C:\Users\lucam\Documents\Programming\Python\RedditVideoMakerBot\video_creation\background.py", line 27, in trim_background_video
    ffmpeg_extract_subclip("assets/mp4/background.mp4", start_time, end_time, targetname="assets/mp4/clip.mp4")
  File "C:\Users\lucam\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\video\io\ffmpeg_tools.py", line 41, in ffmpeg_extract_subclip
    subprocess_call(cmd)
  File "C:\Users\lucam\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\tools.py", line 54, in subprocess_call
    raise IOError(err.decode('utf8'))
OSError: 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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'assets/mp4/background.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.76.100
  Duration: 00:09:35.16, start: 0.000000, bitrate: 3734 kb/s
    Stream #0:0(eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt709), 1920x1080, 3582 kb/s, SAR 1:1 DAR 16:9, 59.94 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, 141 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[mp4 @ 000001d5502217c0] track 1: codec frame size is not set
[mp4 @ 000001d5502217c0] 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

Duplicate issue #313: After it says finding the right video to chop the following error shows
Created: 2022-06-05T15:32:07Z
Moviepy - Running:
"+ " ".join(cmd)
Moviepy - Command returned an error
Traceback (most recent call last):
File "C:\Users\NinjaByte\Downloads\RedditVideoMakerBot-master\main.py", line 42, in 
chop_background_video(length)
File "C:\Users\NinjaByte\Downloads\RedditVideoMakerBot-master\video_creation\background.py", line 45, in chop_background_video
ffmpeg_extract_subclip(
File "C:\Users\NinjaByte\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\video\io\ffmpeg_tools.py", line 41, in ffmpeg_extract_subclip
subprocess_call(cmd)
File "C:\Users\NinjaByte\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\tools.py", line 54, in subprocess_call
raise IOError(err.decode('utf8'))
OSError: 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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'assets/mp4/background.mp4':
Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2mp41
encoder         : Lavf58.76.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 @ 000001d6fea6fd40] track 1: codec frame size is not set
[mp4 @ 000001d6fea6fd40] 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

Closing comment (2022-06-05T15:49:35Z): Duplicate #236