Closed tosiara closed 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
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
Can you validate that you actually specified a height/width?
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
I can not reproduce this issue. Is it particular to timelapse and/or able to be replicated on a different computer?
I will take a closer look and gather some additional info
Pulled latest https://github.com/Motion-Project/motion/commit/eb137c5f5dffc0613a2459a39b855122918a71dc - both issues are resolved
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
Reopening this for a few weeks in case anyone has comments on this issue
Removed all distro ffmpeg and libs remainings, cloned fresh ffmpeg sources, rebuild everything from scratch - now cannot reproduce. Damn
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:
Second: