marcus-j-davies / node-red-contrib-homekit-preconfigured

A collection of node-red nodes, representing various preconfigured Homekit devices, supporting their full functionality
MIT License
2 stars 0 forks source link

Questions about camera hardware decoding #5

Closed 671792320 closed 4 years ago

671792320 commented 4 years ago

Hello, please ask for help on the camera, when I try to use ffmpeg to hard decode the problem I query the official hardware decode for this command -vaapi_device / dev / dri / renderD128 -hwaccel vaapi -hwaccel_output_format vaapi When I add it like this and add monitoring rtsp connection, it seems to be unable to start, I am confused why this is not possible? But the same command can be started normally under homeassistant. In addition, I found that ffmpeg seems to support Intel QSV, but what I installed from apk add ffmpeg didn't seem to compile. I tried to recompile ffmpeg myself but it failed. My installation platform is nodered with a black skirt black DS918 + 6.2.2 docker installation. When I execute ls / dev / dri under nodered, docker correctly recognizes renderD128

marcus-j-davies commented 4 years ago

use this, in place of the original

const ffmpegInputArgs = ' -map ' + mapvideo + ' -vcodec ' + vcodec + ' -pix_fmt yuv420p -r ' + fps + ' -f rawvideo' + ' ' + additionalCommandline + ' -vf "format=nv12,hwupload" -b:v ' + vbitrate + 'k' + ' -bufsize ' + vbitrate + 'k' + ' -maxrate ' + vbitrate + 'k' + ' -payload_type 99'

671792320 commented 4 years ago

ok

671792320 commented 4 years ago

21 221

marcus-j-davies commented 4 years ago

the -re has caused me probed in the past - try it with and without

marcus-j-davies commented 4 years ago

isn't that the problem you had last time - where the driver was not installed?

671792320 commented 4 years ago

I'm very sure that I have the driver installed

671792320 commented 4 years ago

33333333

671792320 commented 4 years ago

44444 55555

marcus-j-davies commented 4 years ago

ok so clearly the -vf fix is working.

other than hardware access issues with node-red, I can't see any reason why it will not work.

it could be : The use of docker getting in the way node-red its self not having the right access (does it have root) the nodejs module child_process having problems - its used to start ffmpeg.

everything works for you when using libx264, I use hardware rendering, so I can only point to an issue with permissions or docker.

Sorry - I can't offer anything else.

671792320 commented 4 years ago

ok

671792320 commented 4 years ago

Is your noed-red running inside a docker container? Or run directly on the Raspberry Pi

671792320 commented 4 years ago

Can you help me modify this code with the file?

ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \

-threads:v 2 -threads:a 4 \

-rtsp_transport tcp \

-i rtsp://admin:123@192.168.1.247:8554/live3.sdp \

-map 0:0 \

-pix_fmt yuv420p \

-r 15.

-f rawvideo \

-vf 'format=nv12|vaapi,hwupload,scale_vaapi=1280:720' \

-c:v h264_vaapi \

-b:v 299k \

-bufsize 299k \

-maxrate 299k -payload_type 99 \

-ssrc 13314026 \

-f RTP \

-srtp_out_suite AES_CM_128_HMAC_SHA1_80 \

-srtp_out_params ils+c7v2WkNjdFFgICwYAeDKZ5oVaUAs1moiaGFB \

"srtp://192.168.1.243:62485?rtcpport=62485&localrtcpport=62485&pkt_size=1316"

This is me at https://gist.github.com/brainiarc7/95c9338a737aa36d9bb2931bed379219

Answers found on 123123 234234

marcus-j-davies commented 4 years ago

Morning,

No worries, so you want to use the command from Braniark7 yes?

671792320 commented 4 years ago

I want to test it

marcus-j-davies commented 4 years ago

ok let me just modify the JS file and I will attach it here... bear with me.

marcus-j-davies commented 4 years ago

Step 1: Replace the Camera.js file, with this one attached.

step 2: Set this as the Source Stream

-hwaccel vaapi -vaapi_device /dev/dri/renderD128 -threads:v 2 -threads:a 4 -rtsp_transport tcp -i rtsp://STREAM_URL

Step 3: set h264_vaapi as the encocder

Camera.js.zip

marcus-j-davies commented 4 years ago

hangon - let me just add debugging to it.....

marcus-j-davies commented 4 years ago

ok this on Camera.js.zip

marcus-j-davies commented 4 years ago

run node -red in terminal (so we can see any output)

671792320 commented 4 years ago

ok I'll wait for the test

671792320 commented 4 years ago

It seems that we have to give up. 123

marcus-j-davies commented 4 years ago

The only thing that could cause that i guess is -vaapi_device. being set to a non valid Render device. Or the url for the camera being incorrect.

671792320 commented 4 years ago

yes

marcus-j-davies commented 4 years ago

I don't think there is much more one can do here, not from a node specific point of view. after all the testing, I can only put this down to some DSM/Node-Red/Docker environment factor, causing the issue.

Sorry, I couldn't resolve.

671792320 commented 4 years ago

“ srtp://192.168.1.243:62485?rtcpport = 62485&localrtcpport = 62485&pkt_size = 1316” This command, I found that you have not added "" or "" in the modified file. I found that when I input all the commands, if the lowest STRP is not in "", the process will not start.