ffmpeg - 按持续时间添加,缩放和设置多个水印的视图

时间:2017-03-17 05:01:26

标签: ffmpeg


我有一段视频/path/to/video.mp4
现在我想每6秒放置一个水印。我使用命令:

"ffmpeg" -i /path/to/video.mp4 
    -i /path/to/watermark-1.jpg \
    -i /path/to/watermark-2.jpg \
    -i /path/to/watermark-3.jpg \
    -i /path/to/watermark-4.jpg \
    -i /path/to/watermark-5.jpg \
    -i /path/to/watermark-6.jpg \
-filter_complex \
    "[0:0] scale=210:192 [tmp], \
    [tmp][1:v] overlay=47:97:enable='between(t,0,6)' [tmp]; \
    [tmp][2:v] overlay=47:97:enable='between(t,6,12)' [tmp]; \
    [tmp][3:v] overlay=47:97:enable='between(t,12,18)' [tmp]; \
    [tmp][4:v] overlay=47:97:enable='between(t,18,24)' [tmp]; \
    [tmp][5:v] overlay=47:97:enable='between(t,24,30)' [tmp]; \
    [tmp][6:v] overlay=47:97:enable='between(t,30,36)' [output]" \
-map [output] /path/to/output.mp4 2>&1

我试图缩放我的水印,但它缩放了视频,视频的声音也丢失了。

我错了什么?

1 个答案:

答案 0 :(得分:1)

您必须分别缩放每个水印。

"ffmpeg" -i /path/to/video.mp4 
    -i /path/to/watermark-1.jpg \
    -i /path/to/watermark-2.jpg \
    -i /path/to/watermark-3.jpg \
    -i /path/to/watermark-4.jpg \
    -i /path/to/watermark-5.jpg \
    -i /path/to/watermark-6.jpg \
-filter_complex \
"[1:0]scale=210:192[w1]; \
 [2:0]scale=210:192[w2]; \
 [3:0]scale=210:192[w3]; \
 [4:0]scale=210:192[w4]; \
 [5:0]scale=210:192[w5]; \
 [6:0]scale=210:192[w6]; \
    [0][w1] overlay=47:97:enable='between(t,0,6)'[v1]; \
    [v1][w2] overlay=47:97:enable='between(t,0,6)'[v2]; \
    [v2][w3] overlay=47:97:enable='between(t,0,6)'[v3]; \
    [v3][w4] overlay=47:97:enable='between(t,0,6)'[v4]; \
    [v4][w5] overlay=47:97:enable='between(t,0,6)'[v5]; \
    [v5][w6] overlay=47:97:enable='between(t,0,6)'" \
/path/to/output.mp4 2>&

显式设置地图时,仅输出映射的流。让FFmpeg在这里自动选择流。