Skip to content

Commit

Permalink
add ffmpeg_duplicate_frames option
Browse files Browse the repository at this point in the history
This lets the user decide which video problems they would rather see.
In my case a Raspberry Pi 2 with a 640x480 webcam sometimes can keep
up with 10fps so I don't want to set the framerate any lower, but
then sometimes it can't and with duplicate frames it looks like the
video output freezes every second.
  • Loading branch information
dfries committed Aug 23, 2015
1 parent fb73273 commit 2496e21
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,15 @@ config_param config_params[] = {
print_string
},
{
"ffmpeg_duplicate_frames",
"# True to duplicate frames to achieve \"framerate\" fps, but enough\n"
"duplicated frames and the video appears to freeze once a second.",
0,
CONF_OFFSET(ffmpeg_duplicate_frames),
copy_bool,
print_bool
},
{
"output_debug_pictures",
"# Output pictures with only the pixels moving object (ghost images) (default: off)",
0,
Expand Down
1 change: 1 addition & 0 deletions conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct config {
int max_changes;
int threshold_tune;
const char *output_pictures;
int ffmpeg_duplicate_frames;
int motion_img;
int emulate_motion;
int event_gap;
Expand Down
7 changes: 6 additions & 1 deletion motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,13 @@ static void process_image_ring(struct context *cnt, unsigned int max_images)
/*
* Check if we must add any "filler" frames into movie to keep up fps
* Only if we are recording videos ( ffmpeg or extenal pipe )
* While the overall elapsed time might be correct, if there are
* many duplicated frames, say 10 fps, 5 duplicated, the video will
* look like it is frozen every second for half a second.
*/
if ((cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot == 0) &&
if (!cnt->conf.ffmpeg_duplicate_frames) {
/* don't duplicate frames */
} else if ((cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot == 0) &&
#ifdef HAVE_FFMPEG
(cnt->ffmpeg_output || (cnt->conf.useextpipe && cnt->extpipe))) {
#else
Expand Down

0 comments on commit 2496e21

Please sign in to comment.