gpt4 book ai didi

php - 我想使用 ffmpeg 将图像用作 drawtext 视频的背景

转载 作者:行者123 更新时间:2023-12-04 23:02:52 26 4
gpt4 key购买 nike

目前,我能够使用 ffmpeg 创建视频,使用 drawtext 过滤器在黑色背景上绘制文本现在保留对我来说似乎很难的一件事,我认为这会很容易,直到我发现我做错了。我想使用图像作为 drawtext 过滤器的背景。即我想使用图像作为视频的背景,而不是使用背景颜色或视频背景。请有人带我完成这是我的代码`

echo shell_exec('ffmpeg -f lavfi -i color=color=black -vf drawtext="textfile=text.txt:expansion=normal:fontfile=FreeSerif.otf: y=h-line_h-20:x=-100*t: fontcolor=white: fontsize=50" -t '.$words_count.' textover09.mp4 -report'); `



ffmpeg started on 2018-01-07 at 22:53:03
Report written to "ffmpeg-20180107-225303.log"
Command line:
ffmpeg -loop 1 -i elena.jpg -vf "drawtext=textfile=text.txt:expansion=normal:fontfile=FreeSerif.otf: y=h-line_h-20:x=-100*t: fontcolor=white: fontsize=50" -t 46.2 textover09.mp4 -report
ffmpeg version git-2017-12-28-be4dfbf Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
configuration: --prefix=/usr/local/ffmpeg --extra-cflags=-I/usr/local/ffmpeg/include --extra-ldflags=-L/usr/local/ffmpeg/lib --bindir=/usr/local/bin --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libtheora --enable-filter=drawtext --enable-libfreetype
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 3.100 / 58. 3.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 8.100 / 7. 8.100
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Splitting the commandline.
Reading option '-loop' ... matched as AVOption 'loop' with argument '1'.
Reading option '-i' ... matched as input url with argument 'elena.jpg'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'drawtext=textfile=text.txt:expansion=normal:fontfile=FreeSerif.otf: y=h-line_h-20:x=-100*t: fontcolor=white: fontsize=50'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '46.2'.
Reading option 'textover09.mp4' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url elena.jpg.
Successfully parsed a group of options.
Opening an input file: elena.jpg.
[NULL @ 0x2c1fe80] Opening 'elena.jpg' for reading
[file @ 0x2c207c0] Setting default whitelist 'file,crypto'
[image2 @ 0x2c1fe80] Format image2 probed with size=2048 and score=50
[image2 @ 0x2c1fe80] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[image2 @ 0x2c1fe80] Opening 'elena.jpg' for reading
[AVIOContext @ 0x2c21f80] Statistics: 3871771 bytes read, 0 seeks
[mjpeg @ 0x2c21940] marker=d8 avail_size_in_buf=3871769
[mjpeg @ 0x2c21940] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x2c21940] marker=e0 avail_size_in_buf=3871767
[mjpeg @ 0x2c21940] marker parser used 16 bytes (128 bits)
[mjpeg @ 0x2c21940] marker=e2 avail_size_in_buf=3871749
[mjpeg @ 0x2c21940] marker parser used 3160 bytes (25280 bits)
[mjpeg @ 0x2c21940] marker=db avail_size_in_buf=3868587
[mjpeg @ 0x2c21940] index=0
[mjpeg @ 0x2c21940] qscale[0]: 2
[mjpeg @ 0x2c21940] index=1
[mjpeg @ 0x2c21940] qscale[1]: 2
[mjpeg @ 0x2c21940] marker parser used 132 bytes (1056 bits)
[mjpeg @ 0x2c21940] marker=c0 avail_size_in_buf=3868453
[mjpeg @ 0x2c21940] Changing bps from 0 to 8
[mjpeg @ 0x2c21940] sof0: picture: 5616x3744
[mjpeg @ 0x2c21940] component 0 2:2 id: 0 quant:0
[mjpeg @ 0x2c21940] component 1 1:1 id: 1 quant:1
[mjpeg @ 0x2c21940] component 2 1:1 id: 2 quant:1
[mjpeg @ 0x2c21940] pix fmt id 22111100
[mjpeg @ 0x2c21940] marker parser used 17 bytes (136 bits)
[mjpeg @ 0x2c21940] marker=c4 avail_size_in_buf=3868434
[mjpeg @ 0x2c21940] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x2c21940] escaping removed 6222 bytes
[mjpeg @ 0x2c21940] marker=da avail_size_in_buf=3868014
[mjpeg @ 0x2c21940] marker parser used 3861792 bytes (30894336 bits)
[mjpeg @ 0x2c21940] marker=d9 avail_size_in_buf=0
[mjpeg @ 0x2c22540] marker parser used 132 bytes (1056 bits)
[mjpeg @ 0x2c22540] marker=c0 avail_size_in_buf=3868453
[mjpeg @ 0x2c22540] sof0: picture: 5616x3744
[mjpeg @ 0x2c22540] component 0 2:2 id: 0 quant:0
[mjpeg @ 0x2c22540] component 1 1:1 id: 1 quant:1
[libx264 @ 0x2c24c40] i16 v,h,dc,p: 40% 53% 4% 3%
[libx264 @ 0x2c24c40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 10% 27% 7% 9% 8% 8% 9% 11%
[libx264 @ 0x2c24c40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 12% 11% 6% 9% 11% 7% 9% 6%
[libx264 @ 0x2c24c40] i8c dc,h,v,p: 53% 17% 21% 8%
[libx264 @ 0x2c24c40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x2c24c40] ref P L0: 56.3% 9.9% 21.1% 12.8%
[libx264 @ 0x2c24c40] ref B L0: 74.5% 22.4% 3.1%
[libx264 @ 0x2c24c40] ref B L1: 98.3% 1.7%
[libx264 @ 0x2c24c40] kb/s:4673.55
[AVIOContext @ 0x2c28ac0] Statistics: 32768 bytes read, 0 seeks

最佳答案

利用

ffmpeg -loop 1 -i image -vf scale=-2:1080,drawtext="textfile=text.txt:expansion=normal:fontfile=FreeSerif.otf: y=h-line_h-20:x=-100*t: fontcolor=white: fontsize=50" -pix_fmt yuv420p -t '.$words_count.' -movflags +faststart textover09.mp4

关于php - 我想使用 ffmpeg 将图像用作 drawtext 视频的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48139025/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com