Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.65k stars 547 forks source link

Timelapse issues #339

Closed tosiara closed 7 years ago

tosiara commented 7 years ago

Afetr upgrading to the latest https://github.com/Motion-Project/motion/commit/b5c3a73cc62e7641e550cf742a90a74f78bdae33 I also noticed some issues with timelapse. On one machine timelapse fails to encode frames, but motion continues. On another the failure causes motion to stuck in a restart loop

One machine:

[1:ml1] [WRN] [EVT] event_ffmpeg_timelapse: The swf container for timelapse no longer supported.  Using mpg container.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Timelapse using mpg codec.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Events will be appended to file
[1:ml1] [NTC] [EVT] event_newfile: File of type 32 saved to: /home/ubuntu/cam0/20170305-timelapse-mk808.mpg
[1:ml1] [ERR] [ENC] ffmpeg_encode_video: Error receiving encoded packet video:Resource temporarily unavailable
[1:ml1] [ERR] [EVT] event_ffmpeg_timelapse: Error encoding image

Second:

root@odroid:/home/odroid# motion/motion -c motion.conf -n
[0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file motion.conf
[0:motion] [ALR] [ALL] conf_cmdparse: Unknown config option "ffmpeg_deinterlace"
[0:motion] [ALR] [ALL] conf_cmdparse: Unknown config option "sdl_threadnr"
[0:motion] [NTC] [ALL] motion_startup: Motion 4.0.1+gitede7a0b Started
[0:motion] [NTC] [ALL] motion_startup: Logging to syslog
[0:motion] [NTC] [ALL] motion_startup: Using log type (ALL) log level (NTC)
[0:motion] [NTC] [ENC] ffmpeg_init: ffmpeg libavcodec version 57.81.100 libavformat version 57.66.102
[0:motion] [NTC] [ALL] main: Camera 0 is from motion.conf
[0:motion] [NTC] [ALL] main: Camera 0 is device: /dev/webcam0 input -1
[0:motion] [NTC] [ALL] main: Stream port 8081
[0:motion] [NTC] [ALL] main: Waiting for threads to finish, pid: 14094
[1:ml1] [NTC] [ALL] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] v4l2_start: Using videodevice /dev/webcam0 and input -1
[1:ml1] [NTC] [VID] v4l2_get_capability: 
------------------------
cap.driver: "uvcvideo"
cap.card: "WideCam 1050"
cap.bus_info: "usb-s5p-ehci-3.2"
cap.capabilities=0x84000001
------------------------
[1:ml1] [NTC] [VID] v4l2_get_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] v4l2_get_capability: - STREAMING
[1:ml1] [NTC] [VID] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[0:web_control] [NTC] [STR] http_bindsock: listening on 127.0.0.1 port 8080
[1:ml1] [NTC] [VID] v4l2_select_input: - CAMERA
[0:web_control] [NTC] [STR] httpd_run: Started motion-httpd server on port 8080 (auth Disabled)
[1:ml1] [NTC] [VID] v4l2_select_input: Device doesn't support specifying PAL/NTSC norm
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Testing palette MJPG (640x480)
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Using palette MJPG (640x480) bytesperlines 0 sizeimage 614400 colorspace 00000008
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980900, "Brightness", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Brightness", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980901, "Contrast", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Contrast", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980902, "Saturation", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Saturation", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980903, "Hue", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Hue", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980918, "Power Line Frequency", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Power Line Frequency", default 1, current 1
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980910, "Gamma", range 72,500 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gamma", default 100, current 100
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980913, "Gain", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gain", default 0, current 0
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [NTC] [STR] http_bindsock: listening on any IPv4 address port 8081
[1:ml1] [NTC] [ALL] motion_init: Started motion-stream server on port 8081 (auth Disabled)
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 3 items
[0:web_control] [NTC] [STR] httpd_run: motion-httpd - Read from client
[1:ml1] [WRN] [EVT] event_ffmpeg_timelapse: The swf container for timelapse no longer supported.  Using mpg container.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Timelapse using mpg codec.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Events will be appended to file
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 640x0 is invalid
[1:ml1] [NTC] [ENC] ffmpeg_avcodec_log: Ignoring invalid width/height values
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 0x0 is invalid
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_open: Could not open codec Invalid argument
[1:ml1] [ERR] [EVT] event_ffmpeg_timelapse: ffopen_open error creating (timelapse) file [/home/odroid/cam0/20170305-timelapse-odroid.mpg]: Broken pipe
[1:ml1] [NTC] [ALL] motion_loop: Thread exiting
[1:ml1] [NTC] [STR] stream_stop: Closing motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [STR] stream_stop: Closed motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [VID] vid_close: Cleaning up V4L2 device
[1:ml1] [NTC] [VID] v4l2_cleanup: Closing video device /dev/webcam0
[0:motion] [NTC] [ALL] main: Motion thread 1 restart
[1:ml1] [NTC] [ALL] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] v4l2_start: Using videodevice /dev/webcam0 and input -1
[1:ml1] [NTC] [VID] v4l2_get_capability: 
------------------------
cap.driver: "uvcvideo"
cap.card: "WideCam 1050"
cap.bus_info: "usb-s5p-ehci-3.2"
cap.capabilities=0x84000001
------------------------
[1:ml1] [NTC] [VID] v4l2_get_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] v4l2_get_capability: - STREAMING
[1:ml1] [NTC] [VID] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1:ml1] [NTC] [VID] v4l2_select_input: - CAMERA
[1:ml1] [NTC] [VID] v4l2_select_input: Device doesn't support specifying PAL/NTSC norm
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Testing palette MJPG (640x480)
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Using palette MJPG (640x480) bytesperlines 0 sizeimage 614400 colorspace 00000008
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980900, "Brightness", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Brightness", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980901, "Contrast", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Contrast", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980902, "Saturation", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Saturation", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980903, "Hue", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Hue", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980918, "Power Line Frequency", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Power Line Frequency", default 1, current 1
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980910, "Gamma", range 72,500 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gamma", default 100, current 100
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980913, "Gain", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gain", default 0, current 0
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [NTC] [STR] http_bindsock: listening on any IPv4 address port 8081
[1:ml1] [NTC] [ALL] motion_init: Started motion-stream server on port 8081 (auth Disabled)
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 3 items
[1:ml1] [WRN] [EVT] event_ffmpeg_timelapse: The swf container for timelapse no longer supported.  Using mpg container.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Timelapse using mpg codec.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Events will be appended to file
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 640x0 is invalid
[1:ml1] [NTC] [ENC] ffmpeg_avcodec_log: Ignoring invalid width/height values
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 0x0 is invalid
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_open: Could not open codec Invalid argument
[1:ml1] [ERR] [EVT] event_ffmpeg_timelapse: ffopen_open error creating (timelapse) file [/home/odroid/cam0/20170305-timelapse-odroid.mpg]: Invalid argument
[1:ml1] [NTC] [ALL] motion_loop: Thread exiting
[1:ml1] [NTC] [STR] stream_stop: Closing motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [STR] stream_stop: Closed motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [VID] vid_close: Cleaning up V4L2 device
[1:ml1] [NTC] [VID] v4l2_cleanup: Closing video device /dev/webcam0
[0:motion] [NTC] [ALL] main: Motion thread 1 restart
[1:ml1] [NTC] [ALL] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] v4l2_start: Using videodevice /dev/webcam0 and input -1
[1:ml1] [NTC] [VID] v4l2_get_capability: 
------------------------
cap.driver: "uvcvideo"
cap.card: "WideCam 1050"
cap.bus_info: "usb-s5p-ehci-3.2"
cap.capabilities=0x84000001
------------------------
[1:ml1] [NTC] [VID] v4l2_get_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] v4l2_get_capability: - STREAMING
[1:ml1] [NTC] [VID] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1:ml1] [NTC] [VID] v4l2_select_input: - CAMERA
[1:ml1] [NTC] [VID] v4l2_select_input: Device doesn't support specifying PAL/NTSC norm
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Testing palette MJPG (640x480)
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Using palette MJPG (640x480) bytesperlines 0 sizeimage 614400 colorspace 00000008
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980900, "Brightness", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Brightness", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980901, "Contrast", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Contrast", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980902, "Saturation", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Saturation", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980903, "Hue", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Hue", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980918, "Power Line Frequency", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Power Line Frequency", default 1, current 1
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980910, "Gamma", range 72,500 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gamma", default 100, current 100
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980913, "Gain", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gain", default 0, current 0
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [NTC] [STR] http_bindsock: listening on any IPv4 address port 8081
[1:ml1] [NTC] [ALL] motion_init: Started motion-stream server on port 8081 (auth Disabled)
[1:ml1] [WRN] [EVT] event_ffmpeg_timelapse: The swf container for timelapse no longer supported.  Using mpg container.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Timelapse using mpg codec.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Events will be appended to file
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 640x0 is invalid
[1:ml1] [NTC] [ENC] ffmpeg_avcodec_log: Ignoring invalid width/height values
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 0x0 is invalid
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
[1:ml1] [ERR] [ENC] ffmpeg_open: Could not open codec Invalid argument
[1:ml1] [ERR] [EVT] event_ffmpeg_timelapse: ffopen_open error creating (timelapse) file [/home/odroid/cam0/20170305-timelapse-odroid.mpg]: Invalid argument
[1:ml1] [NTC] [ALL] motion_loop: Thread exiting
[1:ml1] [NTC] [STR] stream_stop: Closing motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [STR] stream_stop: Closed motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [VID] vid_close: Cleaning up V4L2 device
[1:ml1] [NTC] [VID] v4l2_cleanup: Closing video device /dev/webcam0
[0:motion] [NTC] [ALL] main: Motion thread 1 restart
[1:ml1] [NTC] [ALL] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] v4l2_start: Using videodevice /dev/webcam0 and input -1
[1:ml1] [NTC] [VID] v4l2_get_capability: 
------------------------
cap.driver: "uvcvideo"
cap.card: "WideCam 1050"
cap.bus_info: "usb-s5p-ehci-3.2"
cap.capabilities=0x84000001
------------------------
[1:ml1] [NTC] [VID] v4l2_get_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] v4l2_get_capability: - STREAMING
[1:ml1] [NTC] [VID] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1:ml1] [NTC] [VID] v4l2_select_input: - CAMERA
[1:ml1] [NTC] [VID] v4l2_select_input: Device doesn't support specifying PAL/NTSC norm
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Testing palette MJPG (640x480)
[1:ml1] [NTC] [VID] v4l2_do_set_pix_format: Using palette MJPG (640x480) bytesperlines 0 sizeimage 614400 colorspace 00000008
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980900, "Brightness", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Brightness", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980901, "Contrast", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Contrast", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980902, "Saturation", range 0,255 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Saturation", default 128, current 128
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980903, "Hue", range -128,127 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Hue", default 0, current 0
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980918, "Power Line Frequency", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Power Line Frequency", default 1, current 1
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980910, "Gamma", range 72,500 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gamma", default 100, current 100
[1:ml1] [NTC] [VID] v4l2_scan_controls: found control 0x00980913, "Gain", range 0,2 
[1:ml1] [NTC] [VID] v4l2_scan_controls:     "Gain", default 0, current 0
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [NTC] [STR] http_bindsock: listening on any IPv4 address port 8081
[1:ml1] [NTC] [ALL] motion_init: Started motion-stream server on port 8081 (auth Disabled)
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 3 items
^C[1:ml1] [NTC] [ALL] mlp_actions: End of event 1
[1:ml1] [NTC] [ALL] motion_loop: Thread exiting
[1:ml1] [NTC] [STR] stream_stop: Closing motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [STR] stream_stop: Closed motion-stream listen socket & active motion-stream sockets
[1:ml1] [NTC] [VID] vid_close: Cleaning up V4L2 device
[1:ml1] [NTC] [VID] v4l2_cleanup: Closing video device /dev/webcam0
[0:web_control] [NTC] [STR] httpd_run: motion-httpd - Finishing
[0:web_control] [NTC] [STR] httpd_run: motion-httpd Closing
[0:web_control] [NTC] [STR] motion_web_control: motion-httpd thread exit
[0:motion] [NTC] [ALL] main: Threads finished
[0:motion] [NTC] [ALL] main: Motion terminating
tosiara commented 7 years ago

