Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPE_INVALID_HEADER_TOKEN error #21

Open
art-0 opened this issue Oct 25, 2019 · 6 comments
Open

HPE_INVALID_HEADER_TOKEN error #21

art-0 opened this issue Oct 25, 2019 · 6 comments

Comments

@art-0
Copy link

art-0 commented Oct 25, 2019

Hi,
I have a IP camera (Overmax OV-Camspot 3.1) and video stream is not working. Log:

2019-10-25 11:36:15.631 INFO : onvif: Unhandled Rejection
2019-10-25 11:36:15.633 ERROR : onvif: { Error: Parse Error
2019-10-25 11:36:15.635 ERROR : onvif: at Socket.socketOnData (_http_client.js:454:20)
2019-10-25 11:36:15.636 ERROR : onvif: at emitOne (events.js:116:13)
2019-10-25 11:36:15.637 ERROR : onvif: at Socket.emit (events.js:211:7)
2019-10-25 11:36:15.638 ERROR : onvif: at addChunk (_stream_readable.js:263:12)
2019-10-25 11:36:15.640 ERROR : onvif: at readableAddChunk (_stream_readable.js:250:11)
2019-10-25 11:36:15.641 ERROR : onvif: at Socket.Readable.push (_stream_readable.js:208:10)
2019-10-25 11:36:15.642 ERROR : onvif: at TCP.onread (net.js:601:20) bytesParsed: 37, code: 'HPE_INVALID_HEADER_TOKEN' }

@mrstegeman
Copy link
Contributor

It seems like the camera is returning an invalid HTTP response. Is there any other context in the log for the onvif adapter? It's hard to figure out where the error is coming from.

@art-0
Copy link
Author

art-0 commented Oct 28, 2019

I temporarily bypasses the problem using a different http parser (https://github.com/creationix/http-parser-js). The snapshot works but the stream doesn't. In chrome developer console:

onvif-305419896:1 Uncaught (in promise)
D {severity: 2, category: 4, code: 4001, data: Array(1), handled: false}
category: 4
code: 4001
data: ["https://gateway.mozilla-iot.org/media/onvif/onvif-305419896/index.mpd"]
handled: false
severity: 2
proto: Object

There are no entries in the gateway logs.

@mrstegeman
Copy link
Contributor

Two questions:

  1. Does ~/.mozilla-iot/media/onvif/onvif-305419896/index.mpd exist on the Pi?
  2. Are there any ffmpeg processes running?

@art-0
Copy link
Author

art-0 commented Oct 29, 2019

Thanks for the answer.

Ad. 1: doesn't exist
Ad.2 yes

I dug deeper and it turned out that the ffmpeg doesn't create the file because:

  1. first error: Could not find codec parameters for stream 0
  • temporary solution: add parameter after ffmpeg: -rtsp_transport tcp
  1. second error: Too many packets buffered for output strem 0:0.
  • temporary solution: add parameter before -f arg: -max_muxing_queue_size 1024
  1. third error: @aac: Too many bits 8832.000000 > 6144 per frame requested, clamping to max
  • temporary solution part 1: it turned out that the stream has audio even though no flag "AudioEncoderConfiguration" is set
  • temporary solution part 2: change parameter from -b:a:0 128k to -b:a:0 32k
  • despite the removal of the above errors, there was still no image , only setting the parameter -an (no audio) helped. The camera stream works, but it often buffering. I tried to change again the ffmpeg parameters, but I haven't found the solution yet. Buggy camera ;)

@art-0
Copy link
Author

art-0 commented Oct 29, 2019

Maybe buffering can be caused by a slow microsd card, I'll try another one tomorrow.

@mrstegeman
Copy link
Contributor

Seems like your camera has some issues!

As for buffering, that can be due slow network speed (upload and download), and/or the SD card.

It would also help to transcode the video at a lower bitrate, but that would require more CPU (versus just copying the video), which could in turn also cause buffering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants