mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff84aa4fd2 | ||
|
|
4df95ea271 | ||
|
|
be7dba4669 |
No files matched your search
@@ -164,7 +164,13 @@ started a second full host server instead, so check that a subcommand exists in
|
||||
- CaptureSettingRequest: field 1 is an **fps option index** (1=30, 2=60, 3=90); the real frame rate is
|
||||
field 18 `fpsCount`. Field 2 quality: 1 Fast, 2 General (高清 2M), 3 HD (超清 8M), 4 Bluray (原画 20M),
|
||||
5 Auto, 6 Custom. Resolution: 16/17 pixel size or 5/6, 10 resolution_type (3 = follow remote).
|
||||
Reply `RpcResponse{2 CaptureSettingResponse{}}` (no errors = applied) and send Message 25 CaptureSettingSync.
|
||||
Field 7 `chorma_format` (ChromaFormat 1 = 4:2:0, 3 = 4:4:4) is sent when 真彩 is toggled; ff_capture_setting versions
|
||||
are cumulative (3 CHROMA_SAMPLING, 4 CUSTOM_BITRATE, 5 DPI_SCALE, 6 HDR). 4:4:4 = NVENC `high444p` / x264 `high444`
|
||||
with `yuv444p`; VAAPI and inproc stay 4:2:0.
|
||||
Reply `RpcResponse{2 CaptureSettingResponse{}}` (no errors = applied) and send Message 25 CaptureSettingSync
|
||||
(field 3 = the chroma actually encoded).
|
||||
- ConnectOptions field 4 `decoder_cap_list` = DecoderCap {1 fps, 2 codec_type (1 H264, 2 H265), 3 width, 4 height,
|
||||
5 chroma_format}. The Mac viewer lists H.264 and H.265, each 4:2:0 and 4:4:4, up to 3840x2160@120.
|
||||
- SystemMetrics (Message 13): GeneralMetric `2 system_sound_support` is an enum, **2 = supported** (1 = not
|
||||
supported); SettingMetric 1 keep_mute, 2 mute_permanent, 3 auto_lock, 5 file_transfer_save_location,
|
||||
8/9/10 permission states (2 = allow).
|
||||
|
||||
Generated
+1
-1
@@ -2649,7 +2649,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uu-remote-linux"
|
||||
version = "0.1.13"
|
||||
version = "0.1.15"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "uu-remote-linux"
|
||||
version = "0.1.13"
|
||||
version = "0.1.15"
|
||||
edition = "2021"
|
||||
authors = ["uu-remote-linux contributors"]
|
||||
description = "Unofficial Linux host for NetEase UU Remote: control a Linux desktop from the official clients"
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ mapping and hardware acceleration remain unverified. This is not zero-copy VAAPI
|
||||
| Feature | Status |
|
||||
|---|---|
|
||||
| Switching between multiple monitors | In progress |
|
||||
| True color (4:4:4) | Not implemented; not declared in the handshake, so the client does not enable it |
|
||||
| True color (4:4:4) | Supported (v0.1.15): the default FFmpeg pipeline with NVENC / libx264 encodes H.264 High 4:4:4; VAAPI and `inproc-av` stay 4:2:0 and report that to the client |
|
||||
| HDR | Not implemented |
|
||||
| Super screen / virtual display | Not implemented |
|
||||
| Privacy screen on the host | Not implemented |
|
||||
|
||||
@@ -74,7 +74,7 @@ Wayland 下的限制:只支持单屏、固定分辨率;Hyprland 原生后端
|
||||
| 功能 | 状态 |
|
||||
|---|---|
|
||||
| 多显示器切换 | 开发中 |
|
||||
| 真彩(4:4:4) | 未实现,握手时不声明,客户端不会启用 |
|
||||
| 真彩(4:4:4) | 支持(v0.1.15):NVENC / libx264 的默认 FFmpeg 管线输出 H.264 High 4:4:4;VAAPI 和 `inproc-av` 管线仍为 4:2:0,并如实回报给客户端 |
|
||||
| HDR | 未实现 |
|
||||
| 超级屏 / 虚拟显示器 | 未实现 |
|
||||
| 被控端防窥模式 | 未实现 |
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
修复手机切回终端时黑屏。/ Fixes a black terminal after returning to it on mobile.
|
||||
|
||||
### 修复 / Fixed
|
||||
- **终端历史输出较多时,重连后黑屏**(#14,感谢 @cnetst):手机客户端切到后台再回到同一个终端时,如果之前积累的输出较多,
|
||||
会整屏黑屏,连新建终端也没有输出,只能完全退出 App 重连。原因是重连时把最多 256 KB 的历史输出作为一条消息发送,
|
||||
超过了 WebRTC 数据通道单条消息 64 KB 的上限,发送失败后整个终端连接卡住。现在历史输出按 16 KB 分段发送,顺序不变。
|
||||
✅ 已用官方手机客户端在 3090 实机验收。
|
||||
Terminal scrollback is replayed in 16 KiB chunks instead of one message over the 64 KiB SCTP limit. Verified on mobile.
|
||||
|
||||
### 下载 / Download
|
||||
`uu-remote-linux-v0.1.14-x86_64-linux.tar.gz`:X11 版可执行文件(x86_64,glibc ≥ 2.35),附带 `contrib/`。
|
||||
|
||||
**非官方项目,与网易无关。** / **Unofficial, not affiliated with NetEase.**
|
||||
@@ -0,0 +1,20 @@
|
||||
支持真彩(4:4:4)。/ True color (4:4:4) support.
|
||||
|
||||
### 新功能 / Added
|
||||
- **真彩(4:4:4)**:在客户端画面菜单打开「真彩」后,主机改用 H.264 High 4:4:4 编码,彩色细字(红字、链接、
|
||||
代码高亮)边缘不再发虚;关闭后切回 4:2:0。适用于默认的 FFmpeg 管线(NVENC 或 libx264);VAAPI 和
|
||||
`--features inproc-av` 管线仍为 4:2:0,并如实告知客户端。
|
||||
✅ 已用官方 Mac 客户端在 RTX 3090(NVENC)上实机验证:开关来回切换正常、画面正常解码。
|
||||
When 真彩 is enabled the host encodes H.264 High 4:4:4 (default FFmpeg pipeline with NVENC or libx264); VAAPI and
|
||||
inproc-av stay 4:2:0 and report it. Verified with the official Mac viewer on NVENC (toggling, decoding).
|
||||
- 日志记录客户端声明的解码能力(编码类型、色度、最大分辨率、帧率,仅数字),便于排查画质问题。
|
||||
The log now shows the viewer's declared decoder capabilities (numbers only).
|
||||
|
||||
### 说明 / Notes
|
||||
- 4:4:4 码率会略高于 4:2:0;在缩放到较低分辨率时差别不明显,建议配合「跟随远端」分辨率使用。
|
||||
4:4:4 costs some bitrate; the difference is hardly visible when the stream is scaled down.
|
||||
|
||||
### 下载 / Download
|
||||
`uu-remote-linux-v0.1.15-x86_64-linux.tar.gz`:X11 版可执行文件(x86_64,glibc ≥ 2.35),附带 `contrib/`。
|
||||
|
||||
**非官方项目,与网易无关。** / **Unofficial, not affiliated with NetEase.**
|
||||
+37
-5
@@ -19,9 +19,14 @@ pub const QUALITY_AUTO: u64 = 5;
|
||||
pub const QUALITY_CUSTOM: u64 = 6;
|
||||
|
||||
/// FeatureFlag.ff_capture_setting we declare: fps, preset quality and custom bitrate.
|
||||
/// (Chroma 4:4:4, DPI scaling and HDR are higher versions and are not implemented.)
|
||||
/// Versions are cumulative (official FF_CaptureSetting enum: 3 CHROMA_SAMPLING, 4 CUSTOM_BITRATE,
|
||||
/// 5 DPI_SCALE, 6 HDR), so 4 also tells the viewer we accept a chroma format (真彩).
|
||||
pub const FEATURE_VERSION: u64 = 4;
|
||||
|
||||
/// Official GvPb_ChromaFormat values (CaptureSettingRequest field 7, CaptureSettingSync field 3).
|
||||
pub const CHROMA_420: u64 = 1;
|
||||
pub const CHROMA_444: u64 = 3;
|
||||
|
||||
const MIN_FPS: u32 = 5;
|
||||
const MAX_FPS: u32 = 144;
|
||||
|
||||
@@ -33,10 +38,12 @@ pub struct VideoSettings {
|
||||
pub custom_mbps: u32,
|
||||
/// Scaled stream size (其他分辨率); None streams the native desktop size.
|
||||
pub output: Option<(u32, u32)>,
|
||||
/// CHROMA_420 or CHROMA_444 (真彩); 4:4:4 only when the encoder pipeline supports it.
|
||||
pub chroma: u64,
|
||||
}
|
||||
|
||||
impl Default for VideoSettings {
|
||||
fn default() -> Self { Self { fps: 60, quality: QUALITY_AUTO, custom_mbps: 0, output: None } }
|
||||
fn default() -> Self { Self { fps: 60, quality: QUALITY_AUTO, custom_mbps: 0, output: None, chroma: CHROMA_420 } }
|
||||
}
|
||||
|
||||
/// Selectable smaller stream sizes with the desktop's aspect ratio (even dimensions).
|
||||
@@ -95,6 +102,10 @@ fn fps_from_option(value: u64) -> Option<u64> {
|
||||
/// Applies a capture-setting RPC to `settings` and returns the RpcResponse payload (Message 22),
|
||||
/// or None when the RPC is not a capture/fps/quality setting.
|
||||
pub fn handle_rpc(rpc: &[WireField], settings: &watch::Sender<VideoSettings>, native: (u32, u32)) -> Option<Vec<u8>> {
|
||||
apply_rpc(rpc, settings, native, crate::video::full_chroma_available())
|
||||
}
|
||||
|
||||
fn apply_rpc(rpc: &[WireField], settings: &watch::Sender<VideoSettings>, native: (u32, u32), full_chroma: bool) -> Option<Vec<u8>> {
|
||||
let header = message(rpc, 1).unwrap_or(&[]);
|
||||
let mut next = *settings.borrow();
|
||||
if let Some(request) = message(rpc, 2) {
|
||||
@@ -106,6 +117,13 @@ pub fn handle_rpc(rpc: &[WireField], settings: &watch::Sender<VideoSettings>, na
|
||||
if let Some(fps) = number(&fields, 18).filter(|v| *v > 0).or_else(|| number(&fields, 1).and_then(fps_from_option)) { next.fps = fps as u32; }
|
||||
if let Some(quality) = number(&fields, 2).filter(|v| *v > 0) { next.quality = quality; }
|
||||
if let Some(bitrate) = number(&fields, 8).filter(|v| *v > 0) { next.custom_mbps = bitrate as u32; }
|
||||
// Field 7 chorma_format (sic): 3 = 4:4:4 when 真彩 is on, 1 = 4:2:0. The Sync reports what is encoded.
|
||||
match number(&fields, 7) {
|
||||
Some(CHROMA_444) if full_chroma => next.chroma = CHROMA_444,
|
||||
Some(CHROMA_444) => { log::info!("Chroma 4:4:4 requested; this encoder pipeline only supports 4:2:0"); next.chroma = CHROMA_420; }
|
||||
Some(CHROMA_420) => next.chroma = CHROMA_420,
|
||||
_ => {}
|
||||
}
|
||||
// ChooseResolutionType 3 = follow remote (native); otherwise pixel size, else logical size.
|
||||
if number(&fields, 10) == Some(3) { next.output = None; }
|
||||
else if let Some((w, h)) = number(&fields, 16).zip(number(&fields, 17)).or_else(|| number(&fields, 5).zip(number(&fields, 6))) {
|
||||
@@ -129,7 +147,7 @@ pub fn handle_rpc(rpc: &[WireField], settings: &watch::Sender<VideoSettings>, na
|
||||
}
|
||||
next.fps = next.fps.clamp(MIN_FPS, MAX_FPS);
|
||||
settings.send_if_modified(|current| if *current != next {
|
||||
log::info!("Desktop video settings: fps={} quality={} max_kbps={:?} output={:?}", next.fps, next.quality, next.max_kbps(), next.output);
|
||||
log::info!("Desktop video settings: fps={} quality={} max_kbps={:?} output={:?} chroma={}", next.fps, next.quality, next.max_kbps(), next.output, next.chroma);
|
||||
*current = next; true
|
||||
} else { false });
|
||||
let mut out = Vec::new();
|
||||
@@ -156,7 +174,7 @@ pub fn sync_payload(settings: &VideoSettings, native: (u32, u32)) -> Vec<u8> {
|
||||
let mut out = Vec::new();
|
||||
put_varint(1, u64::from(settings.fps), &mut out);
|
||||
put_varint(2, settings.quality, &mut out);
|
||||
put_varint(3, 1, &mut out); // ChromaFormat_420
|
||||
put_varint(3, settings.chroma, &mut out);
|
||||
if settings.custom_mbps > 0 { put_varint(4, u64::from(settings.custom_mbps), &mut out); }
|
||||
put_varint(5, u64::from(size.0), &mut out);
|
||||
put_varint(6, u64::from(size.1), &mut out);
|
||||
@@ -187,7 +205,7 @@ mod tests {
|
||||
put_varint(18, 30, &mut body);
|
||||
let request = rpc(77, 2, &body);
|
||||
let response = handle_rpc(&decode_wire(&request).unwrap(), &tx, (1920, 1080)).unwrap();
|
||||
assert_eq!(*rx.borrow(), VideoSettings { fps: 30, quality: QUALITY_GENERAL, custom_mbps: 0, output: None });
|
||||
assert_eq!(*rx.borrow(), VideoSettings { fps: 30, quality: QUALITY_GENERAL, custom_mbps: 0, output: None, chroma: CHROMA_420 });
|
||||
assert_eq!(rx.borrow().max_kbps(), Some(2_000));
|
||||
let fields = decode_wire(&response).unwrap();
|
||||
assert_eq!(message(&fields, 1), Some(&[8u8, 77][..]));
|
||||
@@ -208,6 +226,20 @@ mod tests {
|
||||
assert!(handle_rpc(&decode_wire(&rpc(3, 9, &[])).unwrap(), &tx, (1920, 1080)).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn true_color_request_selects_444_only_when_the_encoder_supports_it() {
|
||||
let (tx, rx) = watch::channel(VideoSettings::default());
|
||||
// Observed Mac viewer request with 真彩 on: field 7 = 3.
|
||||
let request = rpc(5, 2, &[8, 2, 16, 4, 56, 3, 144, 1, 60]);
|
||||
apply_rpc(&decode_wire(&request).unwrap(), &tx, (1920, 1080), false).unwrap();
|
||||
assert_eq!(rx.borrow().chroma, CHROMA_420);
|
||||
apply_rpc(&decode_wire(&request).unwrap(), &tx, (1920, 1080), true).unwrap();
|
||||
assert_eq!(rx.borrow().chroma, CHROMA_444);
|
||||
assert_eq!(number(&decode_wire(&sync_payload(&rx.borrow(), (1920, 1080))).unwrap(), 3), Some(CHROMA_444));
|
||||
apply_rpc(&decode_wire(&rpc(6, 2, &[56, 1])).unwrap(), &tx, (1920, 1080), true).unwrap();
|
||||
assert_eq!(rx.borrow().chroma, CHROMA_420);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolution_requests_scale_below_native_only() {
|
||||
let (tx, rx) = watch::channel(VideoSettings::default());
|
||||
|
||||
@@ -317,6 +317,13 @@ impl SignalingClient {
|
||||
let ice_id = ["ice_id", "iceId"].iter().find_map(|k| header.get(*k).or_else(|| header.get("data").and_then(|d| d.get(*k))))
|
||||
.and_then(|v| v.as_str()).map(str::to_owned);
|
||||
log::info!("be-controlled connect request: capture_type={} header_keys={:?} ice_id_present={}", capture_type, keys, ice_id.is_some());
|
||||
// ConnectOptions 4 decoder_cap_list: DecoderCap {1 fps, 2 codec_type (1 H264, 2 H265),
|
||||
// 3 width, 4 height, 5 chroma_format (1 4:2:0, 3 4:4:4)}. Numbers only.
|
||||
let caps: Vec<Vec<(u32, u64)>> = fields.iter().flatten().filter(|f| f.number == 4).filter_map(|f| match f.value {
|
||||
crate::protocol::WireValue::Bytes(b) => crate::protocol::decode_wire(b).ok().map(|cap| cap.iter().filter_map(|x| match x.value {
|
||||
crate::protocol::WireValue::Varint(v) => Some((x.number, v)), _ => None }).collect()),
|
||||
_ => None }).collect();
|
||||
if !caps.is_empty() { log::info!("Viewer decoder caps (fps,codec,w,h,chroma fields): {:?}", caps); }
|
||||
// Viewer platform (website enum: 1 windows, 2 android, 3 ios, 4 macos, 5 tv).
|
||||
let platform = header.get("controller_platform").or_else(|| header.get("data").and_then(|d| d.get("controller_platform")));
|
||||
let controller_mac = platform.is_some_and(|v| v.as_i64() == Some(4)
|
||||
|
||||
+42
-2
@@ -34,6 +34,7 @@ const MAGIC: &[u8; 4] = b"TERM";
|
||||
const HEADER: usize = 16;
|
||||
const MAX_PAYLOAD: usize = 0x10_0000;
|
||||
const SCROLLBACK: usize = 256 * 1024;
|
||||
const OUTPUT_CHUNK: usize = 16 * 1024;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Frame { pub kind: u8, pub flags: [u8; 2], pub session: u32, pub payload: Vec<u8> }
|
||||
@@ -140,7 +141,7 @@ fn spawn(requested_id: u32, cols: u16, rows: u16, shell: Option<&str>) -> Result
|
||||
let mut reader = std::fs::File::from(session.master.try_clone().map_err(|e| format!("pty dup failed: {e}"))?);
|
||||
let worker = session.clone();
|
||||
std::thread::Builder::new().name(format!("uu-term-{id}")).spawn(move || {
|
||||
let mut buf = vec![0u8; 16 * 1024];
|
||||
let mut buf = vec![0u8; OUTPUT_CHUNK];
|
||||
loop {
|
||||
match reader.read(&mut buf) {
|
||||
Ok(0) | Err(_) => break,
|
||||
@@ -222,7 +223,8 @@ impl TerminalConn {
|
||||
self.send(OPEN_RESP, s.id, &reply(0, "ok"));
|
||||
*sink = Some(self.out.clone());
|
||||
let replay: Vec<u8> = s.scrollback.lock().unwrap().iter().copied().collect();
|
||||
if !replay.is_empty() { self.send(STDOUT, s.id, &replay); }
|
||||
// A full scrollback exceeds SCTP's 64 KiB outbound message limit.
|
||||
for chunk in replay.chunks(OUTPUT_CHUNK) { self.send(STDOUT, s.id, chunk); }
|
||||
}
|
||||
Err(e) => { log::warn!("Terminal open failed: {}", e); self.send(OPEN_RESP, frame.session, &reply(1, &e)); }
|
||||
}
|
||||
@@ -289,6 +291,44 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn reconnect_replays_large_history_in_bounded_frames() {
|
||||
let pty = nix::pty::openpty(None, None).unwrap();
|
||||
let id = u32::MAX - 1;
|
||||
let history: Vec<u8> = (0..SCROLLBACK).map(|n| (n % 251) as u8).collect();
|
||||
let session = Arc::new(Session { id, shell: "/bin/sh".into(), created_ms: now_ms(),
|
||||
master: pty.master, pid: 0, sink: Mutex::new(None),
|
||||
scrollback: Mutex::new(history.iter().copied().collect()) });
|
||||
registry().lock().unwrap().insert(id, session.clone());
|
||||
struct Cleanup(u32);
|
||||
impl Drop for Cleanup { fn drop(&mut self) { registry().lock().unwrap().remove(&self.0); } }
|
||||
let _cleanup = Cleanup(id);
|
||||
|
||||
for _ in 0..2 {
|
||||
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
let conn = TerminalConn::new(tx);
|
||||
conn.handle(&encode(OPEN, id, br#"{"cols":80,"rows":24}"#));
|
||||
let opened = decode(&rx.try_recv().unwrap()).unwrap();
|
||||
assert_eq!(opened.kind, OPEN_RESP);
|
||||
assert_eq!(opened.session, id);
|
||||
let mut replay = Vec::new();
|
||||
while replay.len() < history.len() {
|
||||
let packet = rx.try_recv().unwrap();
|
||||
// SCTP's default outbound limit includes the TERM header.
|
||||
assert!(packet.len() <= 65536, "terminal replay exceeds the SCTP message limit");
|
||||
let frame = decode(&packet).unwrap();
|
||||
assert_eq!(frame.kind, STDOUT);
|
||||
assert_eq!(frame.session, id);
|
||||
replay.extend(frame.payload);
|
||||
}
|
||||
assert!(replay == history, "terminal replay must preserve every byte in order");
|
||||
assert!(session.emit(STDOUT, b"live output"));
|
||||
assert_eq!(decode(&rx.try_recv().unwrap()).unwrap().payload, b"live output");
|
||||
conn.handle(&encode(LIST_REQ, 7, &[]));
|
||||
assert_eq!(decode(&rx.try_recv().unwrap()).unwrap().kind, LIST_RESP);
|
||||
conn.handle(&encode(DETACH, id, &[]));
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn open_spawns_shell_and_streams_output() {
|
||||
for requested_id in [0, u32::MAX] {
|
||||
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
|
||||
+20
-3
@@ -68,6 +68,22 @@ impl Encoder {
|
||||
fn nvidia_present() -> bool {
|
||||
std::path::Path::new("/proc/driver/nvidia/version").exists() || std::path::Path::new("/dev/nvidia0").exists()
|
||||
}
|
||||
/// 真彩 (4:4:4) needs the FFmpeg process pipeline with NVENC or libx264 (h264_vaapi and the
|
||||
/// in-process encoder are 4:2:0 only).
|
||||
pub fn full_chroma_available() -> bool {
|
||||
#[cfg(feature = "inproc-av")]
|
||||
if crate::inproc_encoder::selected() { return false; }
|
||||
Encoder::requested() != Encoder::Vaapi
|
||||
}
|
||||
|
||||
/// (-profile:v, -pix_fmt) for NVENC / libx264: 4:4:4 needs a High 4:4:4 profile.
|
||||
fn chroma_args(settings: &VideoSettings, encoder: Encoder) -> (&'static str, &'static str) {
|
||||
match (settings.chroma == crate::capture_setting::CHROMA_444, encoder) {
|
||||
(true, Encoder::Nvenc) => ("high444p", "yuv444p"),
|
||||
(true, _) => ("high444", "yuv444p"),
|
||||
(false, _) => ("baseline", "yuv420p"),
|
||||
}
|
||||
}
|
||||
pub(crate) fn vaapi_device() -> String { std::env::var("UU_VAAPI_DEVICE").unwrap_or_else(|_| "/dev/dri/renderD128".into()) }
|
||||
|
||||
/// NV12 conversion must precede upload; scaling runs on software frames, before hwupload.
|
||||
@@ -232,7 +248,8 @@ async fn read_encoder_with(
|
||||
let (maxrate, bufsize) = rate_args(&settings, encoder);
|
||||
let cq = settings.cq().to_string();
|
||||
let target = settings.max_kbps().map_or("16M".to_string(), |k| format!("{}k", k * 3 / 4));
|
||||
log::info!("Desktop encoder: display={} source={} output={:?} fps={} cq={} maxrate={} encoder={} low_latency=true",display,size,settings.output,settings.fps,cq,maxrate,encoder.name());
|
||||
let (profile, pix_fmt) = chroma_args(&settings, encoder);
|
||||
log::info!("Desktop encoder: display={} source={} output={:?} fps={} cq={} maxrate={} encoder={} pix_fmt={} low_latency=true",display,size,settings.output,settings.fps,cq,maxrate,encoder.name(),if encoder == Encoder::Vaapi { "nv12" } else { pix_fmt });
|
||||
// A bundled FFmpeg prefix (config ffmpeg_root / UU_FFMPEG_ROOT) or `ffmpeg` on PATH.
|
||||
let mut command=match crate::config::ffmpeg_root() {
|
||||
Some(root) => { let mut c=Command::new(root.join("bin/ffmpeg")); c.env("LD_LIBRARY_PATH",root.join("lib/x86_64-linux-gnu")); c }
|
||||
@@ -258,14 +275,14 @@ async fn read_encoder_with(
|
||||
command.args(vaapi_options(&settings, &gop));
|
||||
} else if encoder == Encoder::Nvenc {
|
||||
command.args(["-c:v","h264_nvenc","-preset","p4","-tune","ull",
|
||||
"-profile:v","baseline","-pix_fmt","yuv420p","-g",&gop,"-bf","0",
|
||||
"-profile:v",profile,"-pix_fmt",pix_fmt,"-g",&gop,"-bf","0",
|
||||
"-rc","vbr","-cq",&cq,"-b:v",&target,"-maxrate",&maxrate,"-bufsize",&bufsize,
|
||||
"-rc-lookahead","0","-zerolatency","1","-delay","0","-aud","1"]);
|
||||
}else{
|
||||
let x264 = format!("aud=1:repeat-headers=1:scenecut=0:keyint={gop}:min-keyint={gop}");
|
||||
command.args([
|
||||
"-c:v", "libx264", "-preset", "superfast", "-tune", "zerolatency",
|
||||
"-profile:v", "baseline", "-pix_fmt", "yuv420p", "-g", &gop, "-threads", "4",
|
||||
"-profile:v", profile, "-pix_fmt", pix_fmt, "-g", &gop, "-threads", "4",
|
||||
"-crf", &cq, "-maxrate", &maxrate, "-bufsize", &bufsize,
|
||||
"-x264-params", &x264]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user