ws-video: MJPEG (codecs/Jpeg, yuv420p full range; encoder remaps limited-range frames) and MPEG-1 (codecs/Mpeg1, display reordering with the packet pts as tag) in the codec registry; VideoFrame times count from the demuxer's startTime (TS starts at 1.4 s); Matroska Vorbis keeps its codec delay; fixtures decode with -fps_mode passthrough
This commit is contained in:
1 parent
ba996820b5
commit
bd06545e2e
9 files changed
+136
-11
No files matched your search
@@ -442,7 +442,9 @@ function AudioWrap.wrap(dmx: any, track: Types.Track): (buffer?, string?, Err.Er
|
||||
end
|
||||
local m = if mb > 0 and buffer.len(d) * 8 > mb then bits(d, 1, mb) else 0
|
||||
local cur = sizes[if modes[m + 1] then 2 else 1]
|
||||
granule += ((prev or cur) + cur) // 4 -- the first packet counts as if after a block of its own size (ffmpeg)
|
||||
if prev then
|
||||
granule += (prev + cur) // 4
|
||||
end
|
||||
prev = cur
|
||||
return granule
|
||||
end)
|
||||
|
||||
@@ -22,6 +22,7 @@ export type Demux = typeof(setmetatable(
|
||||
format: string,
|
||||
tracks: { Types.Track },
|
||||
duration: number,
|
||||
startTime: number,
|
||||
meta: { [string]: any },
|
||||
src: buffer,
|
||||
n: number,
|
||||
@@ -48,6 +49,7 @@ function Demux.new(format: string, tracks: { Types.Track }, src: buffer, meta: {
|
||||
format = format,
|
||||
tracks = tracks,
|
||||
duration = 0,
|
||||
startTime = 0,
|
||||
meta = meta or {},
|
||||
src = src,
|
||||
n = 0,
|
||||
@@ -110,6 +112,7 @@ function D.finish(self: Demux)
|
||||
end
|
||||
self.byTrack = byTrack
|
||||
local total = self.duration
|
||||
local start = math.huge
|
||||
for _, t in self.tracks do
|
||||
local list = byTrack[t.id]
|
||||
local scale = if t.timescale and t.timescale > 0 then t.timescale else 1
|
||||
@@ -135,6 +138,9 @@ function D.finish(self: Demux)
|
||||
end
|
||||
end
|
||||
local first, last = order[1], order[#order]
|
||||
if t.kind == "video" or t.kind == "audio" then
|
||||
start = math.min(start, self.pts[first] / scale)
|
||||
end
|
||||
local d = (self.pts[last] + self.dur[last] - math.min(0, self.pts[first])) / scale
|
||||
if not t.duration or t.duration <= 0 then
|
||||
t.duration = d
|
||||
@@ -147,6 +153,9 @@ function D.finish(self: Demux)
|
||||
self.cur[t.id] = 1
|
||||
end
|
||||
self.duration = total
|
||||
-- the presentation time of the first video / audio packet (MPEG-TS streams start at ~1.4 s): VideoDecoders count
|
||||
-- frame times from it
|
||||
self.startTime = if start ~= math.huge and start > 0 then start else 0
|
||||
end
|
||||
|
||||
-- the Packet for index entry i (a copy of its bytes)
|
||||
|
||||
Reference in new issue
Block a user