1 #include "funcprotos.h"
6 printf("usage: rechunk [-f framerate] [-w width] [-h height] [-c fourcc] <input frames> <output movie>\n");
7 printf(" Concatenate input frames into a Quicktime movie.\n");
12 int main(int argc
, char *argv
[])
19 char string
[1024], *output
= 0;
21 int bytes
= 0, old_bytes
= 0;
22 float output_rate
= 0;
27 char **input_frames
= 0;
28 int total_input_frames
= 0;
29 int width
= 720, height
= 480;
30 char compressor
[5] = "yv12";
37 for(i
= 1, j
= 0; i
< argc
; i
++)
39 if(!strcmp(argv
[i
], "-f"))
43 output_rate
= atof(argv
[++i
]);
49 if(!strcmp(argv
[i
], "-w"))
52 width
= atol(argv
[++i
]);
57 if(!strcmp(argv
[i
], "-h"))
60 height
= atol(argv
[++i
]);
65 if(!strcmp(argv
[i
], "-c"))
69 strncpy(compressor
, argv
[++i
], 4);
81 input_frames
= realloc(input_frames
, sizeof(char*) * total_input_frames
);
82 input_frames
[total_input_frames
- 1] = argv
[i
];
88 if(input
= fopen(output
, "rb"))
90 printf("Output file already exists.\n");
94 if(!(file
= quicktime_open(output
, 0, 1)))
96 printf("Open failed\n");
100 quicktime_set_video(file
, 1, width
, height
, output_rate
, compressor
);
102 for(i
= 0; i
< total_input_frames
; i
++)
104 /* Get output file */
105 if(!(input
= fopen(input_frames
[i
], "rb")))
107 perror("Open failed");
111 /* Get input frame */
112 fseek(input
, 0, SEEK_END
);
113 bytes
= ftell(input
);
114 fseek(input
, 0, SEEK_SET
);
115 data
= realloc(data
, bytes
);
117 fread(data
, bytes
, 1, input
);
118 quicktime_write_frame(file
, data
, bytes
, 0);
122 quicktime_close(file
);