带背景色的ffmpeg
ffmpeg with background color
此命令适用于某些 GIF,但适用于其他一些 return 错误:
ffmpeg -f gif -f lavfi -i color=FFFFFF -i animated.gif -y
-filter_complex "[0][1]scale2ref[bg][gif];[bg]setsar=1[bg];[bg][gif]overlay=shortest=1"
-pix_fmt yuv420p -movflags frag_keyframe+empty_moov -movflags +faststart
-crf 20 -b:v 500k -f mp4 animated.mp4
错误:
[libx264 @ 0x55e79dc7e3c0] height not divisible by 2 (1400x933)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0
- maybe incorrect parameters such as bit_rate, rate, width or height
一些帮助修复它保持背景颜色功能?
使用
ffmpeg -f gif -f lavfi -i color=FFFFFF -i animated.gif -y
-filter_complex "[0][1]scale2ref[bg][gif];[bg]setsar=1[bg];[bg][gif]overlay=shortest=1,scale=w='2*trunc(iw/2)':h='2*trunc(ih/2)'"
-pix_fmt yuv420p -movflags frag_keyframe+empty_moov -movflags +faststart
-crf 20 -b:v 500k -f mp4 animated.mp4
对于yuv420p
输入,x264要求宽高都是偶数。
此命令适用于某些 GIF,但适用于其他一些 return 错误:
ffmpeg -f gif -f lavfi -i color=FFFFFF -i animated.gif -y
-filter_complex "[0][1]scale2ref[bg][gif];[bg]setsar=1[bg];[bg][gif]overlay=shortest=1"
-pix_fmt yuv420p -movflags frag_keyframe+empty_moov -movflags +faststart
-crf 20 -b:v 500k -f mp4 animated.mp4
错误:
[libx264 @ 0x55e79dc7e3c0] height not divisible by 2 (1400x933)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0
- maybe incorrect parameters such as bit_rate, rate, width or height
一些帮助修复它保持背景颜色功能?
使用
ffmpeg -f gif -f lavfi -i color=FFFFFF -i animated.gif -y
-filter_complex "[0][1]scale2ref[bg][gif];[bg]setsar=1[bg];[bg][gif]overlay=shortest=1,scale=w='2*trunc(iw/2)':h='2*trunc(ih/2)'"
-pix_fmt yuv420p -movflags frag_keyframe+empty_moov -movflags +faststart
-crf 20 -b:v 500k -f mp4 animated.mp4
对于yuv420p
输入,x264要求宽高都是偶数。