@torrent-tv/proxy 2.107.9 → 2.107.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.107.9",
3
+ "version": "2.107.10",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -41,8 +41,11 @@ export function buildAdmittedCommand({ admittedInput, timeline, output, segmentF
41
41
  }
42
42
  else video.push("-vf", trim);
43
43
  }
44
+ const audioTrack = admittedInput.tracks?.find(input => input.track.type === "audio")?.track;
45
+ const audioSampleRate = [audioTrack?.samplingFrequency, audioTrack?.codecParameters?.sampleRate]
46
+ .find(sampleRate => Number.isSafeInteger(sampleRate) && sampleRate > 0) ?? 48000;
44
47
  const audio = transcodeAudio ? ["-c:a", "aac", "-ac", "2", "-b:a", `${AUDIO_TRANSCODE_KBPS}k`,
45
- "-af", `atrim=start=${ffmpegSeconds(relativeStart)}:end=${ffmpegSeconds(relativeEnd)}`] : ["-c:a", "copy"];
48
+ "-af", `atrim=start=${ffmpegSeconds(relativeStart)}:end=${ffmpegSeconds(relativeEnd)},aresample=async=1:first_pts=${Math.round(relativeStart * audioSampleRate)}`] : ["-c:a", "copy"];
46
49
  if (audioOnly) args.push("-vn", "-map", "0:a:0", ...audio);
47
50
  else if (audioSeparate) args.push("-an", "-map", "0:v:0", ...video);
48
51
  else args.push("-map", "0:v:0", "-map", "0:a:0?", ...video, ...audio);