如何使用FFMpeg的时间戳语法?

4

enter image description here

Hi, All!

     ffMpeg -timstamp 

选项像上图那样工作吗? 07:21:54 07/07/05 在黑色框容器中的白色文本。
在Ubuntu 12.04中, 执行的方式如下。
     ffmpeg -y -f video4linux2 -s vga -r 30 -fs 1M -i /dev/video0 -timestamp now -copyts ./USB1_Test_vga.mp4

但它不起作用。
是否有其他选项可以显示录制视频的时间?

1
ffmpeg -timestamp选项接受一个日期,它会将其存储在输出文件中。它与时间码无关,也不会导致任何文本被渲染。 - mark4o
1个回答

15

以前有一个drawtext过滤器。

ffmpeg -i in.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/DroidSans.ttf: timecode='09\:57\:00\:00': r=25: \
x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" -an -y out.mp4

请看这里:http://ffmpeg.org/trac/ffmpeg/wiki/FilteringGuide

我认为您可以使用类似sprintf的语法替换精确时间码。

ffmpeg -f video4linux2 -i /dev/video0 -s 640x480 -r 30 -vf \
"drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf: \
text='%{localtime\:%T}': fontcolor=white@0.8: x=7: y=460" -vcodec libx264 -vb 2000k \
-preset ultrafast -f mp4 output.mp4

请看这里:http://einar.slaskete.net/2011/09/05/adding-time-stamp-overlay-to-video-stream-using-ffmpeg/,这篇文章涉及到使用FFmpeg向视频流添加时间戳叠加。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接