
현재 다음을 사용하는 이 명령을 수정하려고 합니다.나뉘다ffmpeg에서 gif를 만드는 명령
ffmpeg -y -ss 30 -t 3 -i input.flv -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x]split[x1][x2];[x1]palettegen[p];[x2][p]paletteuse" output.gif
이것은 잘 작동합니다. 문제는 다음을 사용하여 gif에 텍스트 오버레이를 추가하려고 할 때입니다.golden ratio
ffmpeg -y -ss 30 -t 3 -i "input.mp4" -filter_complex "fps=10,scale=320:-1:flags=lanczos[x],drawtext=box=1:[email protected]:boxborderw=5:fontfile=font3.ttf:text='Stackoverflow':fontsize=24:fontcolor=white:x=(w-tw)/2:y=(h/PHI)+th[x];[x]split[x1][x2];[x1]palettegen[p];[x2][p]paletteuse" output.gif
이제 paleuse에 다른 변수를 추가해야 할지 잘 모르겠습니다. 한 번에 실행하려고 합니다.
오류는 다음과 같습니다
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2016-01-21 04:12:34
Duration: 00:04:24.38, start: 0.000000, bitrate: 730 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 640x360 [SAR 1:1 DAR 16:9], 632 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2016-01-21 04:12:35
handler_name : IsoMedia File Produced by Google, 5-11-2011
Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_drawtext_2
답변1
처음 몇 개의 필터 순서대로 그리기 텍스트를 적용합니다.
ffmpeg -y -ss 30 -t 3 -i "input.mp4"
-filter_complex "fps=10,scale=320:-1:flags=lanczos,
drawtext=box=1:[email protected]:boxborderw=5:fontfile=font3.ttf:text='Stackoverflow':fontsize=24:fontcolor=white:x=(w-tw)/2:y=(h/PHI)+th,
split[x1][x2];[x1]palettegen[p];[x2][p]paletteuse" output.gif
답변2
만일을 대비해 이 멋진 도구는 동일한 기능에 몇 가지 추가 기능을 제공하고 사용자 친화적인 GUI도 제공합니다.
https://github.com/lettier/gifcurry
Ubuntu에서는 설치가 간단합니다.
wget https://github.com/lettier/gifcurry/releases/download/6.0.0.0/gifcurry-6.0.0.0-x86_64.AppImag
chmod u+x gifcurry-6.0.0.0-x86_64.AppImage
./gifcurry-6.0.0.0-x86_64.AppImage
즐기다.