straight_to_video 0.0.10 → 0.0.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb365dda5fa968b1cae50f89065e24b0d49f49fa911aa067ace2b19052243123
4
- data.tar.gz: a67e3ac69b986d0a4458d8c72412ef52de6deb4f564312a3bf156199a99f5260
3
+ metadata.gz: 4783067cfef03451a12e35404133f518b5e73fedd306c99e47d02791022300b1
4
+ data.tar.gz: 8cabcf1177d87439fd41ac63be9dc88fddecca8123f7efc70c5a849061096340
5
5
  SHA512:
6
- metadata.gz: c0da985ed8833ee888047ea9654df6d2fc964bf5629a11c03bfdd292047a183f59a41b5fd127805eb25731ff8b34171969b3a36c57ac40bd95961f5c1628ab54
7
- data.tar.gz: 315f2daf669d9b524f6310f1796becc0606573a39b85f93cf1a725c6e6eceacaf7c2b6bee4cab398f5e3261d05ace06fc42c800095cb14197d26066846bf6f2d
6
+ metadata.gz: 26e1e12b9fb1cfcfcece442b49fcde59b5e19b429f70914286b59bc9efa8423761f98fccd0992807bdecbf5b50f97584e6e83ccaefd88a761d5cef2c52e8e4a8
7
+ data.tar.gz: 1980a0f482a87965ef98d3287fc2ccdfe51edd3d9127d3f0903c5d0a0336bc9b19d81785a012fb8dfddcf10b444d462af666f28d02c8e11eacafb8b4484da1d9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.11
4
+
5
+ * Work around WebKit labeling the requested first HEVC keyframe as a delta packet.
6
+ * Keep browser-encoded video below the 25 Mbps delivery limit.
7
+ * Accept WebKit's full-range `yuvj420p` output as progressive 4:2:0 video.
8
+
3
9
  ## 0.0.10
4
10
 
5
11
  - Fix Safari macOS Tahoe bug where native video controls never auto-hide by rewriting the moov atom to match ffmpeg's conventions (zero timestamps, standard handler names, edts/elst, extended esds, btrt, sgpd/sbgp)
@@ -1,4 +1,4 @@
1
- // straight-to-video@0.0.10 vendored by the straight_to_video gem
1
+ // straight-to-video@0.0.11 vendored by the straight_to_video gem
2
2
  // straight-to-video - https://github.com/searlsco/straight-to-video
3
3
 
4
4
  // ----- External imports -----
