Estou usando o ffmpeg via PHP para capturar miniaturas a cada 15 segundos de nossos vídeos, mas preciso adicionar um aviso de direitos autorais a cada um deles. Eu pesquisei o suficiente para descobrir que isso pode ser feito, e quais são os argumentos para fazê-lo, mas não consigo descobrir a sintaxe para usá-lo sem obter vários erros do ffmpeg, dependendo de onde / como eu colocá-lo no linha de comando.
Foi-me dito para fornecer a saída que estou recebendo, portanto, ela está incluída abaixo, mas o que preciso de ajuda é a sintaxe correta para especificar o que preciso com o comando FFMPEG.
a.) Comando de trabalho do FFMPEG:
ffmpeg.exe -i D:\video.mp4 -vf "thumbnail, scale=640:480, fps=1/15" D:\video_%05d.jpg
b.) Argumentos desejados para adicionar ao comando de trabalho acima:
"drawtext=fontsize=20:box=1:fontfile='c:/windows/fonts/arial.ttf:text=\'My Copyright Text\':x=(w-text_w)/2:0"
Como eu incluo corretamente os argumentos mostrados em b. com o comando em a. ?
c.) Sabor do que eu tentei:
Eu tentei colocar b. em vários lugares, como abaixo, mas todos produzem erros semelhantes de alguma forma ou de outra para e. abaixo.
ffmpeg.exe -i D:\video.mp4 -vf "thumbnail, scale=640:480, fps=1/15" "drawtext=fontsize=20:box=1:fontfile=c:\windows\fonts\arial.ttf:text='My Copyright Text':x=(w-text_w)/2:0" D:\video_%05d.jpg
e.) Exemplo de saída / erro
C:\>ffmpeg.exe -i D:\video.mp4 -vf "thumbnail, scale=640:480, fps=1/15 drawtext=fontsize=20:box=1:fontfile=Dc:\windows/fonts/arial.ttf:text='CMy Copyright Text':x=(w-text_w)/2:0" D:\captures\video_%05d.jpg -loglevel error
[fps @ 0000000004fec000] Unable to parse option value "1/15 drawtext=fontsize=20" as video rate
[Parsed_fps_2 @ 0000000005000980] Option 'box' not found
[AVFilterGraph @ 000000000509ba40] Error initializing filter 'fps' with args '1/15 drawtext=fontsize=20:box=1:fontfile=c:/windows/fonts/arial.ttf:text=CMy Copyright Text:x=(w-text_w)/2:0'
Error opening filters!
C:\>ffmpeg.exe -i D:\video.mp4 -vf "thumbnail, scale=640:480, fps=1/15", "drawtext=fontsize=20:box=1:fontfile=c:\windows/fonts/arial.ttf:text='CMy Copyright Text':x=(w-text_w)/2:0" D:\captures\video_%05d.jpg -loglevel error
[NULL @ 0000000005053140] Unable to find a suitable output format for 'drawtext=fontsize=20:box=1:fontfile=c:\windows/fonts/arial.ttf:text='CMy Copyright Text':x=(w-text_w)/2:0'
drawtext=fontsize=20:box=1:fontfile=c:\windows/fonts/arial.ttf:text='CMy Copyright Text':x=(w-text_w)/2:0: Invalid argument
C:\>ffmpeg.exe -i D:\video.mp4 -vf "thumbnail, scale=640:480, fps=1/15" D:\captures\video_%05d.jpg "drawtext=fontsize=20:box=1:fontfile=c:\windows/fonts/arial.ttf:text='CMy Copyright Text':x=(w-text_w)/2:0" -loglevel error
[NULL @ 0000000004fc49c0] Unable to find a suitable output format for 'drawtext=fontsize=20:box=1:fontfile=c:\windows/fonts/arial.ttf:text='CMy Copyright Text':x=(w-text_w)/2:0'
drawtext=fontsize=20:box=1:fontfile=c:\windows/fonts/arial.ttf:text='CMy Copyright Text':x=(w-text_w)/2:0: Invalid argument
Saída típica do Console
ffmpeg.exe -loglevel verbose -i d:\myvideo.mp4 -vf "thumbnail, scale=640:480, fps=1/15 drawtext=fontsize=30:box=1:fontfile=c:/windows/fonts/arial.ttf:text='My Copyright Text':x=(w-text_w)/2:0" D:\captures\captured_%05d.jpg
ffmpeg version N-73975-gda8b70b Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 52.100 / 56. 52.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 27.100 / 5. 27.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\myvideo.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2013-12-18 21:48:29
encoder : Encoded by LearningCORE
Duration: 00:29:09.88, start: 0.000000, bitrate: 1573 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
Metadata:
creation_time : 2013-12-18 21:48:29
handler_name : GPAC ISO Audio Handler
Stream #0:1(und): Video: h264 (Baseline), 3 reference frames (avc1 / 0x31637661), yuv420p(tv), 640x480 [SAR 1:1 DAR 4:3], 1436 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2013-12-17 21:37:07
handler_name : vide
encoder : AVC Coding
Stream #0:2(und): Data: none (rtp / 0x20707472), 12 kb/s
Metadata:
creation_time : 2013-12-18 21:37:13
Stream #0:3(und): Data: none (rtp / 0x20707472), 56 kb/s
Metadata:
creation_time : 2013-12-18 21:37:14
Stream #0:4(eng): Subtitle: mov_text (tx3g / 0x67337874), 640x480, 0 kb/s (default)
Metadata:
creation_time : 2013-12-18 21:48:43
handler_name : bc200_00.srt:hdlr=sbtl:lang=en:group=2:delay=0 - Imported with GPAC 0.5.0-rev4065
[Parsed_thumbnail_0 @ 0000000004fa6780] batch size: 100 frames
[Parsed_scale_1 @ 0000000004fc18c0] w:640 h:480 flags:'0x4' interl:0
[fps @ 0000000004fac9a0] Unable to parse option value "1/15 drawtext=fontsize=30" as video rate
[Parsed_fps_2 @ 0000000004fc2b80] Option 'box' not found
[AVFilterGraph @ 000000000505c0a0] Error initializing filter 'fps' with args '1/15 drawtext=fontsize=30:box=1:fontfile=c:/windows/fonts/arial.ttf:text=My Copyright Text:x=(w-text_w)/2:0'
[Parsed_fps_2 @ 0000000004fc2b80] 0 frames in, 0 frames out; 0 frames dropped, 0 frames duplicated.
Error opening filters!