FreekBes / insta_reddit_bot

[UNMAINTAINED] A bot which pulls images from Reddit and uploads them to Instagram. Former source code of @me_irl_bot
GNU General Public License v3.0
26 stars 10 forks source link

Bot crashes when its trying to upload video #13

Closed williamzerner closed 3 years ago

williamzerner commented 3 years ago

happens everytime its trying to upload video [AVIOContext @ 0000022a313390c0] Statistics: 131072 bytes read, 0 seeks Conversion failed!

at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
FreekBes commented 3 years ago

Can you upload more of the logs outputted when trying to upload a video? Or is this all it returns?

williamzerner commented 3 years ago

This is the main error . The rest of it is just the ffmpeg commands that were executed.

The complete error :

It's time to post! Subreddit set to /r/me_irl Found a post to handle: http://www.reddit.com//r/me_irl/comments/n4u0jx/me_irl/ Post added to done-list Downloading media... Initial mediaUrl: https://i.redd.it/xbgl6o5j15x61.gif Normal image detected Retrieving image mime type... URL: https://i.redd.it/xbgl6o5j15x61.gif GIF detected! Using videoHandler instead. Connection closed. YT-DL URL: https://www.reddit.com/r/me_irl/comments/n4u0jx/me_irl/ youtube-dl -o C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx-temp.mp4 https://www.reddit.com/r/me_irl/comments/n4u0jx/me_irl/ stdout: [RedditR] n4u0jx: Downloading JSON metadata [generic] xbgl6o5j15x61: Requesting header [generic] xbgl6o5j15x61: Downloading webpage [download] Destination: C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx-temp.mp4 [download] 100% of 21.49MiB in 00:03

stderr: WARNING: Falling back on generic information extractor. WARNING: URL could be a direct video link, returning it as such.

Download complete! Resizing MP4... ffmpeg -loglevel verbose -analyzeduration 20M -probesize 20M -y -re -i C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx-temp.mp4 -vcodec libx264 -b:v 3500k -vsync 2 -t 59 -acodec aac -b:a 128k -pix_fmt yuv420p -vf 'scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:white' C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx.mp4 Clearing temp folder... Unable to handle post! Error: Command failed: ffmpeg -loglevel verbose -analyzeduration 20M -probesize 20M -y -re -i C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx-temp.mp4 -vcodec libx264 -b:v 3500k -vsync 2 -t 59 -acodec aac -b:a 128k -pix_fmt yuv420p -vf 'scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:white' C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx.mp4 ffmpeg version n4.4-6-g7e9b9f24df Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10-win32 (GCC) 20210408 configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 Input #0, gif, from 'C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx-temp.mp4': Duration: 00:00:08.64, start: 0.000000, bitrate: 20869 kb/s Stream #0:0: Video: gif, 1 reference frame, bgra, 792x972, 16.67 fps, 16.67 tbr, 100 tbn, 100 tbc Stream mapping: Stream #0:0 -> #0:0 (gif (native) -> h264 (libx264)) Press [q] to stop, [?] for help [AVFilterGraph @ 00000221860ee240] No such filter: 'scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:white' Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0 [AVIOContext @ 000002218487b900] Statistics: 0 seeks, 0 writeouts [AVIOContext @ 0000022184879180] Statistics: 40606448 bytes read, 51 seeks Conversion failed!

at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {

killed: false, code: 1, signal: null, cmd: "ffmpeg -loglevel verbose -analyzeduration 20M -probesize 20M -y -re -i C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx-temp.mp4 -vcodec libx264 -b:v 3500k -vsync 2 -t 59 -acodec aac -b:a 128k -pix_fmt yuv420p -vf 'scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:white' C:\Users\HP\Documents\GitHub\insta_reddit_bot\temp\n4u0jx.mp4"

FreekBes commented 3 years ago

It seems to be an issue with ffmpeg filters, probably specific to Windows. Could you try and modify the -vf argument in the ffmpeg command to use " instead of ' (ffmpeg command is located in handlers/video.js), and let me know if it works then?

williamzerner commented 3 years ago

okay i replaced the ' to ". Will let you know the result.

Update Syntax error

Initializing...
C:\Users\HP\Documents\GitHub\insta_reddit_bot\handlers\video.js:81
                                                                command = "ffmpeg -loglevel verbose -analyzeduration 20M -probesize 20M -y -re -i " + downloadLoc + " -vcodec libx264 -b:v 3500k -vsync 2 -t 59 -acodec aac -b:a 128k -pix_fmt yuv420p -vf "scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:white" " + convertLoc;

                                                                           ^^^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\HP\Documents\GitHub\insta_reddit_bot\handlers\mediadownloader.js:1:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\HP\Documents\GitHub\insta_reddit_bot\handlers\instagram.js:6:25)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\HP\Documents\GitHub\insta_reddit_bot\bot.js:8:19)
FreekBes commented 3 years ago

Oh sorry, I forgot about escaping. Use \" instead of ', so command = "ffmpeg -loglevel verbose -analyzeduration 20M -probesize 20M -y -re -i " + downloadLoc + " -vcodec libx264 -b:v 3500k -vsync 2 -t 59 -acodec aac -b:a 128k -pix_fmt yuv420p -vf \"scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:white\" " + convertLoc;

williamzerner commented 3 years ago

I removed ' and it worked fine...this I had done before you gave the above solution. I havent ran into any error. In case i do i will use your solution. Thank you

FreekBes commented 3 years ago

If the issue reappears, please reopen it! Glad to hear it's now working fine.