@@ -10,6 +10,7 @@ import {
10
10
 
11
11
  // ----- Constants -----
12
12
  const MAX_LONG_SIDE = 1920
13
+ const TARGET_VIDEO_BITRATE = 12_000_000
13
14
  const TARGET_AUDIO_BITRATE = 96_000
14
15
  const TARGET_AUDIO_SR = 48_000
15
16
  const TARGET_AUDIO_CHANNELS = 2
@@ -161,11 +162,11 @@ async function optimizeVideo (file, { onProgress } = {}) {
161
162
  }
162
163
 
163
164
  async function selectVideoEncoderConfig ({ width, height, fps }) {
164
- const hevc = { codec: 'hvc1.1.4.L123.B0', width, height, framerate: fps, hardwareAcceleration: 'prefer-hardware', hevc: { format: 'hevc' } }
165
+ const hevc = { codec: 'hvc1.1.4.L123.B0', width, height, framerate: fps, bitrate: TARGET_VIDEO_BITRATE, hardwareAcceleration: 'prefer-hardware', hevc: { format: 'hevc' } }
165
166
  const supH = await VideoEncoder.isConfigSupported(hevc).catch(() => ({ supported: false }))
166
167
  if (supH.supported) return { codecId: 'hevc', config: supH.config }
167
168
 
168
- const avc = { codec: 'avc1.64002A', width, height, framerate: fps, hardwareAcceleration: 'prefer-hardware', avc: { format: 'avc' } }
169
+ const avc = { codec: 'avc1.64002A', width, height, framerate: fps, bitrate: TARGET_VIDEO_BITRATE, hardwareAcceleration: 'prefer-hardware', avc: { format: 'avc' } }
169
170
  const supA = await VideoEncoder.isConfigSupported(avc)
170
171
  return { codecId: 'avc', config: supA.config }
171
172
  }
@@ -685,7 +686,7 @@ async function encodeVideo ({ file, srcMeta, plan, onProgress }) {
685
686
  const { chunk } = pendingPackets[i]
686
687
  const data = new Uint8Array(chunk.byteLength); chunk.copyTo(data)
687
688
  const ts = i * step; const dur = step
688
- const pkt = new EncodedPacket(data, chunk.type === 'key' ? 'key' : 'delta', ts, dur)
689
+ const pkt = new EncodedPacket(data, i === 0 || chunk.type === 'key' ? 'key' : 'delta', ts, dur)
689
690
  await videoTrack.add(pkt, { decoderConfig: { codec: usedCfg.codec, codedWidth: targetWidth, codedHeight: targetHeight, description: codecDesc } })
690
691
  }
691
692
 
data/index.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
 
10
10
  // ----- Constants -----
11
11
  const MAX_LONG_SIDE = 1920
12
+ const TARGET_VIDEO_BITRATE = 12_000_000
12
13
  const TARGET_AUDIO_BITRATE = 96_000
13
14
  const TARGET_AUDIO_SR = 48_000
14
15
  const TARGET_AUDIO_CHANNELS = 2
@@ -160,11 +161,11 @@ async function optimizeVideo (file, { onProgress } = {}) {
160
161
  }
161
162
 
162
163
  async function selectVideoEncoderConfig ({ width, height, fps }) {
163
- const hevc = { codec: 'hvc1.1.4.L123.B0', width, height, framerate: fps, hardwareAcceleration: 'prefer-hardware', hevc: { format: 'hevc' } }
164
+ const hevc = { codec: 'hvc1.1.4.L123.B0', width, height, framerate: fps, bitrate: TARGET_VIDEO_BITRATE, hardwareAcceleration: 'prefer-hardware', hevc: { format: 'hevc' } }
164
165
  const supH = await VideoEncoder.isConfigSupported(hevc).catch(() => ({ supported: false }))
165
166
  if (supH.supported) return { codecId: 'hevc', config: supH.config }
166
167
 
167
- const avc = { codec: 'avc1.64002A', width, height, framerate: fps, hardwareAcceleration: 'prefer-hardware', avc: { format: 'avc' } }
168
+ const avc = { codec: 'avc1.64002A', width, height, framerate: fps, bitrate: TARGET_VIDEO_BITRATE, hardwareAcceleration: 'prefer-hardware', avc: { format: 'avc' } }
168
169
  const supA = await VideoEncoder.isConfigSupported(avc)
169
170
  return { codecId: 'avc', config: supA.config }
170
171
  }
@@ -684,7 +685,7 @@ async function encodeVideo ({ file, srcMeta, plan, onProgress }) {
684
685
  const { chunk } = pendingPackets[i]
685
686
  const data = new Uint8Array(chunk.byteLength); chunk.copyTo(data)
686
687
  const ts = i * step; const dur = step
687
- const pkt = new EncodedPacket(data, chunk.type === 'key' ? 'key' : 'delta', ts, dur)
688
+ const pkt = new EncodedPacket(data, i === 0 || chunk.type === 'key' ? 'key' : 'delta', ts, dur)
688
689
  await videoTrack.add(pkt, { decoderConfig: { codec: usedCfg.codec, codedWidth: targetWidth, codedHeight: targetHeight, description: codecDesc } })
689
690
  }
690
691
 
@@ -1,3 +1,3 @@
1
1
  module StraightToVideo
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "straight-to-video",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "straight-to-video",
9
- "version": "0.0.10",
9
+ "version": "0.0.11",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "mediabunny": "^1.27.3"
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "straight-to-video",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Browser-based, hardware-accelerated video upload optimization",
5
5
  "type": "module",
6
6
  "exports": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: straight_to_video
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
- rubygems_version: 4.0.8
80
+ rubygems_version: 3.6.9
81
81
  specification_version: 4
82
82
  summary: Browser-based, hardware-accelerated video upload optimization
83
83
  test_files: []