82 #include "common/tools_common.h"
83 #include "common/video_reader.h"
85 static const char *exec_name;
87 void usage_exit(
void) {
88 fprintf(stderr,
"Usage: %s <infile> <outfile>\n", exec_name);
92 int main(
int argc,
char **argv) {
96 AvxVideoReader *reader = NULL;
97 const AvxInterface *decoder = NULL;
98 const AvxVideoInfo *info = NULL;
102 if (argc != 3) die(
"Invalid number of arguments.");
104 reader = aom_video_reader_open(argv[1]);
105 if (!reader) die(
"Failed to open %s for reading.", argv[1]);
107 if (!(outfile = fopen(argv[2],
"wb")))
108 die(
"Failed to open %s for writing.", argv[2]);
110 info = aom_video_reader_get_info(reader);
112 decoder = get_aom_decoder_by_fourcc(info->codec_fourcc);
113 if (!decoder) die(
"Unknown input codec.");
118 die_codec(&codec,
"Failed to initialize decoder.");
120 while (aom_video_reader_read_frame(reader)) {
123 size_t frame_size = 0;
124 const unsigned char *frame =
125 aom_video_reader_get_frame(reader, &frame_size);
127 die_codec(&codec,
"Failed to decode frame.");
130 aom_img_write(img, outfile);
135 printf(
"Processed %d frames.\n", frame_cnt);
138 printf(
"Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
139 info->frame_width, info->frame_height, argv[2]);
141 aom_video_reader_close(reader);