ws-video2-flv: FLV writer test from ADTS AAC (MPEG-TS), bench lines (H.263 / Sorenson CIF fps), docs/guide/video.md FLV and H.263 section (inputs: tools/fixtures/docs_flv.py)
This commit is contained in:
1 parent
efc0812746
commit
f23d0aa3e8
5 files changed
+105
-3
No files matched your search
+33
-1
@@ -185,6 +185,7 @@ Images and animated images save as videos too.
|
||||
| webm | VP8 / VP9 / AV1 copied (VP8 is decode only, so the source must be WebM-compatible) | Opus / Vorbis 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 |
|
||||
@@ -263,6 +264,36 @@ assert(C.register({
|
||||
assert(C.fromFourcc("SLID") == "solid" and C.canDecode("solid"))
|
||||
```
|
||||
|
||||
## 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
|
||||
@@ -306,7 +337,8 @@ 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 |
|
||||
| mp4 / mov / m4v / 3gp | yes | yes | H.264, H.263, MJPEG, MPEG-1 |
|
||||
| flv | yes | yes (copy) | Sorenson Spark, H.264 (VP6, screen video: known, not decoded) |
|
||||
| mkv / webm | yes | yes | VP8, MJPEG, MPEG-1, raw (+ H.264) |
|
||||
| avi | yes | yes | MJPEG, MPEG-1, raw (+ H.264) |
|
||||
| mpegts, mpegps | yes | - | MPEG-1, H.264 |
|
||||
|
||||
Reference in new issue
Block a user