Unsolved error camera EXT-Selfies
-
Bonjour,
Je me retrouve bloqué pour les selfies sur:
vcgencmd get_camera supported=0 detected=0, libcamera interfaces=0 v4l2-ctl --list-devices bcm2835-codec-decode (platform:bcm2835-codec): /dev/video10 /dev/video11 /dev/video12 /dev/video18 /dev/video31 /dev/media4 bcm2835-isp (platform:bcm2835-isp): /dev/video13 /dev/video14 /dev/video15 /dev/video16 /dev/video20 /dev/video21 /dev/video22 /dev/video23 /dev/media0 /dev/media3 unicam (platform:fe801000.csi): /dev/video0 /dev/video1 /dev/media1 rpivid (platform:rpivid): /dev/video19 /dev/media2
OS:
lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye
Version:
aarch64 Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
pi@raspberrypi:~/MagicMirror/modules/EXT-Selfies $ fswebcam -r 1280x720 --jpeg 100 --no-banner /home/pi/MagicMirror/modules/EXT-Selfies/photos/240504_180753.jpeg --- Opening /dev/video0... Trying source module v4l2... /dev/video0 opened. No input was specified, using the first. Error starting stream. VIDIOC_STREAMON: Invalid argument Unable to use mmap. Using read instead. --- Capturing frame... VIDIOC_DQBUF: Invalid argument No frames captured. pi@raspberrypi:~/MagicMirror/modules/EXT-Selfies $ libcamera-jpeg --output /home/pi/MagicMirror/modules/EXT-Selfies/photos/test19201080.jpeg --width 1920 --height 1080 Made X/EGL preview window [0:57:18.996857992] [2697] INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f [0:57:19.045280616] [2698] WARN RPI vc4.cpp:383 Mismatch between Unicam and CamHelper for embedded data usage! [0:57:19.046120920] [2698] INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media1 and ISP device /dev/media0 [0:57:19.046216456] [2698] INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml' [0:57:19.048171468] [2697] INFO Camera camera.cpp:1033 configuring streams: (0) 1640x922-YUV420 [0:57:19.048789423] [2698] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1920x1080-SBGGR10_1X10 - Selected unicam format: 1920x1080-pBAA [0:57:24.180881388] [2697] INFO Camera camera.cpp:1033 configuring streams: (0) 1920x1080-YUV420 (1) 3280x2464-SBGGR10_CSI2P [0:57:24.184219216] [2698] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA Still capture image received
Du coup il prend pas le snap avec fswebcam :(. par contre avec libcamera oui.
Comment je peux modifier pour executer la cli avec lbcamera-jpeg svp?
J’ai commencé à regarder : https://www.npmjs.com/package/@andrewiski/libcamera
Mais je suis un noobMerci.
Cdlt,
-
Re,
Petite update de fix rapide mode bricole ^^.
FSWebcam.js modifié:/** * API for fswebcam * * @requires [ libcamera-jpeg ] * * @param Object options * */ "use strict"; var Webcam = require( "./../Webcam.js" ); var Utils = require( "./../utils/Utils.js" ); var Shot = require( "./../Shot.js" ); //Main class function FSWebcam( options ) { var scope = this; scope.opts = Utils.setDefaults( options, FSWebcam.Defaults ); Webcam.call( scope, scope.opts ); if( scope.opts.output === "png" && scope.opts.quality > 9 ) { scope.opts.quality = 9; } } FSWebcam.prototype = Object.create( Webcam.prototype ); FSWebcam.prototype.constructor = FSWebcam; FSWebcam.prototype.bin = "libcamera-jpeg"; /** * @override * * Create shot possibly from memory stdout * */ FSWebcam.prototype.createShot = function( location, data ) { if( location === null ) { var data = Buffer.from( data ); } return new Shot( location, data ); }; /** * @override * * Generate shell statement * * @param String location * */ FSWebcam.prototype.generateSh = function( location ) { var scope = this; var resolution = " --width " + scope.opts.width + " --height " + scope.opts.height; // Adding frame rate var frames = scope.opts.frames ? "--framerate " + scope.opts.frames : ""; var output = "--nopreview -o"; var quality = scope.opts.quality; var delay = scope.opts.delay ? "--timeout " + scope.opts.delay : ""; var device = scope.opts.device ? "--device " + scope.opts.device : ""; var rotation = scope.opts.rotation ? "--rotate " + scope.opts.rotation : ""; var skip = scope.opts.skip ? "--skip " + scope.opts.skip : ""; if( scope.opts.saturation ) { scope.opts.setValues.Saturation = scope.opts.saturation; } var setValues = scope.getControlSetString( scope.opts.setValues ); var verbose = scope.opts.verbose ? "" : " -q" // Use memory if null location var shellLocation = (location === null) ? "- -" : location; var sh = scope.bin + " " + verbose + " " + resolution + " " + frames + " " + output + " " + delay + " " + device + " " + rotation + " " + setValues + " " + skip + " " + shellLocation; return sh; }; /** * Get control values string * * @param {Object} setValues * * @returns {String} * */ FSWebcam.prototype.getControlSetString = function( setValues ) { var str = ""; if( typeof( setValues ) !== "object" ) { return str; } for( var setName in setValues ) { var val = setValues[ setName ]; if( ! val ) { continue; } // Add a space to separate values if there are multiple control values being set if (str.length > 0) { str += " " } str += `-s ${setName}=${val}`; } return str }; /** * Get shell statement to get the available camera controls * * @returns {String} * */ FSWebcam.prototype.getListControlsSh = function() { var scope = this; var devSwitch = scope.opts.device ? " --device=" + scope.opts.device.trim() : ""; return scope.bin + devSwitch + " --list-controls"; } /** * Parse output of list camera controls shell command * * @param {String} stdout Output of the list camera control shell command * * @param {Function(Array<CameraControl>)} callback Function that receives * camera controls * */ FSWebcam.prototype.parseListControls = function ( stdout, callback ) { var cameraControls = []; var inOptions = false; var prefixLength = 0; var headerRegExp = new RegExp( "(?<prefix>.*)------------------\\s+-------------\\s+-----.*" ); var rangeRegExp = new RegExp( "(?<name>.*?)" + "\\s+-?\\d+(?:\\s+\\(\\d+%\\))?\\s+" + "(?<min>-?\\d+)" + " - " + "(?<max>-?\\d+)", "i" ); for ( var line of stdout.split( /\n|\r|\n\r|\r\n/ ) ) { line = line.slice( prefixLength ).trim(); inOptions = inOptions && line.startsWith( "-" ) ? false : inOptions; if ( inOptions ) { var rangeGroups = line.match( rangeRegExp ); if ( rangeGroups ) { var name = rangeGroups.groups.name; var minRange = parseInt( rangeGroups.groups.min ); var maxRange = parseInt( rangeGroups.groups.max ); cameraControls.push({ name: name, type: "range", min: minRange, max: maxRange, }); } else if ( line.lastIndexOf( "|" ) !== -1 ) { var opts = []; var opt = ""; var name = ""; var idx = line.lastIndexOf( "|" ); while ( idx !== -1 ) { opt = line.slice( idx + 1 ).trim(); opts.push( opt ); var firstIdx = line.indexOf( opt ); var lastIdx = line.lastIndexOf( opt ); if ( !name && firstIdx !== -1 && firstIdx !== lastIdx ) { name = line.slice( 0, firstIdx ).trim(); line = line.slice( firstIdx + opt.length ); idx = line.lastIndexOf( "|" ); } line = line.slice( 0, idx ).trim(); idx = line.lastIndexOf( "|" ); } if ( name && line.trim() ) { opts.push( line.trim() ); } else if ( !name ) { // Find largest number of words with two consecutive matches var words = line .split( " " ) .filter( function ( item ) { return Boolean( item ); }) .reverse(); var num_words = 1; opt = words.slice( 0, num_words ).reverse().join( " " ); var re = new RegExp( opt + "\\s+" + opt ); while ( !re.test( line ) ) { num_words += 1; opt = words.slice( 0, num_words ).reverse().join( " " ); re = new RegExp( opt + "\\s+" + opt ); } var firstIdx = line.indexOf( opt ); name = line.slice( 0, firstIdx ).trim(); opts.push( opt ); } cameraControls.push({ name: name, type: "list", opts: opts.reverse(), }); } } var obj = line.match( headerRegExp ); if ( obj ) { inOptions = true; // The output of the fswebcam --list-controls command has // terminal escape characters at the beginning of the each line prefixLength = obj.groups.prefix.length; } } callback && callback( cameraControls ); }; /** * Data validations based on fs output * * @inheritdoc * */ FSWebcam.prototype.runCaptureValidations = function( data ) { if( FSWebcam.Validations.noWebcam.exec( data ) ) { return new Error( "No webcam found" ); } return null; }; //Defaults FSWebcam.Defaults = { title: false, subTitle: false, timestamp: false, greyscale: false, saturation: false, skip: false, setValues: {}, }; //Validations const FSWebcam.Validations = { noWebcam: /no.*such.*(file|device)/i }; //Export module.exports = FSWebcam;
logs:
0|mm | [2024-05-05 07:35:36.185] [LOG] [SELFIES] Shoot payload: { 0|mm | options: { 0|mm | playShutter: true, 0|mm | autoValidate: false, 0|mm | showResult: true, 0|mm | TBkey: null, 0|mm | useTBKeyOnly: false 0|mm | } 0|mm | } 0|mm | [2024-05-05 07:35:36.191] [LOG] libcamera-jpeg --width 1280 --height 720 --nopreview -o /home/pi/MagicMirror/modules/EXT-Selfies/photos/240505_073536.jpeg 0|mm | [2024-05-05 07:35:42.190] [LOG] [1:02:44.256563060] [129653] INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f 0|mm | [1:02:44.306264310] [129670] WARN RPI vc4.cpp:383 Mismatch between Unicam and CamHelper for embedded data usage! 0|mm | [1:02:44.308139896] [129670] INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media0 and ISP device /dev/media1 0|mm | [1:02:44.309056143] [129670] INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml' 0|mm | [1:02:44.312765909] [129653] INFO Camera camera.cpp:1033 configuring streams: (0) 1640x922-YUV420 0|mm | [1:02:44.314176298] [129670] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1920x1080-SBGGR10_1X10 - Selected unicam format: 1920x1080-pBAA 0|mm | [1:02:49.448434916] [129653] INFO Camera camera.cpp:1033 configuring streams: (0) 1280x720-YUV420 (1) 3280x2464-SBGGR10_CSI2P 0|mm | [1:02:49.451941500] [129670] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA 0|mm | Still capture image received 0|mm | 0|mm | [2024-05-05 07:35:42.193] [LOG] [SELFIES] Photo is taken: /home/pi/MagicMirror/modules/EXT-Selfies/photos/240505_073536.jpeg 0|mm | [2024-05-05 07:35:49.810] [LOG] [SELFIES] File deleted: 240505_073536.jpeg 0|mm | [2024-05-05 07:35:57.990] [LOG] [SELFIES] Shoot payload: { 0|mm | options: { 0|mm | playShutter: true, 0|mm | autoValidate: false, 0|mm | showResult: true, 0|mm | TBkey: null, 0|mm | useTBKeyOnly: false 0|mm | } 0|mm | } 0|mm | [2024-05-05 07:35:57.992] [LOG] libcamera-jpeg --width 1280 --height 720 --nopreview -o /home/pi/MagicMirror/modules/EXT-Selfies/photos/240505_073557.jpeg 0|mm | [2024-05-05 07:36:03.904] [LOG] [1:03:05.990341184] [130193] INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f 0|mm | [1:03:06.036506111] [130204] WARN RPI vc4.cpp:383 Mismatch between Unicam and CamHelper for embedded data usage! 0|mm | [1:03:06.038205477] [130204] INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media0 and ISP device /dev/media1 0|mm | [1:03:06.038299309] [130204] INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml' 0|mm | [1:03:06.039992583] [130193] INFO Camera camera.cpp:1033 configuring streams: (0) 1640x922-YUV420 0|mm | [1:03:06.041446897] [130204] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1920x1080-SBGGR10_1X10 - Selected unicam format: 1920x1080-pBAA 0|mm | [1:03:11.164496794] [130193] INFO Camera camera.cpp:1033 configuring streams: (0) 1280x720-YUV420 (1) 3280x2464-SBGGR10_CSI2P 0|mm | [1:03:11.167139037] [130204] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA 0|mm | Still capture image received 0|mm | 0|mm | [2024-05-05 07:36:03.906] [LOG] [SELFIES] Photo is taken: /home/pi/MagicMirror/modules/EXT-Selfies/photos/240505_073557.jpeg 0|mm | [2024-05-05 07:36:08.344] [LOG] [SELFIES] File deleted: 240505_073557.jpeg 0|mm | [2024-05-05 07:36:25.990] [LOG] [SELFIES] Shoot payload: { 0|mm | options: { 0|mm | playShutter: true, 0|mm | autoValidate: false, 0|mm | showResult: true, 0|mm | TBkey: null, 0|mm | useTBKeyOnly: false 0|mm | } 0|mm | } 0|mm | [2024-05-05 07:36:25.992] [LOG] libcamera-jpeg --width 1280 --height 720 --nopreview -o /home/pi/MagicMirror/modules/EXT-Selfies/photos/240505_073625.jpeg 0|mm | [2024-05-05 07:36:31.945] [LOG] [1:03:34.018821355] [130894] INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f 0|mm | [1:03:34.070512857] [130906] WARN RPI vc4.cpp:383 Mismatch between Unicam and CamHelper for embedded data usage! 0|mm | [1:03:34.071435086] [130906] INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media0 and ISP device /dev/media1 0|mm | [1:03:34.071514511] [130906] INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml' 0|mm | [1:03:34.072563478] [130894] INFO Camera camera.cpp:1033 configuring streams: (0) 1640x922-YUV420 0|mm | [1:03:34.073494077] [130906] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1920x1080-SBGGR10_1X10 - Selected unicam format: 1920x1080-pBAA 0|mm | [1:03:39.192184601] [130894] INFO Camera camera.cpp:1033 configuring streams: (0) 1280x720-YUV420 (1) 3280x2464-SBGGR10_CSI2P 0|mm | [1:03:39.195349318] [130906] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA 0|mm | Still capture image received 0|mm | 0|mm | [2024-05-05 07:36:31.947] [LOG] [SELFIES] Photo is taken: /home/pi/MagicMirror/modules/EXT-Selfies/photos/240505_073625.jpeg
J’ai du supprimer la qualité image et ajouter -o après le --nopreview.
Je sais pas si j’ai bien fais mais le snap se prend et je peux le sauvegarder.
Désolé d’abimer ton bébé @bugsounet :(.
Cdlt,
-
Je complète avec ma config:
{ "module": "EXT-Selfies", "position": "top_left", "config": { "debug": true, "captureWidth": 1920, "captureHeight": 1080, "device": null, "usePreview": false, "previewWidth": 1920, "previewHeight": 1080, "displayButton": true, "buttonStyle": 0, "buttons": { "1": "master.png", "2": "halloween.png", "3": "birthday.png", "4": "christmas.png" }, "blinkButton": false, "playShutter": true, "resultDuration": 15000, "autoValidate": false, "counterStyle": 3, "showResult": true } },
Cdlt,