我目前在后台循环播放 GIF。但我想添加一个循环播放 10 张图片的图片幻灯片。我该如何实现?
我当前使用 GIF 的代码示例如下:
FFMPEG=ffmpeg
GIF= /home/randomgif.gif
STREAM_KEY=
TEXT=current_song.txt
COLOR="0xFFFFFF"
BCOLOR="0x000000"
INRES=1366x768 # input resolution
OUTRES=1366x768 # output resolution
FPS=15 # target FPS
GOP=30 # i-frame interval, should be double of FPS,
GOPMIN=15 # min i-frame interval, should be equal to fps,
THREADS=4 # max 6
CBR=1100k # constant bitrate (should be between 1000k - 3000k)
QUALITY=veryfast # one of the many FFMPEG preset
AUDIO_RATE=44100
KEYINT=$(expr $FPS \* 3)
$FFMPEG -thread_queue_size 1024 -f alsa -ac 2 -i hw:Loopback,1,0 -fflags +genpts -ignore_loop 0 -r $FPS -i $GIF \
-vf drawtext="fontfile=/usr/share/fonts/truetype/slant.ttf:bordercolor=$BCOLOR: borderw=1: fontcolor=$COLOR:textfile=$TEXT:reload=1:y=10:x=5:fontsize=38" \
-vcodec libx264 -x264opts keyint=$KEYINT:min-keyint=$KEYINT:scenecut=-1 -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p \
-s $OUTRES -preset $QUALITY -acodec aac -threads $THREADS -fflags nobuffer \
-bufsize $CBR -f flv "rtmp://a.rtmp.youtube.com/live2/$STREAM_KEY" \
2> log_stream.txt
答案1
-fflags +genpts -ignore_loop 0 -r $FPS -i $GIF
用-framerate $FPS -loop 1 -i img%d.jpg
图像所在的位置替换...。图像image1.jpg
应具有相同的分辨率。image2.jpg
image10.jpg