ffmpeg # 画中画中的视频进行循环

ffmpeg # 画中画中的视频进行循环 

ffmpeg -i bunny.mp4 -vf "movie=test.mov[logo];[0:v][logo]overlay=x=100:y=100"  -y out.mp4

以上命令test.mov,只显示1遍,后边重复显示最后一帧。

如果想让test.mov一直循环呢? 添加:loop=0,setpts=N/FRAME_RATE/TB即可。

ffmpeg -i bunny.mp4 -vf "movie=test.mov:loop=0,setpts=N/FRAME_RATE/TB[logo];[0:v][logo]overlay=x=100:y=100"  -y out.mp4

Zero loop= arguments means infinity loop. Values greater zero sets repeat counts. setpts filters required for PTS adjusting for second and later repeats, otherwise most output muxers will fails with non-monotonic PTS increasing: loop does not recalc PTS.

loop=0表示无限循环,如果后边跟的是数字,则表示循环几遍。
setpts filters用于调整后续显示的pts。

另外,如果只想test.mov显示一遍,然后不显示呢?

Some filters with several inputs support a common set of options. These options can only be set by name, not with the short notation.

eof_action
The action to take when EOF is encountered on the secondary input; it accepts one of the following values:

repeat
Repeat the last frame (the default). (默认的 重复最后一帧)

endall
End both streams.

pass
Pass the main input through.

shortest
If set to 1, force the output to terminate when the shortest input terminates. Default value is 0.

repeatlast
If set to 1, force the filter to extend the last frame of secondary streams until the end of the primary stream. A value of 0 disables this behavior. Default value is 1.

利用eof_action即可控制只显示一遍。

ffmpeg -i bunny.mp4 -vf "movie=test.mov[logo];[0:v][logo]overlay=x=100:y=100:eof_action=pass" -vframes 1000 -y out.mp4

用以上命令,即可实现test.mov显示一遍,不再重复最后一帧。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值