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

(Plans for) H265 support #974

Open
anned20 opened this issue Jun 14, 2024 · 1 comment
Open

(Plans for) H265 support #974

anned20 opened this issue Jun 14, 2024 · 1 comment
Labels
question Discussion about functionality

Comments

@anned20
Copy link

anned20 commented Jun 14, 2024

Currently, we use this library to consume a RTSP stream for the camera and feed the resulting MP4 data into a ffmpeg process. This works magnificently, but only when the camera is set up to use H.264 encoding. When the camera is configured for H.265 encoding, the following error occurs:

closing TCP socket due to incoming error TypeError: Cannot read properties of undefined (reading 'parameters')
    at Object.h264Settings [as H264] (/app/node_modules/media-stream-library/dist/node.cjs:4650:37)
    at /app/node_modules/media-stream-library/dist/node.cjs:4803:50
    at Array.forEach (<anonymous>)
    at BoxBuilder.moov (/app/node_modules/media-stream-library/dist/node.cjs:4792:15)
    at Transform.transform [as _transform] (/app/node_modules/media-stream-library/dist/node.cjs:4891:35)
    at Transform._write (node:internal/streams/transform:171:8)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)
    at Writable.write (node:internal/streams/writable:502:10)
    at Transform.ondata (node:internal/streams/readable:1007:22)

The offending line in the source is

const profileLevelId = media.fmtp.parameters['profile-level-id']

I know, because of previous tickets, that there has been no effort yet to support H.265, mainly through the unsupported nature of the protocol in browsers, but this is changing: https://caniuse.com/hevc

Are there any plans to support H.265?

@anned20 anned20 added the question Discussion about functionality label Jun 14, 2024
@steabert
Copy link
Member

steabert commented Jul 12, 2024

Even though support for H.265 improves across browsers, it's currently not something that's easy to do with this library, as the stream format will depend itself on H.265. But if someone adds the necessary "depay" component(s) it's possible.

However, if you want to get MP4 data from the camera that you process anyway, isn't it easier to extract if directly as MP4 from the camera? The media.cgi supports both matroska and mp4 as container format. The only reason you would still extract RTSP and use this library is if you have an old model, or if you need to directly feed it in the browser, in which case the MP4 solution could have worse latency.

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

No branches or pull requests

2 participants