ffmpeg 加动态时间水印

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-21 14:00   1035   0

sprintf(lpCmdLine, "%s -i %s -f lavfi -i testsrc=duration=5:size=800x600:rate=30 -vf drawtext=\"fontfile=C\\\:/Windows/Fonts/arial.ttf:text='%%{pts\\:gmtime\\:%lld\\:%%Y-%%m-%%d\\ %%H\\\\\\:%%M\\\\\\:%%S\\\}':x=50:y=50:fontsize=24:fontcolor=white:shadowy=2\""
" -preset ultrafast -vcodec libx264 -acodec copy -f mp4 %s ",

szFFmpegPath, szInputPath, (long long)timet, szOutputPath);


cout << lpCmdLine << endl;

1> timet 时间转完豪秒的. 注意 utc时间与local 时间差了8个时区.

输入视频起始时间, 转了下毫秒,

2> ttf 可能找不到。就换个找到的.

3> 注意转义字符... 多加\\\\\\ 试一试

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP