1 #include "funcprotos.h"
8 printf("usage: rechunk [-f framerate] [-w width] [-h height] [-c fourcc] <input frames> <output movie>\n");
9 printf(" Concatenate input frames into a Quicktime movie.\n");
14 int main(int argc, char *argv[])
21 char string[1024], *output = 0;
23 int bytes = 0, old_bytes = 0;
24 float output_rate = 0;
29 char **input_frames = 0;
30 int total_input_frames = 0;
31 int width = 720, height = 480;
32 char compressor[5] = "yv12";
39 for(i = 1, j = 0; i < argc; i++)
41 if(!strcmp(argv[i], "-f"))
45 output_rate = atof(argv[++i]);
51 if(!strcmp(argv[i], "-w"))
54 width = atol(argv[++i]);
59 if(!strcmp(argv[i], "-h"))
62 height = atol(argv[++i]);
67 if(!strcmp(argv[i], "-c"))
71 strncpy(compressor, argv[++i], 4);
83 input_frames = realloc(input_frames, sizeof(char*) * total_input_frames);
84 input_frames[total_input_frames - 1] = argv[i];
90 if(input = fopen(output, "rb"))
92 printf("Output file already exists.\n");
96 if(!(file = quicktime_open(output, 0, 1)))
98 printf("Open failed\n");
102 quicktime_set_video(file, 1, width, height, output_rate, compressor);
104 for(i = 0; i < total_input_frames; i++)
106 /* Get output file */
107 if(!(input = fopen(input_frames[i], "rb")))
109 perror("Open failed");
113 /* Get input frame */
114 fseek(input, 0, SEEK_END);
115 bytes = ftell(input);
116 fseek(input, 0, SEEK_SET);
117 data = realloc(data, bytes);
119 fread(data, bytes, 1, input);
120 quicktime_write_frame(file, data, bytes, 0);
124 quicktime_close(file);