merge ws/video2-flv
This commit is contained in:
commit
a02ece071b
18 files changed
+3088
-1
No files matched your search
+33
-1
@@ -186,6 +186,7 @@ Images and animated images save as videos too.
|
||||
| ogv | Theora copied (the source must be Theora: ogv or mkv) | Vorbis / Opus copied |
|
||||
| mkv | any codec copied, else MJPEG | copied, else PCM s16 |
|
||||
| mp4, mov | H.264 / HEVC / AV1 / MJPEG / MPEG-4 copied, else MJPEG | AAC / ALAC / Opus / FLAC / MP3 copied; PCM in MOV only |
|
||||
| flv | H.264 (with its avcC) / Sorenson Spark / VP6 / screen video copied; nothing else (no FLV encoder) | AAC / MP3 / PCM / G.711 copied, else PCM s16 at 5512 / 11025 / 22050 / 44100 Hz |
|
||||
| avi | MJPEG copied, else MJPEG encoded (`quality`) | PCM s16 |
|
||||
| y4m | raw yuv420p | none |
|
||||
| h264 | an H.264 track copied as an Annex B stream | none |
|
||||
@@ -312,6 +313,36 @@ local mkv = assert(F.save(v, nil, { format = "mkv" })) -- Theora + Vorbis copi
|
||||
assert(F.video.open(mkv).codec == "theora")
|
||||
```
|
||||
|
||||
## FLV and H.263
|
||||
|
||||
FLV (Flash Video) opens like any other container. Its onMetaData script tag is `v.meta.metadata` (duration, width,
|
||||
height, framerate, codec ids, encoder, ...). Sorenson Spark (FLV1) and H.263 (in 3GP / MP4 `s263`, AVI `H263`)
|
||||
decode bit-exactly as ffmpeg decodes them; H.264 tracks carry their avcC in `track.config` and their B-frame
|
||||
composition times in the pts. VP6, screen video, Flash ADPCM, Nellymoser and Speex tracks are known (and remuxable)
|
||||
but not decoded: `nextFrame` / `v.audioError` say UNSUPPORTED. Writing FLV copies H.264 + AAC / MP3 from MP4,
|
||||
Matroska or FLV sources (FLV has no codec here that encodes).
|
||||
|
||||
```luau
|
||||
local v = assert(F.video.open(flvBytes)) -- Sorenson Spark + MP3
|
||||
assert(v.format == "flv" and v.codec == "flv1" and v.width == 64 and v.height == 48)
|
||||
local md = v.meta.metadata -- onMetaData (AMF0)
|
||||
assert(md.duration > 0 and md.framerate == 10 and md.videocodecid == 2)
|
||||
local f = assert(v:nextFrame()) -- yuv420p (BT.601, limited range)
|
||||
assert(f.keyframe and f.image.format == "yuv420p")
|
||||
local sound = assert(F.ops.audio.toAudio(assert(v.audio, tostring(v.audioError))))
|
||||
assert(sound.sampleRate == 44100)
|
||||
local h = assert(F.video.open(h263Bytes)) -- H.263 (QCIF) + AAC in 3GP
|
||||
assert(h.codec == "h263" and h.width == 176 and h:nextFrame() ~= nil)
|
||||
local flv = assert(F.convert(mp4Bytes, "flv")) -- remux: H.264 + AAC copied, onMetaData written
|
||||
local back = assert(F.video.open(flv))
|
||||
assert(F.detect(flv) == "flv" and back.codec == "h264" and back.demuxer:track("audio").codec == "aac")
|
||||
```
|
||||
|
||||
The H.263 decoder covers baseline H.263 (sub-QCIF .. 16CIF, GOB headers, unrestricted vectors) and the H.263+
|
||||
picture header ffmpeg's `h263p` encoder writes (custom sizes, the rounding type, unrestricted vectors, slice
|
||||
structure); advanced prediction, PB-frames, advanced intra coding, the deblocking filter and the other H.263+
|
||||
options are UNSUPPORTED.
|
||||
|
||||
## Playing in a game loop
|
||||
|
||||
Decode only the frames that are due, and stop when this frame's time budget is used up; a slow frame then makes
|
||||
@@ -355,9 +386,10 @@ editable:WritePixelsBuffer(Vector2.zero, editable.Size, v:toRGBA(frame).pixels)
|
||||
|
||||
| Format | Read | Write | Video codecs (decode) |
|
||||
|---|---|---|---|
|
||||
| mp4 / mov / m4v / 3gp | yes | yes | H.264, MJPEG, MPEG-1, MPEG-2 |
|
||||
| mp4 / mov / m4v / 3gp | yes | yes | H.264, H.263, MJPEG, MPEG-1, MPEG-2 |
|
||||
| mkv / webm | yes | yes | VP8, MJPEG, MPEG-1, MPEG-2, raw, Theora (+ H.264) |
|
||||
| ogv (Ogg Theora) | yes | yes (Theora + Vorbis / Opus copied) | Theora |
|
||||
| flv | yes | yes (copy) | Sorenson Spark, H.264 (VP6, screen video: known, not decoded) |
|
||||
| avi | yes | yes | MJPEG, MPEG-1, MPEG-2, raw (+ H.264) |
|
||||
| mpegts, mpegps | yes | - | MPEG-1, MPEG-2, H.264 |
|
||||
| y4m | yes | yes | raw |
|
||||
|
||||
Reference in new issue
Block a user