这是我的代码,通过PHP运行为视频添加图像:
exec('ffmpeg -i input.mp4 -i logo.png -filter_complex
"[0:v][1:v] overlay=10:10" -pix_fmt yuv420p -c:a copy output.mp4');
Run Code Online (Sandbox Code Playgroud)
它运作良好,但问题是,图像按比例缩小或向上,取决于视频分辨率.例如,在以下图像中,徽标宽度是50px但视频分辨率不同:
还有这个
如何防止图像缩小/缩小?
感谢Mulvya,他提出了这些代码
ffmpeg -i input.mp4 -i logo.png -filter_complex
"[1:v][0:v]scale2ref=(W/H)*ih/8:ih/8[wm][base];[base][wm]overlay=10:10"
-pix_fmt yuv420p -c:a copy output.mp4
Run Code Online (Sandbox Code Playgroud)
和
ffmpeg -i input.mp4 -i logo.png -filter_complex
"[1:v][0:v]scale2ref=(W/H)*ih/8:ih/8[wm][base];[wm]setsar=1[wmsar];
[base][wmsar]overlay=10:10"
-pix_fmt yuv420p -c:a copy output.mp4
Run Code Online (Sandbox Code Playgroud)
这非常有效,但它不保持徽标宽高比.我在两个分辨率不同的视频上尝试了这个代码,这就是结果
还有这个
有可能改进这个解决方案吗?
我要建立这个

这是我的HTML代码
<div class="al-head-container">
<div></div>
<span>Center Websites</span>
</div>
Run Code Online (Sandbox Code Playgroud)
这是css:
.al-head-container{
margin: auto;
width: 100%;
padding:0 4%;
position: relative;
box-sizing: border-box;
}
.al-head-container > span{
font: 2.1em titr;
color: #ae7f00;
background-color: #FFFFFF;
position: absolute;
right: 0;
left:0;
}
.al-head-container > div{
width: 100%;
height: 20px;
background-image: url("../image/head-line.jpg");
position: relative;
top: 25px;
}
Run Code Online (Sandbox Code Playgroud)
但这是代码的结果

问题是span宽度设置为100%,宽度不适合其内容.这是我从萤火虫得到的

如您所见,文本涵盖了DIV包含该行的内容.
我试图设置display:inline-block为span但没有改变.如何使绝对定位的跨度宽度适合内容?
我正在遵循https://medium.com/@dennissmink/laravel-echo-server-how-to-24d5778ece8b 中给出的教程。
我安装了laravel-echo-server, redis, socket.io, laravel-echo。
这是配置 laravel-echo-server init
{
"authHost": "http://localhost",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
}
Run Code Online (Sandbox Code Playgroud)
这个js代码app.blade.php在所有页面的底部
<script type="module">
import …Run Code Online (Sandbox Code Playgroud) 每个网站都有元素,必须设置它们的宽度和高度。这是我的问题,我们如何设置宽度和高度,以便网站在不同宽度/高度的不同显示器上正常工作?是px首选%?什么时候应该使用 px,什么时候应该使用 %?每一种的优点和缺点是什么?
DIV在我的网站上有一个,它是css
div{
max-height:400px;
overflow:auto;
}
Run Code Online (Sandbox Code Playgroud)
我要创建一个按钮,只将其中的元素向下滚动DIV到某个位置而不是整个页面.我的意思是我想向下滚动DIV.我知道如何在整个页面中执行此操作,因为之前曾要求这样做,但我不知道这是怎么做的DIV.
我已经在许多 Laravel 应用程序中使用过中间件,但这是我以前从未发生过的愚蠢情况。中间件总是返回 falseAuth::check()
这是routes的User模块
<?php
Route::group(['middleware' => 'web', 'namespace' => 'Modules\User\Http\Controllers'], function () {
Route::get('/', 'UserController@index');
Route::get('login', 'LoginController@showLoginForm')->name('login');
Route::post('login', 'LoginController@login');
Route::post('logout', 'LoginController@logout')->name('logout');
});
Route::group(['middleware' => 'admin', 'prefix' => 'user', 'namespace' => 'Modules\User\Http\Controllers'], function () {
Route::get('register', 'RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'RegisterController@register');
});
Run Code Online (Sandbox Code Playgroud)
这是模块AdminMiddleware内部User
<?php
namespace Modules\User\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AdminMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed …Run Code Online (Sandbox Code Playgroud) 请看这段代码:
<html>
<head>
<style type="text/css">
html, body{
width:100%;
height:100%;
margin:0px;
}
#header{
width:100%;
height:100px;
position:fixed;
display:inline-block;
background-color:red;
padding:0 10px 10px 10px;
}
</style>
</head>
<body>
<div id="header">
<div id="header-container">
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是演示.的header必须具有100%的宽度,并且从左侧,右侧和底部10px的填充.请看这张照片

这是#header萤火虫的布局.正如你所看到的那样,右边的填充不在图像中,因为10px填充被添加到#header宽度中(你可以测试它).如何在#header不增加宽度的情况下为左,右和底设置100%宽度和10px填充?
我需要在模块的配置中获取文件的密钥。我User使用nWidart包创建了模块。这是registerConfig功能
protected function registerConfig()
{
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('user.php'),
], 'config');
$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'user'
);
}
Run Code Online (Sandbox Code Playgroud)
我创建了一个名为的文件menu.php,该文件返回带有键的数组items,然后尝试执行此操作
dd(config('user::config.name'))
dd(config('user::menu.items'))
Run Code Online (Sandbox Code Playgroud)
它们都返回null。我也尝试过php artisan vendor-publish,UserServiceProvider但它仍然返回null。如何退回钥匙?
更新
如果我只是这样做:config()我将获得配置数组的完整数组,并可以在其中看到我的软件包配置文件。但是menu配置文件不在里面
pydantic中有一个DocumentSchema用FastApi编写的类的嵌套规则如下:
class DocumentSchema(BaseModel):
clientName: str
transactionId: str
documentList: List[SingleDocumentSchema]
Run Code Online (Sandbox Code Playgroud)
和
class SingleDocumentSchema(BaseModel):
documentInfo: DocumentInfoSchema
articleList: List[DocumentArticleSchema]
Run Code Online (Sandbox Code Playgroud)
和
class DocumentInfoSchema(BaseModel):
title: str
type: str
referenceId: int
batchNoList: Optional[List]
otherData: Optional[Json]
Run Code Online (Sandbox Code Playgroud)
和
class DocumentArticleSchema(BaseModel):
type: str
value: int
accountType: Optional[AccountTypeEnums]
accountId: Optional[int]
otherData: Optional[Json]
Run Code Online (Sandbox Code Playgroud)
这是从 Kafka 接收消息并处理它的 python 代码片段:
def process(self) -> bool:
try:
DocumentSchema(
**json.loads(self._message)
)
return self._process()
except ValidationError as e:
raise UnprocessableEntityException(e, self._topic)
except ValueError as e:
raise UnprocessableEntityException(e, self._topic)
except Exception as e:
raise UnprocessableEntityException(e, self._topic) …Run Code Online (Sandbox Code Playgroud) 在 C++ 中,不带括号的数组名称是指向数组第一个元素的指针。但是,我无法意识到以下代码是如何工作的
int main()
{
int x[] = {1, 2, 3, 4};
cout << "x = " << x << endl;
cout << "&x = " << &x << endl;
cout << "*(&x) = " << *(&x) << endl;
cout << "*x = " << *x << endl;
cout << "**(&x) = " << **(&x) << endl;
}
Run Code Online (Sandbox Code Playgroud)
这是输出
x = 0x7ffd179e9060
&x = 0x7ffd179e9060
*(&x) = 0x7ffd179e9060
*x = 1
**(&x) = 1
Run Code Online (Sandbox Code Playgroud)
我不明白的是
x = &x …