Skip to content

Commit

Permalink
WIP: support H.265 (#33)
Browse files Browse the repository at this point in the history
This isn't ready to merge because it's depending on an unreleased
version of `h264-reader` and an unreleased (and WIP) version of retina.
But it appears to work in a quick test.

There's no transcoding, so if the browser/player doesn't support these
formats, they don't play. But it will record and allow downloads, and
it seems to be working with Chrome on macOS at least.
  • Loading branch information
scottlamb committed Jan 28, 2025
1 parent dd30d5b commit ae03dd3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ even on minor releases, e.g. `v0.7.5` -> `v0.7.6`.

## unreleased

* support recording H.265 (#3) and MJPEG video. Browser support may vary.
* bump minimum Rust version to 1.82.
* improve error message on timeout opening stream.
* use `jiff` for time manipulations.
Expand Down
26 changes: 11 additions & 15 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ members = ["base", "db"]

[workspace.dependencies]
base64 = "0.22.0"
h264-reader = "0.7.0"
#h264-reader = "0.7.0"
h264-reader = { git = "https://github.com/dholroyd/h264-reader", rev = "5f9398f2f604a2f57b548131e80cde2d08c3fc01" }
itertools = "0.12.0"
jiff = "0.1.8"
nix = "0.27.0"
Expand Down Expand Up @@ -62,7 +63,8 @@ password-hash = "0.5.0"
pretty-hex = { workspace = true }
protobuf = "3.0"
reffers = "0.7.0"
retina = "0.4.11"
#retina = "0.4.11"
retina = { git = "https://github.com/scottlamb/retina", rev = "40d86341f7f09b1b6776266d9af29a2043b0d2d1", features = ["unstable-h265"] }
ring = { workspace = true }
rusqlite = { workspace = true }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion server/db/upgrade/v5_to_v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
)
})?;
let sps = ctx
.sps_by_id(h264_reader::nal::pps::ParamSetId::from_u32(0).unwrap())
.sps_by_id(h264_reader::nal::sps::SeqParamSetId::from_u32(0).unwrap())
.ok_or_else(|| {
err!(
Unimplemented,
Expand Down
6 changes: 4 additions & 2 deletions server/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn params_to_sample_entry(
.with_aspect_ratio(aspect)
.build()
.map_err(|e| err!(Unknown, source(e)))?,
rfc6381_codec: "avc1.4d401e".to_string(),
rfc6381_codec: params.rfc6381_codec().to_owned(),
width,
height,
pasp_h_spacing: aspect.0,
Expand All @@ -192,7 +192,9 @@ impl RetinaStreamInner {
let video_i = session
.streams()
.iter()
.position(|s| s.media() == "video" && matches!(s.encoding_name(), "h264" | "jpeg"))
.position(|s| {
s.media() == "video" && matches!(s.encoding_name(), "h264" | "h265" | "jpeg")
})
.ok_or_else(|| {
err!(
FailedPrecondition,
Expand Down

0 comments on commit ae03dd3

Please sign in to comment.