This first issue is caused exactly by https://github.com/Motion-Project/motion/commit/b5c3a73cc62e7641e550cf742a90a74f78bdae33

[1:ml1] [WRN] [EVT] event_ffmpeg_timelapse: The swf container for timelapse no longer supported.  Using mpg container.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Timelapse using mpg codec.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Events will be appended to file
[1:ml1] [NTC] [EVT] event_newfile: File of type 32 saved to: /home/ubuntu/cam0/20170305-timelapse-mk808.mpg
[1:ml1] [ERR] [ENC] ffmpeg_encode_video: Error receiving encoded packet video:Resource temporarily unavailable
[1:ml1] [ERR] [EVT] event_ffmpeg_timelapse: Error encoding image

The second one is caused by something different, tried to roll back few later commits - still happens. Investigating

tosiara commented 7 years ago

The second issue is caused by tis commit: https://github.com/Motion-Project/motion/commit/1a41fe8ab7c758a2fe69924922ddc549e6171a6c

[1:ml1] [WRN] [EVT] event_ffmpeg_timelapse: The swf container for timelapse no longer supported.  Using mpg container.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Timelapse using mpg codec.
[1:ml1] [NTC] [EVT] event_ffmpeg_timelapse: Events will be appended to file
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 640x0 is invalid
[1:ml1] [NTC] [ENC] ffmpeg_avcodec_log: Ignoring invalid width/height values
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Picture size 0x0 is invalid
[1:ml1] [ERR] [ENC] ffmpeg_avcodec_log: Specified pixel format yuvj420p is invalid or not supported
Mr-Dave commented 7 years ago

