如何在 HP 触摸板上使用 webOS 命令行拍照?
在 webos 上,我正在运行 openssh,并且想使用命令行脚本拍照。
我怀疑这将包括一些 luna-send 命令,或者 gst-launch
但我对文档没有任何运气。
webos 没有任何预期的捕获工具,但我可以访问 /dev/video0 设备。
编辑:我注意到触摸板安装了 ffmpeg 实用程序,但它无法识别 video4linux2 格式
到目前为止,我正在使用以下代码尝试 Gopherkhan 的建议;
luna-send -n 1 palm://com.palm.mediad.MediaCapture/startImageCapture \
'{"path":"/media/internal/foo1.png","options":[{"quality" \
:100,"flash":2,'reviewDuration':0,'exifData':{}}]}'
但它只是挂在那里什么都不做,过了一会儿就这样说了;
{"serviceName":"com.palm.mediad.MediaCapture","returnValue":false,"errorCode":-1 \
,"errorText":"com.palm.mediad.MediaCapture is not running."} \
(process:8534): LunaService-CRITICAL **: AppId msg type: 17
on webos, I have openssh running and would like to take a picture using the command line script.
I suspect this is going to include some luna-send command, or alternatively a gst-launch
But I am not having any luck with the docs.
webos doesn't have any of the expected capture tools, but I can access the /dev/video0 device.
Edit: i noticed that the touchpad has the ffmpeg utility installed, but it doesn't recognise the video4linux2 format
So far, I am trying Gopherkhan's suggestions with the following code;
luna-send -n 1 palm://com.palm.mediad.MediaCapture/startImageCapture \
'{"path":"/media/internal/foo1.png","options":[{"quality" \
:100,"flash":2,'reviewDuration':0,'exifData':{}}]}'
but its just hanging there doing nothing, after a while is says this;
{"serviceName":"com.palm.mediad.MediaCapture","returnValue":false,"errorCode":-1 \
,"errorText":"com.palm.mediad.MediaCapture is not running."} \
(process:8534): LunaService-CRITICAL **: AppId msg type: 17
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,使用 luna-sends 执行此操作有点棘手,并且在技术上不受支持。
您可能想要使用 MediaCapture 库,该库可以在设备上找到:
要将其包含在您的 enyo 应用程序中,请将以下内容放入您的 dependent.js 中:
涉及三个主要步骤。
下面是一个示例:
在场景中声明组件
调用初始化方法:
在 onInitialized 回调中
使用属性包定位设备数量可用的。通常,描述为“相机/摄像机”、“前置麦克风”和“面向用户的相机”
拍照。
卸载设备:
要使用旧的 JS 框架执行此操作,请参阅:
https://developer.palm.com/content/api /reference/javascript-libraries/media-capture.html
现在,您可以使用 luna-send 执行类似的操作,但同样,我认为它在技术上不受支持。您可能在启动/保持媒体捕获服务活动等方面遇到问题。但是,如果您想尝试,您可以执行以下操作:
1。获取媒体服务器实例 --- 这将返回一个端口实例号
这将返回带有端口号的捕获服务的位置,a la:
由于这是订阅,因此不要终止请求。只需打开一个新终端即可。
2.打开一个新终端。使用步骤 1 中返回的“位置”作为您的新服务 URI:
您应该看到:
调用是否正确完成。您可以安全地按 ctrl+c 退出此通话。
3.拍下你的照片。(你可以在最后一次调用中按 ctrl+c,然后在此处提供参数)
再次,你应该看到:
调用是否正确完成。
您应该听到快门声,图像将显示在“照片”应用程序的照片卷中。
So to do this with luna-sends is a bit tricky, and technically not supported.
You're probably going to want to hit the MediaCapture library, which can be found on the device here:
To include it in your enyo app drop the following in your depends.js:
There are three main steps involved.
Here's a sample:
Declare the component in your scene
Call the initialize method:
In your onInitialized callback
Use the property bag to locate the number of devices that are available. Typically, the descriptions are "Camera/Camcorder", "Front Microphone", and "User facing camera"
Take a photo.
Unload the device:
To do this with the old JS frameworks, see:
https://developer.palm.com/content/api/reference/javascript-libraries/media-capture.html
Now, you can do something similar with luna-send, but again, I don't think it's technically supported. You might have trouble with starting-up/keeping-alive the media capture service, etc. BUT, if you want to try, you could do something along the lines of:
1. get the media server instance --- this returns a port instance number
This will return a location of the capture service with a port number, a la:
Since this is a subscription, don't kill the request. Just open a new terminal.
2. Open a new terminal. Use the "location" returned in step 1 as your new service uri:
You should see:
if the call completed correctly. You can safely ctrl+c out of this call.
3. Take your picture. (you can ctrl+c out of the last call, and just supply the args here)
Again, you should see:
if the call completed correctly.
You should hear a shutter click, and the image will show up in the Photos app, in your Photo Roll.
另一种选择是使用 gst-launch 管道,这可能会受益于使用跨平台工具。到目前为止,我已经成功使用命令行启动网络摄像头;
gst-launch camsrc .src!视频/x-raw-yuv,宽度=320,高度=240,帧率=30/1
!掌上视频编码器! avimux 名称=多路复用器!文件接收器位置=test1.avi alsasrc !
palmaudioencoder
但不拍摄单个图像;
但我无法让它识别 .src_still 选项卡。当我继续进行时,我将用这种替代方法更新这个答案。
An alternative, which might some benefit of using cross platform tools, is to the use the gst-launch pipeline. So far I have managed to start the web cam using command line;
gst-launch camsrc .src ! video/x-raw-yuv,width=320,height=240,framerate=30/1
! palmvideoencoder ! avimux name=mux ! filesink location=test1.avi alsasrc !
palmaudioencoder
but not take a single image;
but I can't get it to recognise the .src_still tab. I will update this answer with this alternative method as I proceed.