From d99752a9a0e9d3f7dd44af0e2bd2ba1e28dcae09 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sat, 5 Mar 2022 21:13:42 -0800 Subject: [PATCH] rebroadcast: move and enable dumping of h264 extra data --- plugins/prebuffer-mixin/package-lock.json | 4 ++-- plugins/prebuffer-mixin/package.json | 2 +- plugins/prebuffer-mixin/src/main.ts | 28 +++++++++++------------ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/plugins/prebuffer-mixin/package-lock.json b/plugins/prebuffer-mixin/package-lock.json index b45416a39..1decabc30 100644 --- a/plugins/prebuffer-mixin/package-lock.json +++ b/plugins/prebuffer-mixin/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.183", + "version": "0.1.184", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.183", + "version": "0.1.184", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/prebuffer-mixin/package.json b/plugins/prebuffer-mixin/package.json index 224fc0020..fe0cfa568 100644 --- a/plugins/prebuffer-mixin/package.json +++ b/plugins/prebuffer-mixin/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.183", + "version": "0.1.184", "description": "Rebroadcast and Prebuffer for VideoCameras.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/prebuffer-mixin/src/main.ts b/plugins/prebuffer-mixin/src/main.ts index 9ee52657e..3f81cb97e 100644 --- a/plugins/prebuffer-mixin/src/main.ts +++ b/plugins/prebuffer-mixin/src/main.ts @@ -384,8 +384,19 @@ class PrebufferSession { } const vcodec = [ - '-vcodec', - 'copy', + '-vcodec', 'copy', + // Add SPS/PPS to all keyframes. Not all cameras do this! + // This isn't really necessary for a few reasons: + // MPEG-TS and MP4 will automatically do this, since there's no out of band + // way to get the SPS/PPS. + // RTSP mode may send the SPS/PPS out of band via the sdp, and then may not have + // SPS/PPS in the bit stream. + // Adding this argument isn't strictly necessary, but it normalizes the bitstream + // so consumers that expect the SPS/PPS will have it. Ran into an issue where + // the HomeKit plugin was blasting RTP packets out from RTSP mode, + // but the bitstream had no SPS/PPS information, resulting in the video never loading + // in the Home app. + '-bsf:v', 'dump_extra' ]; const rbo: ParserOptions = { @@ -472,19 +483,6 @@ class PrebufferSession { // create missing pts from dts so mpegts and mp4 muxing does not fail const extraInputArguments = this.storage.getItem(this.ffmpegInputArgumentsKey) || DEFAULT_FFMPEG_INPUT_ARGUMENTS; ffmpegInput.inputArguments.unshift(...extraInputArguments.split(' ')); - // Add SPS/PPS to all keyframes. Not all cameras do this! - // This isn't really necessary for a few reasons: - // MPEG-TS and MP4 will automatically do this, since there's no out of band - // way to get the SPS/PPS. - // RTSP mode may send the SPS/PPS out of band via the sdp, and then may not have - // SPS/PPS in the bit stream. - // Adding this argument isn't strictly necessary, but it normalizes the bitstream - // so consumers that expect the SPS/PPS will have it. Ran into an issue where - // the HomeKit plugin was blasting RTP packets out from RTSP mode, - // but the bitstream had no SPS/PPS information, resulting in the video never loading - // in the Home app. - if (rtspMode) - ffmpegInput.inputArguments.push('-bsf:v', 'dump_extra'); session = await startParserSession(ffmpegInput, rbo); } }