client: add MJPEG quality control
This commit is contained in:
parent
6295720b96
commit
aba2a689b4
@ -40,6 +40,7 @@ impl CameraCapture {
|
|||||||
.ok()
|
.ok()
|
||||||
.map(|v| matches!(v.to_ascii_lowercase().as_str(), "mjpeg" | "mjpg" | "jpeg"))
|
.map(|v| matches!(v.to_ascii_lowercase().as_str(), "mjpeg" | "mjpg" | "jpeg"))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
let jpeg_quality = env_u32("LESAVKA_CAM_JPEG_QUALITY", 85).clamp(1, 100);
|
||||||
let (enc, kf_prop, kf_val) = if use_mjpg_source && !output_mjpeg {
|
let (enc, kf_prop, kf_val) = if use_mjpg_source && !output_mjpeg {
|
||||||
("x264enc", "key-int-max", "30")
|
("x264enc", "key-int-max", "30")
|
||||||
} else {
|
} else {
|
||||||
@ -49,7 +50,9 @@ impl CameraCapture {
|
|||||||
tracing::info!("📸 using MJPG source with software encode");
|
tracing::info!("📸 using MJPG source with software encode");
|
||||||
}
|
}
|
||||||
if output_mjpeg {
|
if output_mjpeg {
|
||||||
tracing::info!("📸 outputting MJPEG frames for UVC");
|
tracing::info!(
|
||||||
|
"📸 outputting MJPEG frames for UVC (quality={jpeg_quality})"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
tracing::info!("📸 using encoder element: {enc}");
|
tracing::info!("📸 using encoder element: {enc}");
|
||||||
}
|
}
|
||||||
@ -94,7 +97,7 @@ impl CameraCapture {
|
|||||||
if use_mjpg_source {
|
if use_mjpg_source {
|
||||||
format!(
|
format!(
|
||||||
"v4l2src device={dev} do-timestamp=true ! \
|
"v4l2src device={dev} do-timestamp=true ! \
|
||||||
image/jpeg,width={width},height={height} ! \
|
image/jpeg,width={width},height={height},framerate={fps}/1 ! \
|
||||||
queue max-size-buffers=30 leaky=downstream ! \
|
queue max-size-buffers=30 leaky=downstream ! \
|
||||||
appsink name=asink emit-signals=true max-buffers=60 drop=true"
|
appsink name=asink emit-signals=true max-buffers=60 drop=true"
|
||||||
)
|
)
|
||||||
@ -102,7 +105,7 @@ impl CameraCapture {
|
|||||||
format!(
|
format!(
|
||||||
"v4l2src device={dev} do-timestamp=true ! \
|
"v4l2src device={dev} do-timestamp=true ! \
|
||||||
video/x-raw,width={width},height={height},framerate={fps}/1 ! \
|
video/x-raw,width={width},height={height},framerate={fps}/1 ! \
|
||||||
videoconvert ! jpegenc ! \
|
videoconvert ! jpegenc quality={jpeg_quality} ! \
|
||||||
queue max-size-buffers=30 leaky=downstream ! \
|
queue max-size-buffers=30 leaky=downstream ! \
|
||||||
appsink name=asink emit-signals=true max-buffers=60 drop=true"
|
appsink name=asink emit-signals=true max-buffers=60 drop=true"
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user