Google Speech API Empty Answer - api

For tests I used the Google Example of the speech api (https://cloud.google.com/speech-to-text/docs/reference/rest/v1/speech/recognize)
There I tried a .ogg file
This one (https://www.dropbox.com/s/lw66x3g143mtnsl/SpeechToText.ogg?dl=0)
I converted the audio file to 16000Hz
Here is the full request
{
"audio": {
"content": " content "
},
"config": {
"encoding": "OGG_OPUS",
"languageCode": "de-DE",
"sampleRateHertz": 16000
}
}
I converted then the aduio file with an Base64 Encoder (https://www.giftofspeed.com/base64-encoder/) So the content was too long for here.
Now my problem I get just an empty answer. I get the code 200 but nothing else
Thanks for all answers !

The .ogg file URL you referenced was encoded with codec Vorbis not Opus. You can use opus-tools to encode your audio file to an Opus file before you provide it to Google's service
Here's the debugging I used to identify your file as Vorbis:
opusinfo
$ opusinfo SpeechToText.ogg
Processing file "SpeechToText.ogg"...
Use ogginfo for more information on this file.
New logical stream (#1, serial: ffe6c0ca): type Vorbis
Logical stream 1 ended
ffmpeg
$ ffmpeg -i SpeechToText.ogg
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
Input #0, ogg, from 'SpeechToText.ogg':
Duration: 00:00:03.41, start: 0.000000, bitrate: 116 kb/s
Stream #0:0: Audio: vorbis, 16000 Hz, stereo, fltp, 160 kb/s
Metadata:
ENCODER : Lavc58.18.100 libvorbis

Related

migrate ffprobe command to ffmpeg-python

I currently am trying to migrate the following command from ffprobe to ffmpeg-python
ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4
I tried the following and it did not work
ffmpeg.probe(file_path, v='error', select_streams='v:0', count_packets=True, show_entries=True, stream='nb_read_packets', of=True, csv='p=0')
I have tried this inputting it as a dictionary as well
ffmpeg.probe(file_path, **{'v':'error', 'select_streams':'v:0', 'count_packets':1, 'show_entries':1, 'stream':'nb_read_packets', 'of':'csv=p=0'})
But none of these seem to work, any help would be appreciated
TL;DR Answer
With the way the parameters for the python bindings for ffmpeg-python work, the format of the command you are inputting is incorrect. Instead the following should work for you
import ffmpeg, json
out = ffmpeg.probe("input.mp4", cmd='ffprobe', v='error', select_streams='v:0', count_packets=None, show_entries='stream=nb_read_packets')
out["streams"][0]["nb_read_packets"]
Complete Answer
Digging through the API reference for the ffmpeg-python module, the python binding ffmpeg.probe, states that it will
Run ffprobe on the specified file and return a JSON representation of
the output.
Debugging through the module/source code, this python binding for ffprobe will always add the command line options -show_format, -show_streams, -of json to your command that you pass in as defined in the
_probe.py file.
So for the ffprobe command you provided:
ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4
will essentially be this command line options after passing through ffmpeg.fprobe:
ffprobe -show_format -show_streams -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 -of json input.mp4
I downloaded an mp4 video that was probably a chromecast commercial based on the description. Here's the gist link that I found it from, and look for the title "For Bigger Escape". I downloaded the file and renamed it input.mp4 to match the example you provided.
After running
>ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4
361
>
I get 361.
Now running the command:
ffprobe -show_format -show_streams -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 -of json input.mp4
I get the output
{
"programs": [
],
"streams": [
{
"nb_read_packets": "361",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "und",
"handler_name": "VideoHandler"
}
}
],
"format": {
"filename": "input.mp4",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": "0.000000",
"duration": "15.045000",
"size": "2299653",
"bit_rate": "1222813",
"probe_score": 100,
"tags": {
"major_brand": "mp42",
"minor_version": "0",
"compatible_brands": "isommp42",
"creation_time": "2013-11-12T06:38:58.000000Z"
}
}
}
That value of 361 is now in key value of nb_read_packets
I tried exactly replicating the command line
out= ffmpeg.probe("input.mp4", cmd='ffprobe', v='error', select_streams='v:0', count_packets=None, show_entries='stream=nb_read_packets', of='csv=p=0')
in ffmpeg-python, but I keep getting a JSONDecodeError:
The value of s from the debugger showed this string value:
s
'361,1,0,0,0,0,0,0,0,0,0,0,0,und,VideoHandler\r\ninput.mp4,2,0,"mov,mp4,m4a,3gp,3g2,mj2",QuickTime / MOV,0.000000,15.045000,2299653,1222813,100,mp42,0,isommp42,2013-11-12T06:38:58.000000Z\r\n'
My only assumption is with the -of or -print_format option, some characters were stripped or modified and that is giving the json decoder issues to decode it.
I finally decided to take out the -of csv=p=0 flag and the following was able to run with no errors
import ffmpeg, json
out = ffmpeg.probe("input.mp4", cmd='ffprobe', v='error', select_streams='v:0', count_packets=None, show_entries='stream=nb_read_packets')
value = out["streams"][0]["nb_read_packets"]
print(value)
361
Side Note
Some of the options that do not have direct parameters following them are defined as None because they do not have any parameters. This has been brought up several times in open issues from the github repo, and I have previously commented on it. It is not stated in the documents, and as far as I know, no PRs are out to update the docs to explicitly state it.

imagemin-pngquant cannot execute binary

I am trying to use imagemin with imagemin-pngquant to reduce images in an AWS Lambda function. Here is the code that I've made using the docs as a reference:
(image.data is the Buffer I'm creating from an axios .get() with arrayBuffer as the responseType)
// We want to minify the image before we upload it
let converted_image = await imagemin.buffer(await image.data, {
plugins: [
imageminPngquant({
quality: [.55, .65],
speed: 8,
strip: true
})
],
})
However, when I try to use the pngquant plugin to compress pngs, it does not work. Here is the exact error that I'm getting:
Error: Error: /var/task/node_modules/pngquant-bin/vendor/pngquant: /var/task/node_modules/pngquant-bin/vendor/pngquant: cannot execute binary file"}%

How to properly use eglfs on Beaglebone Black?

Project description
I am using Yocto to build my embedded Linux for Beaglebone Black. Embedded Linux will be used to host my Qt5 graphicall application.
Embedded Linux image is build for MACHINE defined in poky/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf and not for the one from the repository meta-ti (this one gave me problems).
In the embedded Linux image that I am building I already managed to add (a) Qt5 libraries that my application needs to compile with bitbake and (b) my Qt5 application which sucessfully compiles with bitbake.
Qt5 libraries were appended to the image like this:
IMAGE_INSTALL += "qtbase qwt-qt5"
And my Qt application was appended like this:
IMAGE_INSTALL += "application"
So libraries are installed through recipes qtbase and qwt-qt5 while my application was installed through recipe application which I wrote myself.
I can post a list of files that each recipe installs on the target's root file system:
┌───┐
│ $ │ ziga > ziga--hypervisor > build--beaglbone_black_c2
└─┬─┘ /dev/pts/1
└─> oe-pkgdata-util list-pkg-files qtbase qwt-qt5 application
application:
/usr/bin/executable
qtbase:
/usr/lib/libQt5Concurrent.so.5
/usr/lib/libQt5Concurrent.so.5.14
/usr/lib/libQt5Concurrent.so.5.14.2
/usr/lib/libQt5Core.so.5
/usr/lib/libQt5Core.so.5.14
/usr/lib/libQt5Core.so.5.14.2
/usr/lib/libQt5DBus.so.5
/usr/lib/libQt5DBus.so.5.14
/usr/lib/libQt5DBus.so.5.14.2
/usr/lib/libQt5Gui.so.5
/usr/lib/libQt5Gui.so.5.14
/usr/lib/libQt5Gui.so.5.14.2
/usr/lib/libQt5Network.so.5
/usr/lib/libQt5Gui.so.5.14
/usr/lib/libQt5Gui.so.5.14.2
/usr/lib/libQt5Network.so.5
/usr/lib/libQt5Network.so.5.14
/usr/lib/libQt5Network.so.5.14.2
/usr/lib/libQt5OpenGL.so.5
/usr/lib/libQt5OpenGL.so.5.14
/usr/lib/libQt5OpenGL.so.5.14.2
/usr/lib/libQt5PrintSupport.so.5
/usr/lib/libQt5PrintSupport.so.5.14
/usr/lib/libQt5PrintSupport.so.5.14.2
/usr/lib/libQt5Sql.so.5
/usr/lib/libQt5Sql.so.5.14
/usr/lib/libQt5Sql.so.5.14.2
/usr/lib/libQt5Test.so.5
/usr/lib/libQt5Test.so.5.14
/usr/lib/libQt5Test.so.5.14.2
/usr/lib/libQt5Widgets.so.5
/usr/lib/libQt5Widgets.so.5.14
/usr/lib/libQt5Widgets.so.5.14.2
/usr/lib/libQt5XcbQpa.so.5
/usr/lib/libQt5XcbQpa.so.5.14
/usr/lib/libQt5XcbQpa.so.5.14.2
/usr/lib/libQt5Xml.so.5
/usr/lib/libQt5Xml.so.5.14
/usr/lib/libQt5Xml.so.5.14.2
qwt-qt5:
/usr/lib/libqwt.so.6
/usr/lib/libqwt.so.6.1
/usr/lib/libqwt.so.6.1.4
Application can't display graphics
Now I login to the target and run my application which can not display the graphics:
root#beaglebone-yocto:~# executable
2020/09/20 10:44:26.560: Warning: Could not connect to display
2020/09/20 10:44:26.581: Info: Could not load the Qt platform plugin "xcb" in "" even though it was found.
2020/09/20 10:44:26.581: Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix the problem.
Available platform plugins are: minimal, offscreen, vnc, xcb.
Aborted
It looks like I have to somehow configure "Qt Platform Abstraction" (QPA) which is the platform abstraction layer for Qt5 with a lot of plugins (source) that also include a lot of platforms.
My application only uses a single window so I could probably go with qeglfs or qlinuxfb. But because Beaglebone Black integrates Imagination's GPU PowerVR SGX530 which supports OpenGL|ES 2.0 (source) and this is why I want to go with qeglfs platform. Note however that currently qeglfs platform was not listed in the above error report:
Available platform plugins are: minimal, offscreen, vnc, xcb.
I managed to install the qeglfs platform by creating a qtbase_%.bbappend file with this content:
PACKAGECONFIG:append = " eglfs gles2"
Note that this activates qtbase recipe's lines:
PACKAGECONFIG[eglfs] = "-eglfs,-noeglfs,drm"
PACKAGECONFIG[gles2] = "-opengl es2,,virtual/libgles2 virtual/egl"
These lines make sure that compilation includes eglfs as well as OpenGL|ES i.e. gles2. I chose to also include gles2 after reading / watching this (source, source):
So I asumed that eglfs also needs gles2.
Now eglfs is installed and is listed when I try to execute my application in the same way as before:
root#beaglebone-yocto:~# executable
2020/09/20 10:44:26.560: Warning: Could not connect to display
2020/09/20 10:44:26.581: Info: Could not load the Qt platform plugin "xcb" in "" even though it was found.
2020/09/20 10:44:26.581: Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix the problem.
Available platform plugins are: eglfs, minimal, offscreen, vnc, xcb.
Aborted
But when I try to use eglfs I get errors:
root#beaglebone-yocto:~# env QT_QPA_PLATFORM=eglfs executable
2020/09/20 11:01:17.525: Warning: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
error: XDG_RUNTIME_DIR not set in the environment
error: XDG_RUNTIME_DIR not set in the environment
error: XDG_RUNTIME_DIR not set in the environment
2020/09/20 11:01:17.533: Fatal: Could not initialize egl display
Aborted
All the errors except for the last one can be fixed by adding some enviromental variables like this:
root#beaglebone-yocto:~# env QT_QPA_PLATFORM=eglfs XDG_RUNTIME_DIR=/tmp/runtime-root executable
2020/09/20 11:01:17.533: Fatal: Could not initialize egl display
Aborted
But as you can see the last error remains and I don't know how to fix it.
Debug info reveals nothing
I tried exporting some enviromental variables to make debug more verbose and then I ran application again:
root#beaglebone-yocto:~# export QT_LOGGING_RULES=true
root#beaglebone-yocto:~# export QSG_INFO=1
root#beaglebone-yocto:~# export QT_QPA_EGLFS_DEBUG=1
root#beaglebone-yocto:~# export QT_DEBUG_PLUGINS=1
root#beaglebone-yocto:~# export QT_QPA_PLATFORM=eglfs
root#beaglebone-yocto:~# export QT_QPA_EGLFS_INTEGRATION=none
root#beaglebone-yocto:~# export XDG_RUNTIME_DIR=/tmp/runtime-root
root#beaglebone-yocto:~# executable
2022/02/17 20:54:28.448: Debug: QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/plugins/platforms" ...
2022/02/17 20:54:28.450: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqeglfs.so"
2022/02/17 20:54:28.451: Warning: Found metadata in lib /usr/lib/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archreq": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.451: Debug: Got keys from plugin meta data ("eglfs")
2022/02/17 20:54:28.451: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqlinuxfb.so"
2022/02/17 20:54:28.452: Warning: Found metadata in lib /usr/lib/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archreq": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.453: Debug: Got keys from plugin meta data ("linuxfb")
2022/02/17 20:54:28.453: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqminimal.so"
2022/02/17 20:54:28.454: Warning: Found metadata in lib /usr/lib/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archreq": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.454: Debug: Got keys from plugin meta data ("minimal")
2022/02/17 20:54:28.454: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqminimalegl.so"
2022/02/17 20:54:28.455: Warning: Found metadata in lib /usr/lib/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archreq": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.456: Debug: Got keys from plugin meta data ("minimalegl")
2022/02/17 20:54:28.456: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqoffscreen.so"
2022/02/17 20:54:28.457: Warning: Found metadata in lib /usr/lib/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archreq": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.457: Debug: Got keys from plugin meta data ("offscreen")
2022/02/17 20:54:28.457: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqvnc.so"
2022/02/17 20:54:28.458: Warning: Found metadata in lib /usr/lib/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archreq": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.458: Debug: Got keys from plugin meta data ("vnc")
2022/02/17 20:54:28.459: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqxcb.so"
2022/02/17 20:54:28.459: Warning: Found metadata in lib /usr/lib/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archreq": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.460: Debug: Got keys from plugin meta data ("xcb")
2022/02/17 20:54:28.460: Debug: QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
2022/02/17 20:54:28.512: Debug: loaded library "/usr/lib/plugins/platforms/libqeglfs.so"
2022/02/17 20:54:28.513: Debug: QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/plugins/egldeviceintegrations" ...
2022/02/17 20:54:28.514: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/egldeviceintegrations/libqeglfs-emu-integration.so"
2022/02/17 20:54:28.515: Warning: Found metadata in lib /usr/lib/plugins/egldeviceintegrations/libqeglfs-emu-integration.so, metadata=
{
"IID": "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5",
"MetaData": {
"Keys": [
"eglfs_emu"
]
},
"archreq": 0,
"className": "QEglFSEmulatorIntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.516: Debug: Got keys from plugin meta data ("eglfs_emu")
2022/02/17 20:54:28.516: Debug: QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/egldeviceintegrations/libqeglfs-x11-integration.so"
2022/02/17 20:54:28.517: Warning: Found metadata in lib /usr/lib/plugins/egldeviceintegrations/libqeglfs-x11-integration.so, metadata=
{
"IID": "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5",
"MetaData": {
"Keys": [
"eglfs_x11"
]
},
"archreq": 0,
"className": "QEglFSX11IntegrationPlugin",
"debug": false,
"version": 331264
}
2022/02/17 20:54:28.517: Debug: Got keys from plugin meta data ("eglfs_x11")
2022/02/17 20:54:28.517: Debug: QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/egldeviceintegrations" ...
2022/02/17 20:54:28.543: Fatal: Could not initialize egl display
Now I get much more data, but not regarding the last error! That one remains unverbose as before. Really useless actually!
GPU is discovered by kernel - but not used
I also made sure that I added status = "okay" inside the devicetree's GPU device node. This enabled the GPU probing. So now I can see it in dmesg:
[ 0.000000] AM335X ES2.1 (sgx neon)
I also installed executable kmscube which I could sucessfully execute and it rendered a cube with shaders. But it was slow and top revealed that it used 100% of my CPU! So probably GPU wasn't used in this case!
My display controllers & panels
I have two connectors on my device - first is HDMI and the second is my embedded panel. I installed modetest DRM & KVM utility which shows, how display controllers and panels are set up:
trying to open device 'i915'...failed
trying to open device 'amdgpu'...failed
trying to open device 'radeon'...failed
trying to open device 'nouveau'...failed
trying to open device 'vmwgfx'...failed
trying to open device 'omapdrm'...failed
trying to open device 'exynos'...failed
trying to open device 'tilcdc'...done
Encoders:
id crtc type possible crtcs possible clones
33 32 LVDS 0x00000001 0x00000001
35 0 TMDS 0x00000001 0x00000002
Connectors:
id encoder status name size (mm) modes encoders
34 33 connected LVDS-1 0x0 1 33
modes:
index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
#0 800x480 34.89 800 840 888 928 480 493 496 525 17000 flags: nhsync, nvsync; type: preferred, driver
props:
1 EDID:
flags: immutable blob
blobs:
value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
5 link-status:
flags: enum
enums: Good=0 Bad=1
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
4 TILE:
flags: immutable blob
blobs:
value:
20 CRTC_ID:
flags: object
value: 32
36 0 disconnected HDMI-A-1 0x0 0 35
props:
1 EDID:
flags: immutable blob
blobs:
value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
5 link-status:
flags: enum
enums: Good=0 Bad=1
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
4 TILE:
flags: immutable blob
blobs:
value:
20 CRTC_ID:
flags: object
value: 0
CRTCs:
id fb pos size
32 37 (0,0) (800x480)
#0 800x480 34.89 800 840 888 928 480 493 496 525 17000 flags: nhsync, nvsync; type: preferred, driver
props:
22 ACTIVE:
flags: range
values: 0 1
value: 1
23 MODE_ID:
flags: blob
blobs:
value:
68420000200348037803a0030000e001
ed01f0010d020000230000000a000000
48000000383030783438300000000000
00000000000000000000000000000000
00000000
19 OUT_FENCE_PTR:
flags: range
values: 0 18446744073709551615
value: 0
24 VRR_ENABLED:
flags: range
values: 0 1
value: 0
Planes:
id crtc fb CRTC x,y x,y gamma size possible crtcs
31 32 37 0,0 0,0 0 0x00000001
formats: BG16 RG24 XR24
props:
8 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
17 FB_ID:
flags: object
value: 37
18 IN_FENCE_FD:
flags: signed range
values: -1 2147483647
value: -1
20 CRTC_ID:
flags: object
value: 32
13 CRTC_X:
flags: signed range
values: -2147483648 2147483647
value: 0
14 CRTC_Y:
flags: signed range
values: -2147483648 2147483647
value: 0
15 CRTC_W:
flags: range
values: 0 2147483647
value: 800
16 CRTC_H:
flags: range
values: 0 2147483647
value: 480
9 SRC_X:
flags: range
values: 0 4294967295
value: 0
10 SRC_Y:
flags: range
values: 0 4294967295
value: 0
11 SRC_W:
flags: range
values: 0 4294967295
value: 52428800
12 SRC_H:
flags: range
values: 0 4294967295
value: 31457280
Frame buffers:
id size pitch
Here everything looks correct and in general my displays are working fine. So this probably isn't root of my problem.
This looks like a similar issue on the Beagleboard forum. The dev was able to fix it doing this:
"I updated the kernel using these options: ./update_kernel.sh --ti-channel --lts-4_14 --sgx
I had to install an additional package: apt install libdrm-dev
I had to do a custom GBM library install, outlined here 9. Seems not everything was set up correctly as part of the image."
Source

how expo audio recording extension .mp3

I am using the audio component of Expo and need to export it in MP3 format。encountering such an error Error Domain=NSOSStatusErrorDomain Code=1718449215 "(null)"]
This is my code
const recording = new Audio.Recording();
await recording.prepareToRecordAsync({
isMeteringEnabled: true,
android: {
extension: '.m4a',
outputFormat: RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4,
audioEncoder: RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC,
sampleRate: 44100,
numberOfChannels: 2,
bitRate: 128000,
},
ios: {
extension: '.mp3',
outputFormat: Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER3,
audioQuality: Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM,
sampleRate: 44100,
numberOfChannels: 2,
bitRate: 128000,
linearPCMBitDepth: 16,
linearPCMIsBigEndian: false,
linearPCMIsFloat: false,
},
})
Based on this documentation (found this link via expo docs here) iOS does not support MP3 recording.
...neither MP3 nor AAC recording is available. This is due to the high CPU overhead, and consequent battery drain, of these formats.
If you're curious about the original error, you can find more info about the corresponding native code which may have produced this error here

File Upload in Elm

How does one upload a file (image or excel) in Elm?
Can't seem to find any examples.
The answer is fine even if the native code is used. Have seen Data in Elm-Html but it appears files and blobs are not supported. What is the way around this?
I am the author of the library MisterMetaphor refers to. It's easier to use than he explains though. Take a look at how I set up elm-package.json in the example: https://github.com/simonh1000/file-reader/blob/master/example/elm-package.json - just add "native-modules": true,.
I have written a blog to support the release of the code for 0.18 and show how uploads to e.g. S3 can be done in Elm.
The official way to do it is now https://package.elm-lang.org/packages/elm/file/latest/
This is an addition that came in Elm 0.19.
Now the official Http package supports it as well. Here is an example from https://package.elm-lang.org/packages/elm/http/latest/Http#request
import File
import Http
type Msg = Uploaded (Result Http.Error ())
upload : File.File -> Cmd Msg
upload file =
Http.request
{ method = "PUT"
, headers = []
, url = "https://example.com/publish"
, body = Http.fileBody file
, expect = Http.expectWhatever Uploaded
, timeout = Nothing
, tracker = Nothing
}
The other option to handle file uploads in Elm is to
get a base64-encoded value from the FileReader into your Elm app through a port.
Then, send that base64-encoded value to your server (e.g. in a JSON body).
A tutorial can be found here https://www.paramander.com/blog/using-ports-to-deal-with-files-in-elm-0-17 (it says it's for Elm 0.17, but it works unchanged in Elm 0.18).
The downsides of this approach are
your server needs to base64-decode the files it receives which increases server load a little, and
base64-encoding increases the amount of bytes that will go over the wire (compared to a file/blob).
The upside:
no need to use a package with native code.
From the Elm Http docs: "Right now it only supports strings, but we will support blobs and files when we get an API for them in Elm."
Use a library like file-reader.
There is a set of pretty comprehensive examples, you can start with this one.
There's a caveat, though. Since this library uses some native code, you can't get it from the official package repo. So you will have to resort to manually installing it.
For this purpose, I wrote this hacky elm-package install replacement. It expects an exact-dependencies.json file in the root directory of your project. You can get this file initially from the elm-stuff directory that elm-package creates when building your project. You then add a reference to the file-reader package to the exact-dependencies.json file like this:
{
"evancz/elm-effects": "2.0.1",
"evancz/virtual-dom": "2.1.0",
"evancz/elm-http": "3.0.0",
"evancz/start-app": "2.0.2",
"evancz/elm-html": "4.0.2",
"elm-lang/core": "3.0.0",
"simonh1000/file-reader": "1.0.0"
}
You will also need to add a reference to file-reader to your elm-package.json file:
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/elm-effects": "2.0.1 <= v < 3.0.0",
"evancz/elm-html": "4.0.2 <= v < 5.0.0",
"evancz/elm-http": "3.0.0 <= v < 4.0.0",
"evancz/start-app": "2.0.2 <= v < 3.0.0",
"simonh1000/file-reader": "1.0.0 <= v < 2.0.0",
},
"elm-version": "0.16.0 <= v < 0.17.0"
}
After this, you run the elm-package install replacement and hopefully it will work.