可以使用getUserMedia()?同时访问不同的麦克风?
这应该是有用的
显然,视频源非常棘手: 使用getUserMedia从几个网络摄像头捕获视频
我想知道,对于音频源,问题是否有所不同.
我想用来fluent-ffmpeg创建一个目录或数据库条目的最后n个图像的视频.
哪种语法正确?
这些是我的尝试:
模仿shell命令
ffmpeg()
.addInput('ls *png | tail -n 17')
.inputOptions("-pattern_type glob")
.output("output.mp4").run()
Run Code Online (Sandbox Code Playgroud)
但它不接受shell命令;
空间分隔的路径
ffmpeg()
.addInput('a*.png b*.png ')
.inputOptions("-pattern_type glob")
.output("output.mp4").run()
Run Code Online (Sandbox Code Playgroud)
但它不接受以空格分隔的文件列表;
图像路径数组
ffmpeg()
.addInput(array) // ['aa.png', 'a1.png',,,'bbb.png']
.inputOptions("-pattern_type glob")
.output("output.mp4").run()
Run Code Online (Sandbox Code Playgroud)
但它不接受数组.
编辑:
此外,从使用节点fluent ffmpeg合并多个视频,我可以使用文件数组添加多个输入
var ffmpeg= require('fluent-ffmpeg');
var f=ffmpeg()
pngarr.forEach(p => f.input(p)) /// pngarr is my array of png paths
Run Code Online (Sandbox Code Playgroud)
但跑步
f.output("./output.mp4").run()
Run Code Online (Sandbox Code Playgroud)
我只获得一个0秒的视频,其中包含列表的第一个png.
我的页面包含<video>带有几个子标题<track>的这个标签。我想通过使用 jquery 单击相应的国旗来即时启用轨道:
<div id="lang">
<img src="mini/ita.png" class="it" alt="Italiano" title="Italiano" />
<img src="mini/eng.png" class="en" alt="English" title="English" />
</div>
<video controls="controls" >
<source src="webcast.webm" />
<source src="webcast.mp4" />
<source src="webcast.ogv" />
<track kind="subtitles" src="./sub-en.vtt" srclang="en" />
<track kind="subtitles" src="./sub-it.vtt" srclang="it" />
</video>
<script>
$('#lang img').click(function(){
language=$(this).attr('class');
$('video track').removeAttr('default');
$('video track[srclang='+language+']').attr('default','default');
});
</script>
Run Code Online (Sandbox Code Playgroud)
正确插入了“默认”属性,但没有显示副标题。手动插入默认属性效果很好(在 chrome 和 opera 上)。
我有从标准输出到达的数据列(在我的情况下是对mysql的调用),我想在每个循环中追加文件中的列.我能怎么做?
Standard output:
a1
a2
....
an
Run Code Online (Sandbox Code Playgroud)
保存在名为table.dat的文件中:
table.dat:
a1
a2
....
an
Run Code Online (Sandbox Code Playgroud)
然后产生另一个输出:
Further standard output:
b1
b2
....
bn
Run Code Online (Sandbox Code Playgroud)
附加到table.dat:
table.dat:
a1 b1
a2 b2
.... ....
an bn
Run Code Online (Sandbox Code Playgroud)
...等等.我可以使用粘贴,但我需要三个步骤:
line producing standard output > tmpfile;
paste prevfile tmpfile > table
mv table prevfile;
Run Code Online (Sandbox Code Playgroud)
是否有更快的方式,也许使用awk?
此解决方案: 向文件添加新列 会生成一个空表.
我正在尝试创建一个这样的定义列表:
<dl>
<dt>term1</dt>
<dd>definition1</dd>
<dt>term2</dt>
<dd>definition2</dd>
<dt>term3</dt>
<dd>definition3</dd>
</dl>
Run Code Online (Sandbox Code Playgroud)
通过使用此表单中的JSON:
{
"term1":"definition1"
"term1":"definition2"
"term3":"definition3"
}
Run Code Online (Sandbox Code Playgroud)
.用d3.js做最优雅的方式是什么?
PS:我想使用该<dl>元素,因为它似乎是在语义上表示键的最合适的方式:值对:
所以我有一个文件,如:
10 1 abc
10 2 def
10 3 ghi
20 4 elm
20 5 nop
20 6 qrs
30 3 tuv
Run Code Online (Sandbox Code Playgroud)
我想为第一列的每个值获取第二列的最大值,即:
10 3 ghi
20 6 qrs
30 3 tuv
Run Code Online (Sandbox Code Playgroud)
如何使用awk或类似的unix命令?
我想让这个例子/sf/answers/2351019541/同步.
这是正确的实施吗?
let times= async (n,f)=>{while(n-->0) await f();}
times(5,()=>
myfunc([1,2,3],err => err)
)
Run Code Online (Sandbox Code Playgroud)
myfunc 本身就是一个等待各种其他功能的异步功能:
async myfunc(params,cb){
await a( err => err )
await b( err => err )
await c( err => err )
}`
Run Code Online (Sandbox Code Playgroud) 从这些数组:
t = ["A","B","C"]
a = [1,2,3]
b = [4,5,6]
c = [7,8,9]
Run Code Online (Sandbox Code Playgroud)
我怎样才能获得这样的列表
[
{ 'A':1, 'B':4, 'C':7},
{ 'A':2, 'B':5, 'C':8},
{ 'A':3, 'B':6, 'C':9},
]
Run Code Online (Sandbox Code Playgroud)
这样在JSON中转储更有用吗?
在以下代码中,<progress>每个cicle都会更新html5 标记的值.我还可以使用Chrome的控制台看到它的价值动态变化.但为什么渲染只在循环结束时更新?
<!doctype html>
<meta charset="utf8"></meta>
<title></title>
<body>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<button>click</button>
<progress min="0" max="10000" value="0"></progress>
<script>
$("button").click(function(){
for(var i=0; i<8000; i++)
$("progress").val(i)
})
</script>
Run Code Online (Sandbox Code Playgroud) “使用 awk 对数字列表中的值进行分箱”提供了使用 awk 对列中的每组 3 个点进行平均的解决方案。
如何将其扩展到保持格式的无限数量的列?例如:
2457135.564106 13.249116 13.140903 0.003615 0.003440
2457135.564604 13.250833 13.139971 0.003619 0.003438
2457135.565067 13.247932 13.135975 0.003614 0.003432
2457135.565576 13.256441 13.146996 0.003628 0.003449
2457135.566039 13.266003 13.159108 0.003644 0.003469
2457135.566514 13.271724 13.163555 0.003654 0.003476
2457135.567011 13.276248 13.166179 0.003661 0.003480
2457135.567474 13.274198 13.165396 0.003658 0.003479
2457135.567983 13.267855 13.156620 0.003647 0.003465
2457135.568446 13.263761 13.152515 0.003640 0.003458
Run Code Online (Sandbox Code Playgroud)
每 5 行取平均值,应该输出类似
2457135.564916 13.253240 13.143976 0.003622 0.003444
2457135.567324 13.270918 13.161303 0.003652 0.003472
Run Code Online (Sandbox Code Playgroud)
其中第一个结果是前 1-5 行的平均值,第二个结果是 6-10 行的平均值。
我希望我的脚本能够接收这些互斥的输入选项:
script.py -i input.json;script.py '{"a":1}';echo '{"a":1}' | script.py来自 stdin(或)的 JSON cat input.json | script.py。以及这些互斥的输出选项:
所以我尝试使用这段代码
import json,sys,argparse
parser = argparse.ArgumentParser(description='Template for python script managing JSON as input/output format')
group = parser.add_mutually_exclusive_group()
group.add_argument('--input-file', '-i', type=str, help='Input file name containing a valid JSON.', default=sys.stdin)
group.add_argument('json', nargs='?', type=str, help='Input string containing a valid JSON.' , default=sys.stdin)
parser.add_argument('--output-file', …Run Code Online (Sandbox Code Playgroud) awk ×3
javascript ×3
bash ×2
html5 ×2
jquery ×2
python ×2
argparse ×1
arrays ×1
async-await ×1
average ×1
d3.js ×1
dictionary ×1
ffmpeg ×1
getusermedia ×1
html5-video ×1
json ×1
key-value ×1
loops ×1
media ×1
mongodb ×1
node.js ×1
progress-bar ×1
python-3.x ×1
sorting ×1
stdin ×1
uniq ×1