diff --git a/CHANGELOG b/CHANGELOG index 7c7f11e..e688ac4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -48,6 +48,8 @@ Features * Added codec Ogg/Theora as new output format for regular movies. http://www.lavrsen.dk/foswiki/bin/view/Motion/OggTimelapse (Michael Luich) * Added support for ffmpeg 0.11 new API. + * Added codec WebM/Theora as new output format for motion-triggered movies. + http://www.lavrsen.dk/foswiki/bin/edit/Motion/WebMVP8Codec (Jeremy T. Hetzel) Bugfixes * Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero) diff --git a/conf.c b/conf.c index 2da0da6..76617d1 100644 --- a/conf.c +++ b/conf.c @@ -750,7 +750,8 @@ config_param config_params[] = { "# flv - gives you a flash video with extension .flv\n" "# ffv1 - FF video codec 1 for Lossless Encoding ( experimental )\n" "# mov - QuickTime ( testing )\n" - "# ogg - Ogg/Theora ( testing )", + "# ogg - Ogg/Theora ( testing )\n" + "# webm - WebM/VP8 ( testing )", 0, CONF_OFFSET(ffmpeg_video_codec), copy_string, diff --git a/ffmpeg.c b/ffmpeg.c index 1c2ae47..592dfa3 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -326,6 +326,7 @@ void ffmpeg_init() static AVOutputFormat *get_oformat(const char *codec, char *filename) { const char *ext; + const int *ext_length; AVOutputFormat *of = NULL; /* * Here, we use guess_format to automatically setup the codec information. @@ -412,14 +413,19 @@ static AVOutputFormat *get_oformat(const char *codec, char *filename) #else of = av_guess_format("mov", NULL, NULL); #endif - } - else if (strcmp (codec, "ogg") == 0) - { - ext = ".ogg"; + } else if (strcmp (codec, "ogg") == 0) { + ext = ".ogg"; #ifdef GUESS_NO_DEPRECATED - of = guess_format ("ogg", NULL, NULL); + of = guess_format ("ogg", NULL, NULL); #else - of = av_guess_format ("ogg", NULL, NULL); + of = av_guess_format ("ogg", NULL, NULL); +#endif + } else if (strcmp (codec, "webm") == 0) { + ext = ".webm"; +#ifdef GUESS_NO_DEPRECATED + of = guess_format ("webm", NULL, NULL); +#else + of = av_guess_format ("webm", NULL, NULL); #endif } else { MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "%s: ffmpeg_video_codec option value" @@ -433,8 +439,9 @@ static AVOutputFormat *get_oformat(const char *codec, char *filename) return NULL; } - /* The 4 allows for ".avi" or ".mpg" to be appended. */ - strncat(filename, ext, 4); + /* Append extension to filename */ + ext_length = strlength(ext); + strncat(filename, ext, ext_length); return of; } diff --git a/motion-dist.conf.in b/motion-dist.conf.in index 30886bc..ac635c0 100644 --- a/motion-dist.conf.in +++ b/motion-dist.conf.in @@ -303,6 +303,7 @@ ffmpeg_variable_bitrate 0 # ffv1 - FF video codec 1 for Lossless Encoding ( experimental ) # mov - QuickTime ( testing ) # ogg - Ogg/Theora ( testing ) +# webm - WebM/VP8 ( testing ) ffmpeg_video_codec mpeg4 # Use ffmpeg to deinterlace video. Necessary if you use an analog camera diff --git a/motion.1 b/motion.1 index a023f83..a20195c 100644 --- a/motion.1 +++ b/motion.1 @@ -170,7 +170,7 @@ Values: 0, 2 - 31 / Default: 0 (disabled) Enables and defines variable bitrate for the ffmpeg encoder. ffmpeg_bps is ignored if variable bitrate is enabled. Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, or the range 2 - 31 where 2 means best quality and 31 is worst. .TP .B ffmpeg_video_codec discrete strings -Values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf , flv , ffv1, mov, ogg / Default: mpeg4 +Values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf , flv , ffv1, mov, ogg, webm / Default: mpeg4 .br Codec to be used by ffmpeg for the video compression. Timelapse movies are always made in mpeg1 format independent from this option. .TP