ws-video2-theora: video/ogv, Ogg video (Theora + Vorbis / Opus / FLAC)
Demuxes every logical stream of the first Ogg group into containers/Demux: Theora (frame times from granules, Xiph-laced headers as track.config, comment tags in meta.tags), Vorbis / Opus / FLAC audio (headers in track.config) for the api's openAudio hook; open = Video.open. Sniff claims only Ogg files with a Theora BOS page. encode remuxes Theora (+ Vorbis / Opus pages from AudioWrap, interleaved by time). codecs/video/Theora gains info / comment helpers.
This commit is contained in:
1 parent
8183f4d2d7
commit
4dcb005180
6 files changed
+667
-7
No files matched your search
@@ -8,6 +8,7 @@
|
||||
# tests/gen/theora_dupe.luau the same, file with an empty packet after the 5th frame (frames: of the original)
|
||||
# tests/gen/theora_av.luau { file (base64 .ogv with Vorbis), frames, pcm (f32le of ffmpeg's audio decode, base64),
|
||||
# rate, channels }
|
||||
# tests/gen/theora_opus.luau, theora_flac.luau the same with mono Opus / FLAC audio
|
||||
# tests/gen/theora_mkv.luau { file (base64 .mkv), frames }
|
||||
# tests/gen/theora_bench.luau { file (base64 .ogv, 320x240) } for tools/bench.luau
|
||||
import base64, os, shutil, struct, subprocess, tempfile, zlib
|
||||
@@ -184,6 +185,15 @@ def generate(ctx):
|
||||
pcm = ff(["-i", av, "-map", "0:a", "-f", "f32le", "-"])
|
||||
ctx.emit("theora_av", {"file": b64(open(av, "rb").read()), "frames": framecrc(av, "yuv420p"),
|
||||
"width": 160, "height": 120, "pcm": b64(pcm), "rate": 44100, "channels": 2})
|
||||
# Theora + Opus, Theora + FLAC (mono, 0.5 s)
|
||||
for name, aenc, rate in (("opus", ["-c:a", "libopus", "-b:a", "48k"], 48000), ("flac", ["-c:a", "flac"], 22050)):
|
||||
path = os.path.join(tmp, "a_" + name + ".ogv")
|
||||
ff(src("testsrc2", 96, 64, 25, 0.5) + ["-f", "lavfi", "-i", "sine=frequency=330:sample_rate=%d" % rate,
|
||||
"-t", "0.5", "-ac", "1", "-c:v", "libtheora", "-q:v", "4"] + aenc +
|
||||
["-shortest", path])
|
||||
pcm = ff(["-i", path, "-map", "0:a", "-f", "f32le", "-"])
|
||||
ctx.emit("theora_" + name, {"file": b64(open(path, "rb").read()), "frames": framecrc(path, "yuv420p"),
|
||||
"width": 96, "height": 64, "pcm": b64(pcm), "rate": rate, "channels": 1})
|
||||
# Theora in Matroska (CodecPrivate: the three headers, Xiph-laced)
|
||||
mkv = os.path.join(tmp, "t.mkv")
|
||||
ff(["-i", os.path.join(tmp, "odd.ogv"), "-c", "copy", mkv])
|
||||
|
||||
Reference in new issue
Block a user