Can you validate that you actually specified a height/width?

tosiara commented 7 years ago

Sure I am:

# Image width (pixels). Valid range: Camera dependent, default: 352
width 640

# Image height (pixels). Valid range: Camera dependent, default: 288
height 480

And if I checkout the previous commit tree - all works perfect. That's how I found which exactly commit introduced the issue

Mr-Dave commented 7 years ago

I can not reproduce this issue. Is it particular to timelapse and/or able to be replicated on a different computer?

tosiara commented 7 years ago

I will take a closer look and gather some additional info

tosiara commented 7 years ago

Pulled latest https://github.com/Motion-Project/motion/commit/eb137c5f5dffc0613a2459a39b855122918a71dc - both issues are resolved

tosiara commented 7 years ago

Came across this issue again, and it looks like some issue with ffmpeg function avcodec_open2. Adding some logging arround it gives the following results:

diff --git a/ffmpeg.c b/ffmpeg.c
index 30a9cde..952946e 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -564,8 +564,9 @@ static int ffmpeg_set_codec(struct ffmpeg *ffmpeg){
         MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "%s: Unable to set quality");
         return -1;
     }
-
+    MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO, "%s Before avcodec_open2: codec %s, size %dx%d", ffmpeg->codec_name, ffmpeg->ctx_codec->width, ffmpeg->ctx_codec->height);
     retcd = avcodec_open2(ffmpeg->ctx_codec, ffmpeg->codec, &ffmpeg->opts);
