diff options
author | Eric Sandeen <sandeen@redhat.com> | 2012-10-18 15:42:38 -0600 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-24 12:02:07 -0700 |
commit | aff25f0c38224027652f0d2bbcffaea50d4f7116 (patch) | |
tree | 732c44a7429b2f65bd53343ff45d165df5502c7e | |
parent | e95ba659594ce961648fb2d74dd1ddc71001b205 (diff) | |
download | blktrace-aff25f0c38224027652f0d2bbcffaea50d4f7116.tar.gz |
iowatcher: iowatcher: support png2theora for videos
ffmpeg is not available on all distributions, so include Theora
as an option, via png2theora, if the output movie filename ends
in .ogg or .ogv
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r-- | iowatcher/README | 13 | ||||
-rw-r--r-- | iowatcher/main.c | 23 |
2 files changed, 29 insertions, 7 deletions
diff --git a/iowatcher/README b/iowatcher/README index 09dd91d..f91fb6c 100644 --- a/iowatcher/README +++ b/iowatcher/README @@ -16,8 +16,8 @@ Output: Building: - Type make and make install. We need ffmpeg and librsvg to make - movies, otherwise there are no dependencies. + Type make and make install. We need ffmpeg or png2theora, and + librsvg to make movies, otherwise there are no dependencies. The basic options: @@ -35,9 +35,12 @@ The basic options: -l Sets a label in the graph for a trace file. The labels are added in the same order the trace files are added. - -m Create a movie. This defaults to the mp4 file format, and you - should also use -o filename.mp4. You can use any other filename, - but the end result will be an mp4. + -m Create a movie. The file format depends on the extension used in the + -o filename.* option. If you specify an .ogv or .ogg extension, the + result will be Ogg Theora video, if png2theora is available. + If you use an .mp4 extension, the result will be an mp4 video if + ffmpeg is avilable. You can use any other extension, but the end + result will be an mp4. You can use --movie=spindle or --movie=rect, which changes the style of the IO mapping. diff --git a/iowatcher/main.c b/iowatcher/main.c index 1f2f278..44cbb81 100644 --- a/iowatcher/main.c +++ b/iowatcher/main.c @@ -870,12 +870,31 @@ static void convert_movie_files(char *movie_dir) static void mencode_movie(char *movie_dir) { - fprintf(stderr, "Creating movie %s\n", movie_dir); + fprintf(stderr, "Creating movie %s with ffmpeg\n", movie_dir); snprintf(line, line_len, "ffmpeg -r 20 -y -i %s/%%10d-%s.svg.png -b:v 250k " "-vcodec libx264 %s", movie_dir, output_filename, output_filename); system(line); } +static void tencode_movie(char *movie_dir) +{ + fprintf(stderr, "Creating movie %s with png2theora\n", movie_dir); + snprintf(line, line_len, "png2theora -o %s %s/%%010d-%s.svg.png", + output_filename, movie_dir, output_filename); + system(line); +} + +static void encode_movie(char *movie_dir) +{ + char *last_dot = strrchr(output_filename, '.'); + + if (last_dot && + (!strncmp(last_dot, ".ogg", 4) || !strncmp(last_dot, ".ogv", 4))) { + tencode_movie(movie_dir); + } else + mencode_movie(movie_dir); +} + static void cleanup_movie(char *movie_dir) { fprintf(stderr, "Removing movie dir %s\n", movie_dir); @@ -1002,7 +1021,7 @@ static void plot_io_movie(struct plot *plot) free_all_plot_history(&movie_history); } convert_movie_files(movie_dir); - mencode_movie(movie_dir); + encode_movie(movie_dir); cleanup_movie(movie_dir); free(movie_dir); } |