@torrent-tv/proxy 2.9.84 → 2.9.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 2.9.86
2
+
3
+ - **Fix**: fMP4 playback starts again. The real reason ffmpeg exited before writing anything was the audio, not the file names: the MP4 muxer derives a copied AC-3 track's `dac3` box from the bitstream, so it cannot write `moov` until the first audio packet arrives, while our `empty_moov` demands it at header time — `Cannot write moov atom before AC3 packets. Set the delay_moov flag to fix this.`, captured in the field on a copied AC-3 source. `delay_moov` is now passed alongside it. The `hls` muxer sets that flag itself, which is why the fault appeared only once the muxing moved to the `segment` muxer in 2.9.84; MPEG-TS has no `moov` and was never affected. Verified in the addon container on an AC-3 source: without the flag the exact command the proxy runs fails, with it the segments are written, and the piece layout is unchanged (`ftyp moov moof mdat … mfra`), so the init split added in 2.9.84 still cuts in the same places — headers of consecutive pieces differ in four bytes, all inside `elst`, which the `tfdt` rewriting already overrides.
4
+ - **Chore**: Correcting the 2.9.85 entry below. It blames the `.m4s` extension, and that is false: with the arguments this proxy passes, ffmpeg 8.1.2 writes `.m4s` without complaint (re-measured on the same host, and on 6.1.1). The quoted error is what the same command produces when `-segment_format mp4` is missing — which the proxy never omits — and the field failure ends in `Invalid argument`, not `Muxer not found`. The rename is harmless and stays, but it fixed nothing.
5
+
6
+ ## 2.9.85
7
+
8
+ - **Fix**: fMP4 playback did not start at all in 2.9.84 — every request for the init segment answered 500. ffmpeg had refused to open the output: `Could not write header (incorrect codec parameters ?)`, because the `segment` muxer determines the container from the file extension and does not recognise `.m4s` for MP4, whatever `-segment_format` says. Segments are now written and named `.mp4` on both paths. The extension is internal: it appears only in our own playlist and in the temporary directory, so nothing outside changes.
9
+
1
10
  ## 2.9.84
2
11
 
3
12
  - **Fix**: fMP4 now cuts segments where the playlist says too, closing the gap left by 2.9.82 (which covered MPEG-TS only). The muxer that takes explicit cut times writes each fMP4 piece self-contained — `ftyp moov moof mdat … mfra`, confirmed on the field host — which is not what HLS wants, so the pieces are split on serve: the header is lifted out of the first one to become the init segment named by `#EXT-X-MAP`, and removed from every media segment along with the trailing random-access index, whose offsets describe a file that no longer exists. Timestamps still need stamping exactly as before: measured, all pieces of a run report a start of 0.080 s, each carrying its own zero, which is the same defect the existing rewriting already corrects. Verified end to end on a real piece from the field host — split into a 779-byte init and 221 KB of fragments, recombined, and decoded clean.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.9.84",
3
+ "version": "2.9.86",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "publishConfig": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file fMP4 (CMAF) segment format — `.m4s` media segments plus one shared
2
+ * @file fMP4 (CMAF) segment format — `.mp4` media segments plus one shared
3
3
  * `init.mp4` referenced by `#EXT-X-MAP`.
4
4
  *
5
5
  * Codec configuration (SPS/PPS) lives once in the init segment instead of being
@@ -54,7 +54,7 @@ function findFragmentBounds(bytes) {
54
54
  }
55
55
 
56
56
  const INIT_FILE_NAME = "init.mp4";
57
- const SEGMENT_PATTERN = /^segment-(\d{5})\.m4s$/;
57
+ const SEGMENT_PATTERN = /^segment-(\d{5})\.mp4$/;
58
58
 
59
59
  /**
60
60
  * @type {import("./index.js").SegmentFormat}
@@ -74,7 +74,7 @@ export const fmp4Format = {
74
74
  "-hls_fmp4_init_filename",
75
75
  INIT_FILE_NAME,
76
76
  "-hls_segment_filename",
77
- "segment-%05d.m4s"
77
+ "segment-%05d.mp4"
78
78
  ];
79
79
  },
80
80
 
@@ -102,14 +102,24 @@ export const fmp4Format = {
102
102
  // `empty_moov` is what makes each piece self-describing, which is what
103
103
  // lets the init be lifted out of it; `default_base_moof` keeps fragment
104
104
  // offsets relative, so removing the header does not invalidate them.
105
+ //
106
+ // `delay_moov` is not optional here. The MP4 muxer builds a copied AC-3
107
+ // track's `dac3` box out of the bitstream, so it cannot write `moov`
108
+ // until the first audio packet has arrived — while `empty_moov` asks for
109
+ // it at header time. Without this flag ffmpeg exits before producing
110
+ // anything: "Cannot write moov atom before AC3 packets", which is exactly
111
+ // how fMP4 playback died in the field on 2.9.84/2.9.85. The `hls` muxer
112
+ // sets this flag itself, which is why the fault only appeared once the
113
+ // muxing moved here. Delaying `moov` does not change the piece layout —
114
+ // measured: still `ftyp moov moof mdat … mfra`.
105
115
  "-segment_format_options",
106
- "movflags=+frag_keyframe+empty_moov+default_base_moof"
116
+ "movflags=+frag_keyframe+empty_moov+default_base_moof+delay_moov"
107
117
  ];
108
118
  },
109
119
 
110
120
  /** The output path template for the `segment` muxer. */
111
121
  segmentFileNameTemplate() {
112
- return "segment-%05d.m4s";
122
+ return "segment-%05d.mp4";
113
123
  },
114
124
 
115
125
  /**
@@ -151,7 +161,7 @@ export const fmp4Format = {
151
161
  },
152
162
 
153
163
  segmentFileName(index) {
154
- return `segment-${String(index).padStart(5, "0")}.m4s`;
164
+ return `segment-${String(index).padStart(5, "0")}.mp4`;
155
165
  },
156
166
 
157
167
  isSegmentFileName(fileName) {