SamurAIGPT / AI-Youtube-Shorts-Generator

A python tool that uses GPT-4, FFmpeg, and OpenCV to automatically analyze videos, extract the most interesting sections, and crop them for an improved viewing experience.
https://www.vadoo.tv/ai-youtube-shorts-generator
MIT License
639 stars 94 forks source link

can not generate the video #9

Open woyin opened 2 weeks ago

woyin commented 2 weeks ago

Enter YouTube video URL: https://www.youtube.com/watch?v=G0FoPxjS4yI Available video streams:

  1. Resolution: 1080p, Size: 301.29 MB, Type: Adaptive
  2. Resolution: 1080p, Size: 319.64 MB, Type: Adaptive
  3. Resolution: 1080p, Size: 516.63 MB, Type: Adaptive
  4. Resolution: 720p, Size: 151.99 MB, Type: Adaptive
  5. Resolution: 720p, Size: 178.44 MB, Type: Adaptive
  6. Resolution: 720p, Size: 299.18 MB, Type: Adaptive
  7. Resolution: 480p, Size: 55.72 MB, Type: Adaptive
  8. Resolution: 480p, Size: 49.75 MB, Type: Adaptive
  9. Resolution: 480p, Size: 46.81 MB, Type: Adaptive
  10. Resolution: 360p, Size: 33.05 MB, Type: Adaptive
  11. Resolution: 360p, Size: 37.23 MB, Type: Adaptive
  12. Resolution: 360p, Size: 32.47 MB, Type: Adaptive
  13. Resolution: 360p, Size: 77.95 MB, Type: Progressive
  14. Resolution: 240p, Size: 15.56 MB, Type: Adaptive
  15. Resolution: 240p, Size: 14.44 MB, Type: Adaptive
  16. Resolution: 240p, Size: 15.98 MB, Type: Adaptive
  17. Resolution: 144p, Size: 7.57 MB, Type: Adaptive
  18. Resolution: 144p, Size: 7.65 MB, Type: Adaptive
  19. Resolution: 144p, Size: 5.74 MB, Type: Adaptive Enter the number of the video stream to download: 0 Downloading video: 北赶契丹、南挡朱梁、中间打镇州!却在实力最弱的镇州,接连丧失大将【新五代演义79】 Downloading audio... Merging video and audio... ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers built with Apple clang version 15.0.0 (clang-1500.3.9.4) configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.2_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon libavutil 59. 8.100 / 59. 8.100 libavcodec 61. 3.100 / 61. 3.100 libavformat 61. 1.100 / 61. 1.100 libavdevice 61. 1.100 / 61. 1.100 libavfilter 10. 1.100 / 10. 1.100 libswscale 8. 1.100 / 8. 1.100 libswresample 5. 1.100 / 5. 1.100 libpostproc 58. 1.100 / 58. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/breestealth/Documents/DevelopmentRepository/AI-Youtube-Shorts-Generator/videos/video_北赶契丹、南挡朱梁、中间打镇州!却在实力最弱的镇州,接连丧失大将【新五代演义79】.mp4': Metadata: major_brand : dash minor_version : 0 compatible_brands: iso6av01mp41 creation_time : 2024-09-07T22:42:17.000000Z Duration: 00:16:34.27, start: 0.000000, bitrate: 2542 kb/s Stream #0:00x1: Video: av1 (libdav1d) (Main) (av01 / 0x31307661), yuv420p(tv, bt709), 1920x1080, 4 kb/s, 60 fps, 60 tbr, 15360 tbn (default) Metadata: creation_time : 2024-09-07T22:42:17.000000Z handler_name : ISO Media file produced by Google Inc. vendor_id : [0][0][0][0] Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/breestealth/Documents/DevelopmentRepository/AI-Youtube-Shorts-Generator/videos/audio_北赶契丹、南挡朱梁、中间打镇州!却在实力最弱的镇州,接连丧失大将【新五代演义79】.mp4': Metadata: major_brand : dash minor_version : 0 compatible_brands: iso6mp41 creation_time : 2024-09-07T22:40:08.000000Z encoder : Google Duration: 00:16:34.42, start: 0.000000, bitrate: 48 kb/s Stream #1:00x1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s (default) Metadata: creation_time : 2024-09-07T22:40:08.000000Z handler_name : ISO Media file produced by Google Inc. vendor_id : [0][0][0][0] Stream mapping: Stream #0:0 -> #0:0 (av1 (libdav1d) -> h264 (libx264)) Stream #1:0 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0x126f0b550] using SAR=1/1 [libx264 @ 0x126f0b550] using cpu capabilities: ARMv8 NEON [libx264 @ 0x126f0b550] profile High, level 4.2, 4:2:0, 8-bit [libx264 @ 0x126f0b550] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'videos/北赶契丹、南挡朱梁、中间打镇州!却在实力最弱的镇州,接连丧失大将【新五代演义79】.mp4': Metadata: major_brand : dash minor_version : 0 compatible_brands: iso6av01mp41 encoder : Lavf61.1.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 60 fps, 15360 tbn (default) Metadata: creation_time : 2024-09-07T22:42:17.000000Z handler_name : ISO Media file produced by Google Inc. vendor_id : [0][0][0][0] encoder : Lavc61.3.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2024-09-07T22:40:08.000000Z handler_name : ISO Media file produced by Google Inc. vendor_id : [0][0][0][0] encoder : Lavc61.3.100 aac [out#0/mp4 @ 0x600003de03c0] video:471606KiB audio:15960KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.326122% frame=59656 fps= 35 q=-1.0 Lsize= 489156KiB time=00:16:34.23 bitrate=4030.4kbits/s speed=0.582x [libx264 @ 0x126f0b550] frame I:242 Avg QP:20.18 size:268576 [libx264 @ 0x126f0b550] frame P:16161 Avg QP:23.51 size: 20607 [libx264 @ 0x126f0b550] frame B:43253 Avg QP:29.46 size: 1963 [libx264 @ 0x126f0b550] consecutive B-frames: 1.9% 3.7% 1.8% 92.7% [libx264 @ 0x126f0b550] mb I I16..4: 3.3% 75.0% 21.8% [libx264 @ 0x126f0b550] mb P I16..4: 0.9% 2.9% 0.3% P16..4: 30.7% 7.0% 5.6% 0.0% 0.0% skip:52.5% [libx264 @ 0x126f0b550] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 26.2% 0.2% 0.1% direct: 0.2% skip:73.2% L0:43.3% L1:55.6% BI: 1.0% [libx264 @ 0x126f0b550] 8x8 transform intra:71.0% inter:77.7% [libx264 @ 0x126f0b550] coded y,uvDC,uvAC intra: 54.8% 43.9% 17.8% inter: 4.1% 5.0% 1.2% [libx264 @ 0x126f0b550] i16 v,h,dc,p: 25% 37% 10% 28% [libx264 @ 0x126f0b550] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 17% 23% 5% 7% 6% 7% 6% 8% [libx264 @ 0x126f0b550] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 20% 11% 7% 10% 8% 8% 8% 7% [libx264 @ 0x126f0b550] i8c dc,h,v,p: 59% 20% 17% 4% [libx264 @ 0x126f0b550] Weighted P-Frames: Y:0.8% UV:0.7% [libx264 @ 0x126f0b550] ref P L0: 57.6% 20.2% 13.9% 8.4% 0.0% [libx264 @ 0x126f0b550] ref B L0: 93.8% 5.1% 1.1% [libx264 @ 0x126f0b550] ref B L1: 96.2% 3.8% [libx264 @ 0x126f0b550] kb/s:3885.67 [aac @ 0x126f0dc80] Qavg: 702.202 Downloaded: 北赶契丹、南挡朱梁、中间打镇州!却在实力最弱的镇州,接连丧失大将【新五代演义79】 to 'videos' folder File path: videos/北赶契丹、南挡朱梁、中间打镇州!却在实力最弱的镇州,接连丧失大将【新五代演义79】.mp4 Downloaded video and audio files successfully! at videos/北赶契丹、南挡朱梁、中间打镇州!却在实力最弱的镇州,接连丧失大将【新五代演义79】.mp4 MoviePy - Writing audio in audio.wav MoviePy - Done. Extracted audio to: audio.wav Transcribing audio... cpu [2024-09-17 08:23:55.864] [ctranslate2] [thread 401498] [warning] The compute type inferred from the saved model is float16, but the target device or backend do not support efficient float16 computation. The model weights have been automatically converted to use the float32 compute type instead. Model loaded Getting Highlight from Transcription Start: 923 , End: 987 Moviepy - Building video Out.mp4. MoviePy - Writing audio in OutTEMP_MPY_wvf_snd.mp3 MoviePy - Done. Moviepy - Writing video Out.mp4

Moviepy - Done ! Moviepy - video ready Out.mp4 Traceback (most recent call last): File "/Users/breestealth/Documents/DevelopmentRepository/AI-Youtube-Shorts-Generator/main.py", line 32, in crop_to_vertical("Out.mp4", croped) File "/Users/breestealth/Documents/DevelopmentRepository/AI-Youtube-Shorts-Generator/Components/FaceCrop.py", line 8, in crop_to_vertical detect_faces_and_speakers(input_video_path, "DecOut.mp4") File "/Users/breestealth/Documents/DevelopmentRepository/AI-Youtube-Shorts-Generator/Components/Speaker.py", line 110, in detect_faces_and_speakers Frames.append([x, y, x1, y1]) ^ UnboundLocalError: cannot access local variable 'x' where it is not associated with a value

cskonopka commented 3 days ago

+1

Same error