+    MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO, "%s After avcodec_open2: codec %s, size %dx%d", ffmpeg->codec_name, ffmpeg->ctx_codec->width, ffmpeg->ctx_codec->height);
     if (retcd < 0) {
         if (ffmpeg->codec->supported_framerates) {
             const AVRational *fps = ffmpeg->codec->supported_framerates;

Motion output shows pointer corruption after this function (picture dimensions changed):

[1:ml1] [INF] [ENC] ffmpeg_set_codec Before avcodec_open2: codec mpg, size 640x480
[1:ml1] [INF] [ENC] ffmpeg_avcodec_log: Picture size 480x0 is invalid
[1:ml1] [INF] [ENC] ffmpeg_avcodec_log: Ignoring invalid width/height values
[1:ml1] [INF] [ENC] ffmpeg_avcodec_log: Picture size 0x0 is invalid
[1:ml1] [INF] [ENC] ffmpeg_avcodec_log: Specified pixel format yuyv422 is invalid or not supported
[1:ml1] [INF] [ENC] ffmpeg_set_codec After avcodec_open2: codec mpg, size 0x0

ffmpeg libavcodec version 57.24.102 libavformat version 57.25.100

tosiara commented 7 years ago

Reopening this for a few weeks in case anyone has comments on this issue

tosiara commented 7 years ago

Removed all distro ffmpeg and libs remainings, cloned fresh ffmpeg sources, rebuild everything from scratch - now cannot reproduce. Damn