reticivis-net / mediaforge

A Discord bot for editing and creating videos, images, GIFs, and more!
GNU General Public License v3.0
82 stars 28 forks source link

Command 'twittercaption' raised an exception: CMDError: Command ('ffmpeg', '-i', '/dev/shm/mediaforge/sJzEtnhv.png', '-i', '/dev/shm/mediaforge/lGotDNED.png', '-filter_complex', "[0]format=yuva420p,geq=lum='p(X,Y)':a='if(gt(abs(W/2-X),W/2-49.152)*gt(abs(H/2-Y),H/2-49.152),if(lte(hypot(49.152-(W/2-abs(W/2-X)),49.152-(H/2-abs(H/2-Y))),49.152),255,0),255)'[media];[media]pad=w=iw+(iw*(12/500)*2):h=ih+(iw*(12/500)):x=(iw*(12/500)):y=0:color=#00000000[media];[1][media]vstack=inputs=2[stacked];[stacked]split=2[bg][fg];[bg]drawbox #151

Closed davebelling closed 1 year ago

reticivis-net commented 1 year ago

where traceback.txt

WR4F commented 1 year ago

I'm getting a similar error. @HexCodeFFF here are the logs I get attempting to run an /esmcaption command:

DATETIME:2023-01-17 20:34:16.151758
COMMAND:
TRACEBACK:
processing.common.CMDError: ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-13)
  configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg --disable-gnutls --disable-liblensfun --disable-libopencv --disable-podpages --disable-sndio --disable-stripping --enable-avfilter --enable-chromaprint --enable-frei0r --enable-gcrypt --enable-gpl --enable-ladspa --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdavs2 --enable-libdc1394 --enable-libdrm --enable-libfdk-aac --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libkvazaar --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librsvg --enable-librubberband --enable-libshine --enable-libsmbclient --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-nonfree --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-openssl --enable-postproc --enable-pthreads --enable-shared --enable-version3 --enable-vulkan --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened --enable-vaapi --enable-libmfx --enable-libvmaf --enable-libilbc --enable-libjxl --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, png_pipe, from '/dev/shm/mediaforge/GwHoiNnY.png':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: png, rgba(pc), 498x149 [SAR 2835:2835 DAR 498:149], 25 fps, 25 tbr, 25 tbn
Input #1, gif, from '/dev/shm/mediaforge/mOnaQEul.gif':
  Duration: 00:00:06.30, start: 0.000000, bitrate: 8868 kb/s
  Stream #1:0: Video: gif, bgra, 498x331, 16.67 fps, 16.67 tbr, 100 tbn
Stream mapping:
  Stream #0:0 (png) -> format:default
  Stream #1:0 (gif) -> format:default
  vstack:default -> Stream #0:0 (png)
Press [q] to stop, [?] for help
corrupted double-linked list

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/mediaforge-HXFskkj--py3.11/lib/python3.11/site-packages/discord/app_commands/commands.py", line 861, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mediaforge/src/commands/caption.py", line 175, in esmcaption
    await process(ctx, processing.vips.vipsutils.generic_caption_stack, [["VIDEO", "GIF", "IMAGE"]],
  File "/mediaforge/src/core/process.py", line 157, in process
    raise e
  File "/mediaforge/src/core/process.py", line 125, in process
    result = await run()
             ^^^^^^^^^^^
  File "/mediaforge/src/core/process.py", line 108, in run
    command_result = await func(*args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mediaforge/src/processing/vips/vipsutils.py", line 23, in generic_caption_stack
    return await processing.ffmpeg.naive_vstack(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mediaforge/src/processing/ffmpeg.py", line 560, in naive_vstack
    await run_command("ffmpeg", "-i", file0, "-i", file1, "-filter_complex",
  File "/mediaforge/src/processing/common.py", line 75, in run_command
    raise CMDError(f"Command {args} failed.") from CMDError(result)
processing.common.CMDError: Command ('ffmpeg', '-i', '/dev/shm/mediaforge/GwHoiNnY.png', '-i', '/dev/shm/mediaforge/mOnaQEul.gif', '-filter_complex', '[0]format=pix_fmts=yuva420p[0f];[1]format=pix_fmts=yuva420p[1f];[0f][1f]vstack=inputs=2', '-c:v', 'png', '-fs', '1G', '-fps_mode', 'vfr', '/dev/shm/mediaforge/OfzIEZRD.mp4') failed.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/mediaforge-HXFskkj--py3.11/lib/python3.11/site-packages/discord/ext/commands/hybrid.py", line 438, in _invoke_with_namespace
    value = await self._do_call(ctx, ctx.kwargs)  # type: ignore
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/pypoetry/virtualenvs/mediaforge-HXFskkj--py3.11/lib/python3.11/site-packages/discord/app_commands/commands.py", line 880, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'esmcaption' raised an exception: CMDError: Command ('ffmpeg', '-i', '/dev/shm/mediaforge/GwHoiNnY.png', '-i', '/dev/shm/mediaforge/mOnaQEul.gif', '-filter_complex', '[0]format=pix_fmts=yuva420p[0f];[1]format=pix_fmts=yuva420p[1f];[0f][1f]vstack=inputs=2', '-c:v', 'png', '-fs', '1G', '-fps_mode', 'vfr', '/dev/shm/mediaforge/OfzIEZRD.mp4') failed.

Seems like a problem with the actual commands being fed to ffmpeg? Or maybe ffmpeg is unable to run, for another reason.

WR4F commented 1 year ago

Shrinking or enlarging the tenor gif with /resize -1 -1 then results in an actual gif image that works with the same resolution.

I believe the problem might be related to the logic dealing with "gifs" that are actually just videos from tenor?

reticivis-net commented 1 year ago

Tenor gifs are just normal gifs since I specifically ask for the “HD GIF” format, though it could be the case that those gifs are tripping up ffmpeg. I’ll have to look into it

WR4F commented 1 year ago

The problem is no longer happening with the same gifs. It might be intermittent, or perhaps something was changed.

reticivis-net commented 1 year ago

I guess it’s intermittent cause I don’t think I even restarted the bot since yesterday