-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting list of supported formats / resolutions / framerates #14
Comments
Hi,
Escapi is supposed to be simple. You can naturally do whatever you wish in
a forked version.
…On Sun, Jun 3, 2018, 22:33 Boscop ***@***.***> wrote:
Would it be possible for escapi to allow querying for the supported
formats of a camera, and then query for the supported resolutions of a
given format?
Similar to how it's possible with the rscam Rust crate:
extern crate rscam;
use std::io::prelude::*;use std::fs;
fn main() -> rscam::Result<()> {
let mut cam = rscam::new("/dev/video2").unwrap();
for fmt in cam.formats() {
let fmt = fmt?;
println!("{:?}", fmt);
if let rscam::ResolutionInfo::Discretes(v) = cam.resolutions(&fmt.format)? {
for res in v {
println!("{:?} {:?}", res, cam.intervals(&fmt.format, res)?);
}
}
}
cam.start(&rscam::Config {
interval: (1, 30), // 30 fps.
resolution: (1920, 1080),
format: b"MJPG",
..Default::default()
}).unwrap();
for i in 0..30 {
let frame = cam.capture().unwrap();
let mut file = fs::File::create(&format!("frame-{}.jpg", i)).unwrap();
file.write_all(&frame[..]).unwrap();
}
Ok(())
}
which prints:
YUYV (YUYV 4:2:2)
(1920, 1080) Discretes: 5fps
(160, 120) Discretes: 30fps, 25fps, 20fps, 15fps
(176, 144) Discretes: 30fps, 25fps, 20fps, 15fps
(320, 240) Discretes: 30fps, 25fps, 20fps, 15fps
(352, 288) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 360) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 480) Discretes: 30fps, 25fps, 20fps, 15fps
(800, 600) Discretes: 10fps, 5fps
(848, 480) Discretes: 10fps, 5fps
(1024, 768) Discretes: 10fps, 5fps
(1280, 800) Discretes: 10fps, 5fps
(1280, 720) Discretes: 10fps, 5fps
MJPG (Motion-JPEG, compressed)
(1920, 1080) Discretes: 30fps, 25fps, 20fps, 5fps
(160, 120) Discretes: 30fps, 25fps, 20fps, 15fps
(176, 144) Discretes: 30fps, 25fps, 20fps, 15fps
(320, 240) Discretes: 30fps, 25fps, 20fps, 15fps
(352, 288) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 360) Discretes: 30fps, 25fps, 20fps, 5fps
(640, 480) Discretes: 30fps, 25fps, 20fps, 15fps
(800, 600) Discretes: 30fps, 25fps, 20fps, 5fps
(848, 480) Discretes: 30fps, 25fps, 20fps, 5fps
(1024, 768) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 800) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 720) Discretes: 30fps, 25fps, 20fps, 5fps
RGB3 (RGB3, emulated)
(1920, 1080) Discretes: 30fps, 25fps, 20fps, 5fps
(160, 120) Discretes: 30fps, 25fps, 20fps, 15fps
(176, 144) Discretes: 30fps, 25fps, 20fps, 15fps
(320, 240) Discretes: 30fps, 25fps, 20fps, 15fps
(352, 288) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 360) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 480) Discretes: 30fps, 25fps, 20fps, 15fps
(800, 600) Discretes: 30fps, 25fps, 20fps, 5fps
(848, 480) Discretes: 10fps, 5fps
(1024, 768) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 800) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 720) Discretes: 30fps, 25fps, 20fps, 5fps
BGR3 (BGR3, emulated)
(1920, 1080) Discretes: 30fps, 25fps, 20fps, 5fps
(160, 120) Discretes: 30fps, 25fps, 20fps, 15fps
(176, 144) Discretes: 30fps, 25fps, 20fps, 15fps
(320, 240) Discretes: 30fps, 25fps, 20fps, 15fps
(352, 288) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 360) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 480) Discretes: 30fps, 25fps, 20fps, 15fps
(800, 600) Discretes: 30fps, 25fps, 20fps, 5fps
(848, 480) Discretes: 10fps, 5fps
(1024, 768) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 800) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 720) Discretes: 30fps, 25fps, 20fps, 5fps
YU12 (YU12, emulated)
(1920, 1080) Discretes: 30fps, 25fps, 20fps, 5fps
(160, 120) Discretes: 30fps, 25fps, 20fps, 15fps
(176, 144) Discretes: 30fps, 25fps, 20fps, 15fps
(320, 240) Discretes: 30fps, 25fps, 20fps, 15fps
(352, 288) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 360) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 480) Discretes: 30fps, 25fps, 20fps, 15fps
(800, 600) Discretes: 30fps, 25fps, 20fps, 5fps
(848, 480) Discretes: 10fps, 5fps
(1024, 768) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 800) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 720) Discretes: 30fps, 25fps, 20fps, 5fps
YV12 (YV12, emulated)
(1920, 1080) Discretes: 30fps, 25fps, 20fps, 5fps
(160, 120) Discretes: 30fps, 25fps, 20fps, 15fps
(176, 144) Discretes: 30fps, 25fps, 20fps, 15fps
(320, 240) Discretes: 30fps, 25fps, 20fps, 15fps
(352, 288) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 360) Discretes: 30fps, 25fps, 20fps, 15fps
(640, 480) Discretes: 30fps, 25fps, 20fps, 15fps
(800, 600) Discretes: 30fps, 25fps, 20fps, 5fps
(848, 480) Discretes: 10fps, 5fps
(1024, 768) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 800) Discretes: 30fps, 25fps, 20fps, 5fps
(1280, 720) Discretes: 30fps, 25fps, 20fps, 5fps
http://loyd.github.io/rscam/rscam/struct.Camera.html
I'm asking because I often encounter the case where a 30 FPS FullHD
capture is only possible with MJPEG, like in this case. (The emulated modes
are done by v4l2 in software afaik.)
*When I open this camera with escapi, it chooses the slow 5 FPS YUYV mode
:(*
In my modified version of escapi I added MJPEG as a supported format and
then pass through the undecoded MJPEG buffer to my Rust application where I
use the mozjpeg-sys crate to decode the frames.
But it's very blind (not querying what's supported) & hardcoded to my
webcam, I want it to work for any webcam.
So what I would ideally want to do with escapi is: find the highest
resolution with at least 20 fps and use that format (and when it's MJPEG I
can decode it myself).
Is there any plan to allow querying for supported formats / resolutions /
framerates like this? :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#14>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEQ_R2pn3Yz0IJuH7xVFoARZRM-6_Apnks5t5DoOgaJpZM4UYNSe>
.
|
Hi Boscop, |
Would it be possible for escapi to allow querying for the supported formats of a camera, and then query for the supported resolutions of a given format?
Similar to how it's possible with the rscam Rust crate:
which prints:
http://loyd.github.io/rscam/rscam/struct.Camera.html
I'm asking because I often encounter the case where a 30 FPS FullHD capture is only possible with MJPEG, like in this case. (The emulated modes are done by v4l2 in software afaik.)
When I open this camera with escapi, it chooses the slow 5 FPS YUYV mode :(
In my modified version of escapi I added MJPEG as a supported format and then pass through the undecoded MJPEG buffer to my Rust application where I use the mozjpeg-sys crate to decode the frames.
But it's very blind (not querying what's supported) & hardcoded to my webcam, I want it to work for any webcam.
So what I would ideally want to do with escapi is: find the highest resolution with at least 20 fps and use that format (and when it's MJPEG I can decode it myself).
Is there any plan to allow querying for supported formats / resolutions / framerates like this? :)
The text was updated successfully, but these errors were encountered: