Montspy / LooPyGen

Loopring Python Minter on Layer 2
17 stars 6 forks source link

[python] GIF generation fails on audio channel missing #50

Closed Montspy closed 2 years ago

Montspy commented 2 years ago

The workaround for missing audio channels does not behave as expected on some installs.

raise RuntimeError(f'Could not run ffmpeg command "{cmd}":\n\t{stderr.decode()}')
RuntimeError: Could not run ffmpeg command "ffmpeg -hide_banner -loglevel warning -y  -f image2 -pattern_type none -loop 0 -i "/var/www/html/tmp4pfhg9gx/tmp0b1px2g1.png"  -ignore_loop 1 -i "./images/wagmi_wolves_club_bodies/layer19/sparkle.gif" -f lavfi -i anullsrc -f lavfi -i anullsrc -filter_complex "amerge=inputs=2,pan=stereo|c0<c0+c2|c1<c1+c3[a]" -filter_complex "[0][1]overlay[ov]" -map [ov] -map [a] -c:v libvpx-vp9 -lag-in-frames 0 -lossless 1 -row-mt 1 -pix_fmt yuva420p -shortest "/var/www/html/tmp4pfhg9gx/tmp0801l87t.webm"":
        Stream map 'a' matches no streams.
To ignore this, add a trailing '?' to the map.

Confirmed ffmpeg version matches known working setups

./docker.sh ffmpeg
ffmpeg version 4.3.3-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx 
<snip>
 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Montspy commented 2 years ago

Reproduces on problematic install with this command:

./docker.sh ffmpeg -loglevel info -y -ss 00:00:00 -to 00:00:02 -f lavfi -i anullsrc -f lavfi -i anullsrc  -filter_complex "amerge=inputs=2[a]" -map "[a]" -ac 2 test.mp3

Command output extract:

Input #0, lavfi, from 'anullsrc':

  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
Input #1, lavfi, from 'anullsrc':

  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #1:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
Filter amerge has an unconnected output
Montspy commented 2 years ago

Potential fix to be tested in commit 14d97837e7ba188e991847698fab7b5a82c1ccc9

Montspy commented 2 years ago

Could not get user to test the fix, but it has been working well on my machine. Cherry-picked the fix into PR #47 (commit 26eb5b2ae7a6c16e17dbaf90fbe8c2e825a2fc5d) Will close this issue once it reaches main branch