我想转发实时 HLS 流。我想使用 auth_request 模块。我想通过传递密钥来检查请求是否有效。所以类似:http://domain.com/hls/stream.m3u8 ?key=xxxxxxx
我在 nginx.conf 中有以下设置:
location /hls {
alias /tmp/hls;
auth_request /hls/auth;
}
location /hls/auth {
proxy_pass http://localhost.com:8080/on_play.php;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
Run Code Online (Sandbox Code Playgroud)
现在我需要在http://localhost.com:8080/on_play.php中获取 key=xxxxx 。
我尝试了很多,但似乎没有任何效果。我也尝试过类似的事情:
location /hls {
alias /tmp/hls;
auth_request http://localhost.com:8080/on_play.php?key=$arg_key;
}
Run Code Online (Sandbox Code Playgroud)
但这也行不通。似乎不可能在 on_play.php 中获取关键参数
$_SERVER["REQUEST_URI"] 也不包含参数。
还尝试了以下配置:
我也尝试过类似的方法,但这也不起作用:
location ~ ^/hls/(long|short)/([0-9a-zA-Z]+)\.m3u8 {
alias /tmp/hls/$1/$2.m3u8;
auth_request /hls/auth-play/$1/$2;
}
location ~ ^/hls/auth-play/(long|short)/([0-9a-zA-Z]+) {
proxy_pass http://loclahost.com:8080/on_play.php?app=$1&room=$2;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
Run Code Online (Sandbox Code Playgroud)
但这也行不通。
nginx -V …
我有一堆MPEG文件,它们有些无效或不正确.我可以在不同的媒体播放器中播放文件,但是当我上传文件时,它们应该自动转换.创建屏幕截图需要很长时间,它会创建大约10000个屏幕截图,而不是预期的50个屏幕截图.该命令是自动转换应用程序的一部分.使用mp4和其他文件,它工作得很好,但是它没有按预期工作.屏幕截图的创建消耗了所有内存和处理器能力.
为了创建屏幕截图,我尝试了以下内容:
ffmpeg -y -i /input/file.mpeg -f image2 -aspect 16:9 -bt 20M -vsync passthrough -vf select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)' /output/file-%05d.jpg
Run Code Online (Sandbox Code Playgroud)
这只是创建2个截图,而我预计50左右.以下命令:
ffmpeg -y -i /input/file.mpeg -f image2 -vf fps=fps=1/10 -aspect 16:9 -vsync passthrough -bt 20M /output/file-%05d.jpg
Run Code Online (Sandbox Code Playgroud)
给了我关于缓冲区的错误:
ffmpeg version N-39361-g1524b0f Copyright (c) 2000-2014 the FFmpeg developers
built on Feb 26 2014 23:46:40 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-4)
configuration: --prefix=/home/example/ffmpeg_build --extra-cflags=-I/home/example/ffmpeg_build/include --extra-ldflags=-L/home/example/ffmpeg_build/lib --bindir=/home/example/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libfreetype --enable-libspeex --enable-libtheora
libavutil 52. 66.100 / 52. 66.100 …Run Code Online (Sandbox Code Playgroud) 从我正在阅读的"Redis in Action"一书中我看到了以下示例,现在我想知道这是否正确.该示例在python中具有以下代码:
def purchase_item(conn, buyerid, itemid, sellerid, lprice):
buyer = "users:%s"%buyerid
seller = "users:%s"%sellerid
item = "%s.%s"%(itemid, sellerid)
inventory = "inventory:%s"%buyerid
end = time.time() + 10
pipe = conn.pipeline()
while time.time() < end:
try:
pipe.watch("market:", buyer) #A
price = pipe.zscore("market:", item) #B
funds = int(pipe.hget(buyer, "funds")) #B
if price != lprice or price > funds: #B
pipe.unwatch() #B
return None
pipe.multi() #C
pipe.hincrby(seller, "funds", int(price)) #C
pipe.hincrby(buyer, "funds", int(-price)) #C
pipe.sadd(inventory, itemid) #C
pipe.zrem("market:", item) #C
pipe.execute() #C
return …Run Code Online (Sandbox Code Playgroud)