Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebM integration #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 15 additions & 8 deletions ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions motion-dist.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion motion.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down