voiceoverfit 0.1.0 → 0.1.1

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": "voiceoverfit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Fit a voice to a video: clean and level a recording or a text-to-speech take, place each line on its step or scene so it ends before the next one, and write captions from the script.",
5
5
  "license": "MIT",
6
6
  "author": "Emin Budak",
@@ -546,9 +546,11 @@ const PICTURE_AT = new Map();
546
546
  // last read the file, by its full path: that stream's start time less the
547
547
  // file's, as ffprobe gives them (see soundFrom).
548
548
  const SOUND_AT = new Map();
549
- // The FLV files with a picture, as probe() last read them, by their full
550
- // paths (see soundFrom).
551
- const FLV_PICTURE = new Set();
549
+ // The files whose sound off any timeline is read with no seek, as probe()
550
+ // last read them, by their full paths (see soundFrom): an FLV or an
551
+ // MPEG-TS with a picture, and an MPEG-TS whose sound starts after the
552
+ // file's start.
553
+ const NO_SEEK = new Set();
552
554
  // The files whose first sound stream is WMA, as probe() last read them, by
553
555
  // their full paths (see soundFrom).
554
556
  const WMA_SOUND = new Set();
@@ -593,6 +595,23 @@ function soundFrom(file, { timeline = false, seek = null, length = null, until =
593
595
  // stretch more than 5 s in read empty, so its room was given as digital
594
596
  // silence, no noise reduction ran and its hum could go unmeasured (fix
595
597
  // step 2 of the lead's last step of v13, items 0 and 3 of its review).
598
+ // So is every stretch of an MPEG-TS with a picture, and of an MPEG-TS
599
+ // whose sound starts after the file's start. A seek into a still's
600
+ // MPEG-TS lands where ffmpeg's search for the picture's one frame ends,
601
+ // whatever the time asked, on 8.0.1 and 9.0.2 alike: every seek into
602
+ // 60 s of sound under one frame, from it or from 3 s after it, landed
603
+ // 8.2 s into that sound, so a stretch came back empty, short or from
604
+ // another place in it, and check and a clean read the room of a still
605
+ // over a 60 s take 3 dB louder than in that take alone, and learned its
606
+ // noise in its words. And
607
+ // ffmpeg 6.1 takes the start of a read after a seek into an MPEG-TS whose
608
+ // sound starts after the file's start as the seek's time alone, where 8
609
+ // and 9 add the file's start to it (correct_input_start_times in 6.1.1's
610
+ // fftools/ffmpeg_opt.c, as in 6.0, 7.0 and 7.1), so the stretch 7.5 s
611
+ // into a still's sound from 3 s after its frame came out 1.4 s early,
612
+ // where that file's clock starts, and check read the room between its
613
+ // words 3 dB louder than in that sound alone (Ubuntu 24.04's ffmpeg 6.1.1
614
+ // in the 0.1.0 release's CI).
596
615
  // So is every stretch of a WMA sound off any timeline, cut from the read's
597
616
  // first sample (`own`): ffmpeg 8 and 9 decode such a sound from 0.086 s
598
617
  // after the start ffprobe gives it, so a stretch cut on the file's clock,
@@ -603,7 +622,7 @@ function soundFrom(file, { timeline = false, seek = null, length = null, until =
603
622
  // lead's last step of v13, item 1 of its review).
604
623
  const wma = !onTimeline && WMA_SOUND.has(full);
605
624
  const picture = PICTURE_AT.get(full) || 0;
606
- const from = at === null ? null : at - EARLY < Math.max(picture, lead) || (!onTimeline && FLV_PICTURE.has(full)) || wma ? 0 : at - EARLY;
625
+ const from = at === null ? null : at - EARLY < Math.max(picture, lead) || (!onTimeline && NO_SEEK.has(full)) || wma ? 0 : at - EARLY;
607
626
  const span = at !== null && length !== null ? ["-t", (Number(length) + at - from).toFixed(6)] : length !== null ? ["-t", String(length)] : [];
608
627
  const seeks = from !== null && from > 0;
609
628
  const input = [...(seeks ? ["-ss", from.toFixed(6)] : []), ...span];
@@ -1092,8 +1111,8 @@ async function probe(file) {
1092
1111
  else PICTURE_AT.delete(at);
1093
1112
  if (audio) SOUND_AT.set(at, offset(audio));
1094
1113
  else SOUND_AT.delete(at);
1095
- if (video && /(^|,)flv(,|$)/.test(format.format_name || "")) FLV_PICTURE.add(at);
1096
- else FLV_PICTURE.delete(at);
1114
+ if ((video && /(^|,)(flv|mpegts)(,|$)/.test(format.format_name || "")) || (audio && offset(audio) > 0 && /(^|,)mpegts(,|$)/.test(format.format_name || ""))) NO_SEEK.add(at);
1115
+ else NO_SEEK.delete(at);
1097
1116
  if (audio && /^wma/.test(audio.codec_name || "")) WMA_SOUND.add(at);
1098
1117
  else WMA_SOUND.delete(at);
1099
1118
  // Where a video's sound starts: its first decoded frame, which is where
@@ -2,4 +2,4 @@
2
2
 
3
3
  // Kept here, not read from package.json: a skill install copies this folder
4
4
  // alone.
5
- module.exports = "0.1.0";
5
+ module.exports = "0.1.1";