-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hi.
I captured some frames and saved it to files.
And I copied the files to local machine and tried to open it by photo viewer, but it said that "The format is not supported.".
By using ImageMagick's imdisplay command, I can see the image with a warning dialog says that some extraneous bytes before marker 0xdxx.
The output of lsusb command is as follows.
$ lsusb
Bus 001 Device 005: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
My source is as follows.
let mut camera = Camera::new("/dev/video0").unwrap();
camera.start(&Config {
interval: (1, 30),
resolution: (640, 480),
format: b"MJPG",
..Default::default()
}).expect("Failed to start the camera device.")
for i in 0..10 {
let frame = camera.capture().unwrap();
let mut file = File::create(&format!( "assets/frame-{}.jpg", i )).unwrap();
file.write_all(&frame).unwrap();
}Binary data of one of the files are as follows.
00000000: ff d8 ff e0 00 21 41 56 49 31 00 01 01 01 00 78 | .....!AVI1.....x
00000010: 00 78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .x..............
00000020: 00 00 00 00 00 ff db 00 43 00 08 05 06 07 06 05 | ........C.......
00000030: 08 07 06 07 09 08 08 09 0c 14 0d 0c 0b 0b 0c 18 | ................
00000040: 11 12 0e 14 1d 19 1e 1e 1c 19 1c 1f 20 24 2e 27 | ............ $.'
00000050: 20 22 2b 22 1b 1c 28 34 28 2b 2f 31 33 34 33 1f | "+"..(4(+/1343.
00000060: 26 38 3c 38 32 3c 2e 32 33 31 ff db 00 43 01 08 | &8<82<.231...C..
00000070: 09 09 0c 0a 0c 17 0d 0d 17 31 21 1c 21 31 31 31 | .........1!.!111
00000080: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 | 1111111111111111
00000090: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 | 1111111111111111
000000a0: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 ff | 111111111111111.
...(omit)...
000064e0: 15 ec 63 e5 90 6d 63 ef da b9 9a 51 77 43 62 a9 | ..c..mc....QwCb.
000064f0: c7 34 | .4
Jpeg files start at ffd8 and end at ffd9, so I think that just a part of the captured data is written to the file.
(Additionally, it might be strange that a number of 00 bytes and 31 bytes are repeated...)
What should I do about it?
Have I missed any dependencies or procedures?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels