iowatcher: iowatcher: specify ffmpeg codec
authorNikita Danilov <danilov@gmail.com>
Wed, 19 Dec 2012 18:27:21 +0000 (11:27 -0700)
committerChris Mason <clm@fb.com>
Wed, 24 Sep 2014 19:02:07 +0000 (12:02 -0700)
    Add -C option to specify ffmped video code to use.

    Allow ffmpeg video codec to be specified on the command line. "libx264" is
    default.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
iowatcher/main.c

index 6e392f279ad82adc9f5a522ffb5af5b2a95b719f..41b28284b604c7e074519cc925281f7e2d4d3a4d 100644 (file)
@@ -143,6 +143,7 @@ static char *blktrace_device = NULL;
 static char *blktrace_outfile = "trace";
 static char *blktrace_dest_dir = ".";
 static char *program_to_run = NULL;
+static char *ffmpeg_codec = "libx264";
 
 static void alloc_mpstat_gld(struct trace_file *tf)
 {
@@ -873,7 +874,8 @@ static void mencode_movie(char *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);
+                "-vcodec %s %s", movie_dir, output_filename, ffmpeg_codec,
+                output_filename);
        system(line);
 }
 
@@ -1148,7 +1150,7 @@ enum {
        HELP_LONG_OPT = 1,
 };
 
-char *option_string = "T:t:o:l:r:O:N:d:D:p:m::h:w:c:x:y:a:PK";
+char *option_string = "T:t:o:l:r:O:N:d:D:p:m::h:w:c:x:y:a:C:PK";
 static struct option long_options[] = {
        {"columns", required_argument, 0, 'c'},
        {"title", required_argument, 0, 'T'},
@@ -1162,6 +1164,7 @@ static struct option long_options[] = {
        {"blktrace-destination", required_argument, 0, 'D'},
        {"prog", required_argument, 0, 'p'},
        {"movie", optional_argument, 0, 'm'},
+       {"codec", optional_argument, 0, 'C'},
        {"keep-movie-svgs", no_argument, 0, 'K'},
        {"width", required_argument, 0, 'w'},
        {"height", required_argument, 0, 'h'},
@@ -1184,6 +1187,7 @@ static void print_usage(void)
                "\t-p (--prog): program to run while blktrace is run\n"
                "\t-K (--keep-movie-svgs keep svgs generated for movie mode\n"
                "\t-m (--movie [=spindle|rect]): create IO animations\n"
+               "\t-C (--codec): ffmpeg codec. Use ffmpeg -codecs to list\n"
                "\t-r (--rolling): number of seconds in the rolling averge\n"
                "\t-T (--title): graph title\n"
                "\t-N (--no-graph): skip a single graph (io, tput, latency, queue_depth, \n"
@@ -1323,6 +1327,9 @@ static int parse_options(int ac, char **av)
                        fprintf(stderr, "Using movie style: %s\n",
                                movie_styles[movie_style]);
                        break;
+               case 'C':
+                       ffmpeg_codec = strdup(optarg);
+                       break;
                case 'h':
                        opt_graph_height = atoi(optarg);
                        break;