Eu estou tentando sobrepor um timestamp (data e hora em que o quadro é capturado) em quadros de vídeo para um arquivo de vídeo armazenado usando o ffmpeg.
Isso consegue exibir o tempo em segundos desde o início do vídeo:
ffmpeg -i in.webm -filter_complex "drawtext=fontfile=/usr/share/fonts/truetype/arial.ttf: text='%{pts \:flt}': x=100 : y=50 : box=1" -c:a copy out.webm
A documentação indica que pts
também pode receber um argumento gmtime
para imprimir a data e a hora,
pts
The timestamp of the current frame. It can take up to three arguments.
The first argument is the format of the timestamp; it defaults to flt for seconds as a decimal number with microsecond accuracy; hms stands for a formatted [-]HH:MM:SS.mmm timestamp with millisecond accuracy. gmtime stands for the timestamp of the frame formatted as UTC time; localtime stands for the timestamp of the frame formatted as local time zone time.
The second argument is an offset added to the timestamp.
If the format is set to localtime or gmtime, a third argument may be supplied: a strftime() format string. By default, YYYY-MM-DD HH:MM:SS format will be used.
Mas quando tento usar
%código%
Eu recebo o erro ffmpeg -i in.webm -filter_complex "drawtext=fontfile=/usr/share/fonts/truetype/arial.ttf: text='%{pts \:gmtime}': x=100 : y=50 : box=1" -c:a copy out.webm
.
ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (SUSE Linux)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-runtime-cpudetect --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-pic --enable-pthreads --enable-vaapi --enable-vdpau --disable-decoder=dca --enable-libdcadec --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtwolame --enable-libvo-aacenc --enable-libx264 --enable-libx265 --enable-libxvid --enable-version3 --enable-x11grab
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, matroska,webm, from 'in.webm':
Metadata:
encoder : Lavf56.40.101
Duration: 00:01:43.32, start: 0.007000, bitrate: 504 kb/s
Stream #0:0(eng): Video: vp8, yuv420p, 480x640, SAR 1:1 DAR 3:4, 1k fps, 1k tbr, 1k tbn, 1k tbc (default)
Metadata:
title : Video
Stream #0:1: Audio: opus, 48000 Hz, stereo, fltp (default)
[libvpx-vp9 @ 0x2083580] v1.3.0
[webm @ 0x20823a0] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, webm, to 'out.webm':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 480x640 [SAR 1:1 DAR 3:4], q=-1--1, 200 kb/s, 1k fps, 1k tbn, 1k tbc (default)
Metadata:
encoder : Lavc56.60.100 libvpx-vp9
Stream #0:1: Audio: opus, 48000 Hz, stereo (default)
Stream mapping:
Stream #0:0 (vp8) -> drawtext
drawtext -> Stream #0:0 (libvpx-vp9)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[Parsed_drawtext_0 @ 0x2084ea0] Invalid format 'gmtime'
Last message repeated 1 times
Past duration 0.999992 too large
[Parsed_drawtext_0 @ 0x2084ea0] Invalid format 'gmtime'
Last message repeated 28 times
Como obtenho o texto sobreposto para exibir a hora UTC em um formato AAAA-MM-DD HH: MM: SS?