59 int decoded = pkt.
size;
65 fprintf(stderr,
"Error decoding video frame\n");
70 printf(
"video_frame%s n:%d coded_n:%d pts:%s\n",
71 cached ?
"(cached)" :
"",
88 fprintf(stderr,
"Error decoding audio frame\n");
99 printf(
"audio_frame%s n:%d nb_samples:%d pts:%s\n",
100 cached ?
"(cached)" :
"",
129 fprintf(stderr,
"Could not find %s stream in input file '%s'\n",
134 st = fmt_ctx->
streams[*stream_idx];
140 fprintf(stderr,
"Failed to find %s codec\n",
146 fprintf(stderr,
"Failed to open %s codec\n",
159 struct sample_fmt_entry {
161 } sample_fmt_entries[] = {
171 struct sample_fmt_entry *entry = &sample_fmt_entries[i];
172 if (sample_fmt == entry->sample_fmt) {
173 *fmt =
AV_NE(entry->fmt_be, entry->fmt_le);
179 "sample format %s is not supported as output format\n",
184 int main (
int argc,
char **argv)
186 int ret = 0, got_frame;
189 fprintf(stderr,
"usage: %s input_file video_output_file audio_output_file\n"
190 "API example program to show how to read frames from an input file.\n"
191 "This program reads frames from a file, decodes them, and writes decoded\n"
192 "video frames to a rawvideo file named video_output_file, and decoded\n"
193 "audio frames to a rawaudio file named audio_output_file.\n"
206 fprintf(stderr,
"Could not open source file %s\n",
src_filename);
212 fprintf(stderr,
"Could not find stream information\n");
218 video_dec_ctx = video_stream->
codec;
232 fprintf(stderr,
"Could not allocate raw video buffer\n");
253 fprintf(stderr,
"Could not find audio or video stream in the input, aborting\n");
260 fprintf(stderr,
"Could not allocate frame\n");
284 }
while (pkt.
size > 0);
295 printf(
"Demuxing succeeded.\n");
298 printf(
"Play the output video file with the command:\n"
299 "ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
311 printf(
"Warning: the sample format the decoder produced is planar "
312 "(%s). This example will output the first channel only.\n",
313 packed ? packed :
"?");
321 printf(
"Play the output audio file with the command:\n"
322 "ffplay -f %s -ac %d -ar %d %s\n",