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

Please forgive me for opening a new request. #6

Closed 671792320 closed 4 years ago

671792320 commented 4 years ago

ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \ ... -srtp_out_params ils+c7v2WkNjdFFgICwYAeDKZ5oVaUAs1moiaGFB \ "srtp://192.168.1.243:62485?rtcpport=62485&localrtcpport=62485&pkt_size=1316"

In the above. If SRTP: / / is not entered by '' or '' then the entire command will not take effect.

Here are the screenshots.

1 2 The command in the first figure has a band '', I tested that both '' and '' can open the process normally

The second graph doesn't have '' or '' will stick like this

marcus-j-davies commented 4 years ago

Hi,

This is a very isolated issue/environmental factor.

Every project that I have come across that offers homekit camera functionality, does not require the URI's to be quoted. The developer of homebridge-camera-ffmpeg, does not Evan have it quoted. https://github.com/KhaosT/homebridge-camera-ffmpeg/blob/master/ffmpeg.js

And that same developer, is who has developed the NodeJS Homekit lib that these nodes use.

I myself do not have it quoted.

In an effort to get this working for you. I have replaced the single quotes around the -vf attribute with double quotes. see if that helps.

Camera.zip

671792320 commented 4 years ago

LIVE555 Streaming Media v2013.04.06 Duration: N/A, start: -23435.054967, bitrate: N/A Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 50 fps, 25 tbr, 90k tbn, 100 tbc Option hwaccel (use HW accelerated decoding) cannot be applied to output url -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for output file . Error opening output files: Invalid argument

marcus-j-davies commented 4 years ago

Sorry, I have no idea what this is referring to, why is LIVE555 involved? Are you pointing the Source Stream to a LIVE555 stream?

hwaccelshould come before your -i argument

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

Encoder h264_vaapi

671792320 commented 4 years ago

4

671792320 commented 4 years ago

5

marcus-j-davies commented 4 years ago

in the camera.js file change (exactly as shown)

"format=nv12|vaapi,hwupload,scale_vaapi='+width+':'+height+'" to format="nv12|vaapi,hwupload,scale_vaapi='+width+':'+height+'"

putting the double quote after the = and not before

671792320 commented 4 years ago

6 Really not? It's strange why that code can run normally under Bash and can't be opened on the mobile phone.

marcus-j-davies commented 4 years ago

try taking the double quotes out completely

-vf format=nv12|vaapi,hwupload,scale_vaapi='+width+':'+height+'

671792320 commented 4 years ago

7 Seems to be back to the beginning

671792320 commented 4 years ago

8 Does it seem that the ffmpeg I installed does not support nv12 format?

marcus-j-davies commented 4 years ago

potentially....

Try this last one. the various arguments are separated with a single quote, but if we actually need single quotes in a command - we need to escape them with \'

-vf \'format=nv12|vaapi,hwupload,scale_vaapi='+width+':'+height+'\'

Capture

671792320 commented 4 years ago

9

671792320 commented 4 years ago

10 11 It's really strange. After I manually copied the command and added 'quotes' to SRTP, I ran up after the terminal was executed, and real-time images were also displayed on the mobile phone, although carton was slow to respond

marcus-j-davies commented 4 years ago

if for what ever reason your environment needs quotes around the output address do this

change const ffmpegStreamArgs = ' -ssrc ' + videoSsrc + ' -f rtp' + ' -srtp_out_suite AES_CM_128_HMAC_SHA1_80' + ' -srtp_out_params ' + videoKey.toString('base64') + ' srtp://' + targetAddress + ':' + targetVideoPort + '?rtcpport=' + targetVideoPort + '&localrtcpport=' + targetVideoPort + '&pkt_size=' + packetsize

to const ffmpegStreamArgs = ' -ssrc ' + videoSsrc + ' -f rtp' + ' -srtp_out_suite AES_CM_128_HMAC_SHA1_80' + ' -srtp_out_params ' + videoKey.toString('base64') + ' "srtp://' + targetAddress + ':' + targetVideoPort + '?rtcpport=' + targetVideoPort + '&localrtcpport=' + targetVideoPort + '&pkt_size=' + packetsize+'"'

671792320 commented 4 years ago

12

marcus-j-davies commented 4 years ago

Then I am out of ideas...

My only suggestion here is to download NodeJS on your own machine, install ffmpeg, install node-red, and my nodes, and see if you get the same problems.

I think we need to remove any barrier that could be affecting things.

671792320 commented 4 years ago

OK, I'll try your suggestion later

671792320 commented 4 years ago

Nodejs

Which version should I use?

marcus-j-davies commented 4 years ago

it includes NPM (and doesn't need to be installed )

https://nodejs.org/dist/v12.16.1/node-v12.16.1-win-x64.zip

671792320 commented 4 years ago

Thank you

marcus-j-davies commented 4 years ago

Looking at VAAPI, it only runs on Linux, so this may not help in anyway, if you can work out the equivalent for windows, then you can at least check to ensure hardware encoding/rendering does not work.

if it does - then you know your DSM environment is playing havec.

671792320 commented 4 years ago

What does that mean?

if it does - then you know your DSM environment is playing havec.

I can't understand machine translation,

You mean vaapi only works in Linux.

If these codes are not valid on Windows

Can it be proved that DSM can run?

marcus-j-davies commented 4 years ago

What I mean is :

If you can get windows to run a hardware accelerated video stream, then your DSM or DOCKER environment is causing you the issues, rather then the node it’s self.

Havoc - misbehaving/causing trouble

I.e your DSM is causing Havoc

Yes, windows does not support VAAPI, so you may need to head over to the FFMPG website to find out how to do hardware encoding/decoding on windows.

671792320 commented 4 years ago

OK, I will try to install nodejs directly on DSM and install noded for testing

671792320 commented 4 years ago

After using nodejsv8 to install node red on DSM, the same problem occurs.

marcus-j-davies commented 4 years ago

what error invalid filter?

671792320 commented 4 years ago

No, what happened was

Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 50 fps, 25 tbr, 90k tbn, 100 tbc

Option hwaccel (use HW accelerated decoding) cannot be applied to output url -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.

Error parsing options for output file .

Error opening output files: Invalid argument

No longer available for testing, I have deleted the nodejs suite and node red on DSM

marcus-j-davies commented 4 years ago

Then I am not sure what the problem is. I use hardware encoding, and haven't had any problems.

I have exhausted any knowledge I have with ffmpeg (which is not a lot)

my nodes use child_process and commands that are used by most homekit camera implementations.

the only thing different is the use of VAAPI - which may be the problem entirely, but i don't have the knowledge to find out.

Once again - Sorry

671792320 commented 4 years ago

No, you don't have to say sorry. Instead, I should say thank you. Thank you for your help

Thank you again