Up Apeche 実行ユーザ変更 (www-data → pi) の理由 作成: 2021-02-20
更新: 2024-12-20


    mjpg-streamer を動かしている下で raspistill を実行することはできない。
    よって,ストリーミングをファインダにしながらの静止画撮影は,つぎのプロセスになる:
    1. mjpg-streamer を停止 (pkill mjpg)
    2. raspistill を実行
    3. mjpg-streamer を起動

    このプロセスを http-php ブログラムで実現することは,現状ではできない。
    Apache の実行ユーザは www-data であり,これの権限では,mjpg-streamer の停止・起動はできないからである。


    mjpg-streamer を起動: $ ./mjpg.sh 1200 900 1 100 & [1] 1173 pi@raspi:~ $ MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34 i: fps.............: 1 i: resolution........: 1200 x 900 i: camera parameters..............: Sharpness 0, Contrast 0, Brightness 50 Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0 Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none' Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128 Rotation 0, hflip No, vflip No ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000 o: www-folder-path......: /home/pi/mjpg-streamer/www/ o: HTTP TCP port........: 8080 o: HTTP Listen Address..: (null) o: username:password....: disabled o: commands.............: enabled i: Starting Camera Encoder Buffer Size 81920 このとき,mjpg-streamer は不可: $ raspistill -o test.jpg mmal: mmal_vc_component_enable: failed to enable component: ENOSPC mmal: camera component couldn't be enabled mmal: main: Failed to create camera component mmal: Failed to run camera app. Please check for firmware updates ------------------------------------ mjpg-streamer を停止: $ sudo pkill mjpg [1]+ Terminated ./mjpg.sh 1200 900 1 100 このとき,aspistill は有効: $ raspistill -o test.jpg r$ ls | grep test.jpg test.jpg (画像が作成されている)