Bachman
Posts: 13
Joined: Sun Sep 23, 2018 4:46 pm

Can't create snapshot with motion

Tue Oct 09, 2018 2:22 pm

Hello!

RPi 3B+, official webcam. Everything works, except the snapshot. If I initiating a snapshot (from Terminal or from a browser [http://192.168.0.101:8080/0/action/snapshot]), I always get an answer: "snapshot for thread 0 done". But I never find any file. Before snapshot:
ScreenShot_337.png
ScreenShot_337.png (83.18 KiB) Viewed 356 times
After snapshot:
ScreenShot_338.png
ScreenShot_338.png (12.01 KiB) Viewed 355 times
Reload the page not helping, I have to restart the motion service on the Pi to get it working again.
What am I doing wrong? Here is the config of the motion:

Code: Select all

Camera 0

    daemon = on
    process_id_file = /var/run/motion/motion.pid
    setup_mode = off
    camera_name = (not defined)
    logfile = (not defined)
    log_level = 1
    log_type = all
    videodevice = /dev/video0
    v4l2_palette = 17
    input = -1
    norm = 0
    frequency = 0
    rotate = 0
    width = 640
    height = 360
    framerate = 30
    minimum_frame_time = 1
    netcam_url = (not defined)
    netcam_userpass = (not defined)
    netcam_keepalive = off
    netcam_proxy = (not defined)
    netcam_tolerant_check = off
    rtsp_uses_tcp = on
    mmalcam_name = (not defined)
    mmalcam_control_params = (not defined)
    auto_brightness = off
    brightness = 0
    contrast = 0
    saturation = 0
    hue = 0
    power_line_frequency = -1
    roundrobin_frames = 1
    roundrobin_skip = 1
    switchfilter = off
    threshold = 1500
    threshold_tune = off
    noise_level = 32
    noise_tune = on
    despeckle_filter = EedDl
    area_detect = (not defined)
    mask_file = (not defined)
    smart_mask_speed = 0
    lightswitch = 0
    minimum_motion_frames = 1
    pre_capture = 0
    post_capture = 0
    event_gap = 60
    max_movie_time = 0
    emulate_motion = off
    output_pictures = off
    output_debug_pictures = off
    quality = 75
    camera_id = 0
    picture_type = jpeg
    ffmpeg_output_movies = off
    ffmpeg_output_debug_movies = off
    ffmpeg_timelapse = 0
    ffmpeg_timelapse_mode = daily
    ffmpeg_bps = 400000
    ffmpeg_variable_bitrate = 0
    ffmpeg_video_codec = mpeg4
    ffmpeg_duplicate_frames = off
    use_extpipe = off
    extpipe = (not defined)
    snapshot_interval = 0
    locate_motion_mode = off
    locate_motion_style = box
    text_right = %Y-%m-%d\n%T-%q
    text_left = (not defined)
    text_changes = off
    text_event = %Y%m%d%H%M%S
    text_double = off
    exif_text = (not defined)
    target_dir = /home/pi/Desktop/
    snapshot_filename = motion-snapshot
    picture_filename = motion-snapshot
    movie_filename = %v-%Y%m%d%H%M%S
    timelapse_filename = %Y%m%d-timelapse
    ipv6_enabled = off
    stream_port = 8081
    stream_quality = 50
    stream_motion = off
    stream_maxrate = 60
    stream_localhost = off
    stream_limit = 0
    stream_auth_method = 0
    stream_authentication = (not defined)
    stream_preview_scale = 25
    stream_preview_newline = off
    webcontrol_port = 8080
    webcontrol_localhost = off
    webcontrol_html_output = on
    webcontrol_authentication = (not defined)
    track_type = 0
    track_auto = off
    track_port = (not defined)
    track_motorx = 0
    track_motorx_reverse = off
    track_motory = 0
    track_motory_reverse = off
    track_maxx = 0
    track_minx = 0
    track_maxy = 0
    track_miny = 0
    track_homex = 128
    track_homey = 128
    track_iomojo_id = 0
    track_step_angle_x = 10
    track_step_angle_y = 10
    track_move_wait = 10
    track_speed = 255
    track_stepsize = 40
    quiet = on
    on_event_start = (not defined)
    on_event_end = (not defined)
    on_picture_save = (not defined)
    on_motion_detected = (not defined)
    on_area_detected = (not defined)
    on_movie_start = (not defined)
    on_movie_end = (not defined)
    on_camera_lost = (not defined)
    sql_log_picture = on
    sql_log_snapshot = on
    sql_log_movie = off
    sql_log_timelapse = off
    sql_query = sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
    database_type = (not defined)
    database_dbname = (not defined)
    database_host = localhost
    database_user = (not defined)
    database_password = (not defined)
    database_port = 0
    database_busy_timeout = 0
    video_pipe = (not defined)
    motion_video_pipe = (not defined)
    camera = No threads
    thread = No threads
    camera_dir = /etc/conf.d
Thank you for any help.

sora03
Posts: 193
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Re: Can't create snapshot with motion

Wed Oct 10, 2018 11:26 pm

you shoudl not modify the entire motion.conf, leave the commented entries commented unless you need to use them, comments are in ; and #
it might be wise if you create a file for your camera, eg. /etc/motion/camera1.conf
and add that to the motion.conf at the end of the file:
camera /etc/motion/camera1.conf

edit the camera1.conf with your config:

Code: Select all

    videodevice = /dev/video0
    v4l2_palette = 17
    width = 640
    height = 360
    framerate = 30
    webcontrol_localhost = off
    webcontrol_html_output = on
    text_right 'CAM1'
    target_dir /home/pi/m/%d/%Y\n%T-%v'
    output_pictures on
the framerate is too high to support, the target_dir is the location where the images will be saved. Motion is a motion detection program if you set a threshold it will automatically record or screenshot the camera and save it to a file, jpg or mp4.
FLOSS enthusiast, Debian user (linux-libre)

Return to “Troubleshooting”