Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/obs/src/moq-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,9 +894,9 @@ void MoQOutput::VideoInit(obs_encoder_t *encoder)
// with inline parameter sets, which is what OBS hands us.
moq::VideoInit config{};
if (strcmp(codec, "h264") == 0) {
config.format = moq::VideoFormat::kAvc3;
config.format = moq::VideoFormat::kH264;
} else if (strcmp(codec, "hevc") == 0) {
config.format = moq::VideoFormat::kHev1;
config.format = moq::VideoFormat::kH265;
} else if (strcmp(codec, "av1") == 0) {
config.format = moq::VideoFormat::kAv01;
} else {
Expand Down
10 changes: 5 additions & 5 deletions cpp/obs/test/moq-source-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class Publisher {
broadcast = route->broadcast();
if (video) {
moq::VideoInit init{};
init.format = moq::VideoFormat::kAvc3;
init.format = moq::VideoFormat::kH264;
init.data = TestH264Init();
this->video =
TestOk(moq::MediaTrackProducer::video(broadcast, moq::MediaTarget::kNamed{}, init),
Expand Down Expand Up @@ -953,7 +953,7 @@ int main()
CHECK(publisher.WriteUntil([] { return g_output_frames > 0; }));
FreezeCatalog(ctx, publisher);
moq::VideoInit init{};
init.format = moq::VideoFormat::kAvc3;
init.format = moq::VideoFormat::kH264;
init.data = TestH264Init();
auto replacement = TestOk(
moq::MediaTrackProducer::video(publisher.broadcast,
Expand Down Expand Up @@ -1378,7 +1378,7 @@ int main()
CHECK(publisher.WriteUntil([] { return g_output_frames > 0; }));
FreezeCatalog(ctx, publisher);
moq::VideoInit init{};
init.format = moq::VideoFormat::kAvc3;
init.format = moq::VideoFormat::kH264;
init.data = TestH264Init();
auto replacement = TestOk(
moq::MediaTrackProducer::video(publisher.broadcast,
Expand Down Expand Up @@ -1407,7 +1407,7 @@ int main()
FreezeCatalog(ctx, publisher);
g_candidate_decode = failure;
moq::VideoInit init{};
init.format = moq::VideoFormat::kAvc3;
init.format = moq::VideoFormat::kH264;
init.data = TestH264Init();
auto replacement = TestOk(
moq::MediaTrackProducer::video(publisher.broadcast,
Expand Down Expand Up @@ -1643,7 +1643,7 @@ int main()
CHECK(publisher.WriteUntil([] { return g_output_frames > 0; }));
g_find_decoder_ok = false;
moq::VideoInit init{};
init.format = moq::VideoFormat::kAvc3;
init.format = moq::VideoFormat::kH264;
init.data = TestH264Init();
auto replacement = TestOk(
moq::MediaTrackProducer::video(publisher.broadcast,
Expand Down
2 changes: 1 addition & 1 deletion demo/carla/sim/moq_carla_sim/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def configure(self, config: Config) -> None:
self._tracks[config.rendition] = moq.media.TrackProducer.video(
self._broadcast,
moq.media.VideoInit(
format=moq.media.VideoFormat.AVC3,
format=moq.media.VideoFormat.H264,
data=config.init,
hint=moq.media.VideoHint(
coded=moq.media.Dimensions(width=rendition.width, height=rendition.height),
Expand Down
2 changes: 1 addition & 1 deletion demo/carla/sim/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def now(self) -> SimpleNamespace:


moq_media.CatalogProducer = CatalogProducer
moq_media.VideoFormat = SimpleNamespace(AVC3="avc3")
moq_media.VideoFormat = SimpleNamespace(H264="h264")
moq_media.VideoInit = lambda **kwargs: SimpleNamespace(**kwargs)
moq_media.VideoHint = lambda **kwargs: SimpleNamespace(**kwargs)
moq_media.Dimensions = lambda **kwargs: SimpleNamespace(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion demo/carla/sim/tests/test_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def __init__(self) -> None:
self.tracks: dict[str, FakeTrack] = {}

def video(self, init, target) -> FakeTrack:
assert init.format == "avc3"
assert init.format == "h264"
self.tracks[target.name] = FakeTrack(init.data, target.name, init.hint)
return self.tracks[target.name]

Expand Down
2 changes: 1 addition & 1 deletion demo/pub/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ h264 name url="http://localhost:4443" *args:
-c:v copy -an \
-bsf:v h264_mp4toannexb \
-f h264 \
- | cargo run --bin moq -- "${@:3}" --connect "{{ url }}" --broadcast "{{ name }}.hang" import avc3
- | cargo run --bin moq -- "${@:3}" --connect "{{ url }}" --broadcast "{{ name }}.hang" import h264

# Publish a video using ffmpeg directly from moq to the localhost.
[positional-arguments]
Expand Down
2 changes: 1 addition & 1 deletion doc/bin/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install. It needs an ARMv7 CPU, so not a Pi 1, Zero, or Zero W.

| Verb | Endpoint | |
| --- | --- | --- |
| `import` | `ts`, `fmp4`, `flv`, `avc3` | Read a container from stdin (usually FFmpeg). |
| `import` | `ts`, `fmp4`, `flv`, `h264` | Read a container from stdin (usually FFmpeg). |
| `import` | `capture` | Capture a camera, display, window, or app plus a microphone, and encode natively. |
| `import` | `hls <url>` | Follow a remote live HLS playlist. |
| `import` | `rtmp`, `srt`, `webrtc` | Accept pushes (`--listen`) or pull from a remote (`--connect`). |
Expand Down
2 changes: 1 addition & 1 deletion go/wrapper/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func Example_mediaVideoHint() {
}
defer broadcast.Close()

media, err := moqmedia.NewVideoTrackProducer(broadcast, moqmedia.Named{}, moqmedia.VideoInit{Format: moqmedia.VideoFormatAvc3, Data: nil, Hint: &moqmedia.VideoHint{}})
media, err := moqmedia.NewVideoTrackProducer(broadcast, moqmedia.Named{}, moqmedia.VideoInit{Format: moqmedia.VideoFormatH264, Data: nil, Hint: &moqmedia.VideoHint{}})
if err != nil {
log.Fatal(err)
}
Expand Down
10 changes: 5 additions & 5 deletions go/wrapper/media/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,16 @@ const (

// VideoFormat values: a single video codec an importer can parse. The two H.26x pairs
// differ by framing, not codec: Avc1/Hvc1 are length-prefixed with an out-of-band config
// record, Avc3/Hev1 are Annex-B with the parameter sets inline.
// record, H264/H265 are a raw Annex B elementary stream with the parameter sets inline.
const (
// VideoFormatAvc1 is H.264 with length-prefixed NALUs and an out-of-band avcC.
VideoFormatAvc1 = ffi.MoqVideoFormatAvc1
// VideoFormatAvc3 is H.264 in Annex-B with inline SPS/PPS.
VideoFormatAvc3 = ffi.MoqVideoFormatAvc3
// VideoFormatH264 is H.264 as a raw Annex B elementary stream with inline SPS/PPS.
VideoFormatH264 = ffi.MoqVideoFormatH264
// VideoFormatHvc1 is H.265 with length-prefixed NALUs and an out-of-band hvcC.
VideoFormatHvc1 = ffi.MoqVideoFormatHvc1
// VideoFormatHev1 is H.265 in Annex-B with inline parameter sets.
VideoFormatHev1 = ffi.MoqVideoFormatHev1
// VideoFormatH265 is H.265 as a raw Annex B elementary stream with inline parameter sets.
VideoFormatH265 = ffi.MoqVideoFormatH265
// VideoFormatAv01 is AV1.
VideoFormatAv01 = ffi.MoqVideoFormatAv01
// VideoFormatVp8 is VP8.
Expand Down
4 changes: 2 additions & 2 deletions py/moq-rs/tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ async def test_video_publish_consume():
route = origin.route("video-test")
broadcast = route.broadcast
media = moq.media.TrackProducer.video(
broadcast, moq.media.VideoInit(format=moq.media.VideoFormat.AVC3, data=h264_init())
broadcast, moq.media.VideoInit(format=moq.media.VideoFormat.H264, data=h264_init())
)

consumer = origin.consume()
Expand Down Expand Up @@ -321,7 +321,7 @@ async def test_video_publish_named_track():
broadcast = route.broadcast
media = moq.media.TrackProducer.video(
broadcast,
moq.media.VideoInit(format=moq.media.VideoFormat.AVC3, data=h264_init()),
moq.media.VideoInit(format=moq.media.VideoFormat.H264, data=h264_init()),
target=moq.media.Named("hd"),
)
assert media.demand().name == "hd"
Expand Down
32 changes: 0 additions & 32 deletions quest/m2/video-format-names.md

This file was deleted.

4 changes: 2 additions & 2 deletions quest/m5/carla-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ probe opens the camera's own backend with a CPU picture.
`VERSION`, so a mismatched bridge and worker fail at hello naming both
versions; test the refusal both ways. Open, if mixed versions must run:
negotiate at hello and keep the v1 layout for H.264.
- `sim/moq_carla_sim/bridge.py` publishes `AVC3` or `HEV1` instead of
hardcoding `AVC3`.
- `sim/moq_carla_sim/bridge.py` publishes `H264` or `H265` instead of
hardcoding `H264`.
- Scaling: one render still feeds the 426x240 and 1280x720 renditions,
scaled on the GPU. GPU-side copies are allowed; a CPU round trip is not.
- Test: the stand-in (`tests/standin/mod.rs`) stops requiring vendor
Expand Down
18 changes: 9 additions & 9 deletions rs/libmoq/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,21 @@ pub enum moq_audio_format {

/// A single video codec [moq_publish_video] can parse.
///
/// H.264 and H.265 appear twice each because the framing differs, not just the
/// codec: AVC1/HVC1 are length-prefixed with an out-of-band config record,
/// while AVC3/HEV1 are Annex-B with the parameter sets inline.
/// H.264 and H.265 appear twice each because the input framing differs:
/// AVC1/HVC1 are length-prefixed with an out-of-band config record, while
/// H264/H265 are a raw Annex B elementary stream with the parameter sets inline.
#[repr(C)]
#[expect(non_camel_case_types, reason = "C ABI type names match moq.h")]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum moq_video_format {
/// H.264, length-prefixed NALUs with an out-of-band avcC.
MOQ_VIDEO_FORMAT_AVC1 = 0,
/// H.264, Annex-B with inline SPS/PPS.
MOQ_VIDEO_FORMAT_AVC3 = 1,
/// H.264, a raw Annex B elementary stream with inline SPS/PPS.
MOQ_VIDEO_FORMAT_H264 = 1,
/// H.265, length-prefixed NALUs with an out-of-band hvcC.
MOQ_VIDEO_FORMAT_HVC1 = 2,
/// H.265, Annex-B with inline parameter sets.
MOQ_VIDEO_FORMAT_HEV1 = 3,
/// H.265, a raw Annex B elementary stream with inline parameter sets.
MOQ_VIDEO_FORMAT_H265 = 3,
/// AV1.
MOQ_VIDEO_FORMAT_AV01 = 4,
/// VP8.
Expand Down Expand Up @@ -377,9 +377,9 @@ fn video_format_from_u32(value: u32) -> Result<moq_mux::import::VideoFormat, Err
use moq_mux::import::VideoFormat;
Ok(match value {
v if v == moq_video_format::MOQ_VIDEO_FORMAT_AVC1 as u32 => VideoFormat::Avc1,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_AVC3 as u32 => VideoFormat::Avc3,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_H264 as u32 => VideoFormat::H264,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_HVC1 as u32 => VideoFormat::Hvc1,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_HEV1 as u32 => VideoFormat::Hev1,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_H265 as u32 => VideoFormat::H265,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_AV01 as u32 => VideoFormat::Av01,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_VP8 as u32 => VideoFormat::Vp8,
v if v == moq_video_format::MOQ_VIDEO_FORMAT_VP9 as u32 => VideoFormat::Vp9,
Expand Down
4 changes: 2 additions & 2 deletions rs/libmoq/src/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ impl Publish {
..
} = self.broadcast(broadcast)?;
let broadcast = broadcast.clone();
let name = broadcast.unique_name(&format!(".{}", init.format));
let name = broadcast.unique_name(init.format.track_suffix());
let request = broadcast.reserve_track(name)?;

let track = import::Track::audio(request, catalog.reserve().with_interval(interval), init)?;
Expand All @@ -538,7 +538,7 @@ impl Publish {
..
} = self.broadcast(broadcast)?;
let broadcast = broadcast.clone();
let name = broadcast.unique_name(&format!(".{}", init.format));
let name = broadcast.unique_name(init.format.track_suffix());
let request = broadcast.reserve_track(name)?;

let priority = init.priority;
Expand Down
12 changes: 6 additions & 6 deletions rs/libmoq/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ fn publish_media_owns_its_rendition_before_the_first_keyframe() {
// nothing until a keyframe lands.
let media = id(publish_video(
broadcast,
moq_video_format::MOQ_VIDEO_FORMAT_AVC3,
moq_video_format::MOQ_VIDEO_FORMAT_H264,
&[],
None,
));
Expand Down Expand Up @@ -6312,7 +6312,7 @@ fn video_publish_consume() {
let broadcast = publish_broadcast(origin, path);

let init = h264_init();
let format = moq_video_format::MOQ_VIDEO_FORMAT_AVC3;
let format = moq_video_format::MOQ_VIDEO_FORMAT_H264;
let media = id(publish_video(broadcast, format, &init, None));

let consume = request_broadcast(origin, path);
Expand Down Expand Up @@ -7337,7 +7337,7 @@ fn video_raw_decode() {
// The init's SPS/PPS only seed catalog metadata; avc3 frames carry their own
// inline parameter sets, so the decoder reads the true 320x240 from the wire.
let init = h264_init();
let format = moq_video_format::MOQ_VIDEO_FORMAT_AVC3;
let format = moq_video_format::MOQ_VIDEO_FORMAT_H264;
let media = id(publish_video(broadcast, format, &init, None));

let consume = request_broadcast(origin, path);
Expand Down Expand Up @@ -9273,7 +9273,7 @@ fn track_request_media_carries_hints() {
let h264 = h264_init();
let video_config = moq_video_init {
lower: 0,
format: moq_video_format::MOQ_VIDEO_FORMAT_AVC3 as u32,
format: moq_video_format::MOQ_VIDEO_FORMAT_H264 as u32,
init: h264.as_ptr(),
init_len: h264.len(),
label: std::ptr::null(),
Expand Down Expand Up @@ -9328,7 +9328,7 @@ fn invalid_hints_are_refused() {
let video = |hint: moq_video_hint| {
let config = moq_video_init {
lower: 0,
format: moq_video_format::MOQ_VIDEO_FORMAT_AVC3 as u32,
format: moq_video_format::MOQ_VIDEO_FORMAT_H264 as u32,
init: h264.as_ptr(),
init_len: h264.len(),
label: std::ptr::null(),
Expand Down Expand Up @@ -9444,7 +9444,7 @@ fn preencoded_rungs_and_rate_control() {
let broadcast = publish_broadcast(origin, b"preencoded-rungs");
let init = h264_init();
let config = |lower| moq_video_init {
format: moq_video_format::MOQ_VIDEO_FORMAT_AVC3 as u32,
format: moq_video_format::MOQ_VIDEO_FORMAT_H264 as u32,
init: init.as_ptr(),
init_len: init.len(),
label: std::ptr::null(),
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ moq --listen '[::]:4443' --listen-tls-generate localhost --auth-public '**' --br

### Import formats

- `avc3` raw H.264 Annex-B from stdin
- `h264` raw H.264 Annex B elementary stream from stdin
- `fmp4` fragmented MP4 from stdin
12 changes: 6 additions & 6 deletions rs/moq-cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,8 @@ impl Import {
/// from stdin; the gateways bridge another protocol.
#[derive(usage_rs::Subcommands, Clone)]
pub enum ImportSource {
/// Raw H.264 Annex-B from stdin.
Avc3,
/// Raw H.264 Annex B elementary stream from stdin.
H264,
/// Fragmented MP4 / CMAF from stdin.
Fmp4(Fmp4Import),
/// MPEG-TS from stdin.
Expand Down Expand Up @@ -876,7 +876,7 @@ impl ImportSource {
/// The stdin container format, when this source is one of the container formats.
pub fn stdin_format(&self) -> Option<PublishFormat> {
Some(match self {
Self::Avc3 => PublishFormat::Avc3,
Self::H264 => PublishFormat::H264,
Self::Fmp4(args) => PublishFormat::Fmp4 { cmaf: args.cmaf },
Self::Ts(args) if args.passthrough => PublishFormat::TsPassthrough {
pcr_pid: args.pcr_pid.map(|pid| pid.0),
Expand Down Expand Up @@ -906,7 +906,7 @@ impl ImportSource {
| Self::Archive(_) => Some("the gateway and archive imports build their own catalogs"),
#[cfg(feature = "capture")]
Self::Capture(_) => None,
Self::Avc3 | Self::Fmp4(_) | Self::Ts(_) | Self::Flv => None,
Self::H264 | Self::Fmp4(_) | Self::Ts(_) | Self::Flv => None,
}
}

Expand All @@ -923,7 +923,7 @@ impl ImportSource {
Self::Archive(_) => Some("`import archive` serves its recording until stopped"),
#[cfg(feature = "capture")]
Self::Capture(_) => Some("`import capture` has no clean end"),
Self::Avc3
Self::H264
| Self::Fmp4(_)
| Self::Ts(_)
| Self::Flv
Expand Down Expand Up @@ -1837,7 +1837,7 @@ mod tests {
["ts"].as_slice(),
&["fmp4"],
&["flv"],
&["avc3"],
&["h264"],
&["ts", "--program", "1"],
] {
import(flags, source).validate().unwrap();
Expand Down
Loading