59 int decoded = pkt.
size;
67 fprintf(stderr,
"Error decoding video frame\n");
72 printf(
"video_frame%s n:%d coded_n:%d pts:%s\n",
73 cached ?
"(cached)" :
"",
90 fprintf(stderr,
"Error decoding audio frame\n");
101 printf(
"audio_frame%s n:%d nb_samples:%d pts:%s\n",
102 cached ?
"(cached)" :
"",
131 fprintf(stderr,
"Could not find %s stream in input file '%s'\n",
136 st = fmt_ctx->
streams[*stream_idx];
142 fprintf(stderr,
"Failed to find %s codec\n",
148 fprintf(stderr,
"Failed to open %s codec\n",
161 struct sample_fmt_entry {
163 } sample_fmt_entries[] = {
173 struct sample_fmt_entry *entry = &sample_fmt_entries[i];
174 if (sample_fmt == entry->sample_fmt) {
175 *fmt =
AV_NE(entry->fmt_be, entry->fmt_le);
181 "sample format %s is not supported as output format\n",
186 int main (
int argc,
char **argv)
188 int ret = 0, got_frame;
191 fprintf(stderr,
"usage: %s input_file video_output_file audio_output_file\n"
192 "API example program to show how to read frames from an input file.\n"
193 "This program reads frames from a file, decodes them, and writes decoded\n"
194 "video frames to a rawvideo file named video_output_file, and decoded\n"
195 "audio frames to a rawaudio file named audio_output_file.\n"
208 fprintf(stderr,
"Could not open source file %s\n",
src_filename);
214 fprintf(stderr,
"Could not find stream information\n");
220 video_dec_ctx = video_stream->
codec;
234 fprintf(stderr,
"Could not allocate raw video buffer\n");
255 fprintf(stderr,
"Could not find audio or video stream in the input, aborting\n");
262 fprintf(stderr,
"Could not allocate frame\n");
286 }
while (pkt.
size > 0);
297 printf(
"Demuxing succeeded.\n");
300 printf(
"Play the output video file with the command:\n"
301 "ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
313 printf(
"Warning: the sample format the decoder produced is planar "
314 "(%s). This example will output the first channel only.\n",
315 packed ? packed :
"?");
323 printf(
"Play the output audio file with the command:\n"
324 "ffplay -f %s -ac %d -ar %d %s\n",