diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-28 00:03:14 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-06-05 17:10:15 +0200 |
commit | 3bc060f36676a738604289fd446069d5e17f979a (patch) | |
tree | 414f72382a020ff8b57845851e09d4ef5a12f5d8 /doc/examples/transcoding.c | |
parent | 134cba728bc6f4e3c5caec98b800faad244d8cfb (diff) | |
download | ffmpeg-3bc060f36676a738604289fd446069d5e17f979a.tar.gz |
doc/examples/transcoding: Use the decoders pixel format if the encoder does not list which are supported
This affects rawvideo and wraped_avframe, no others are affected atm
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'doc/examples/transcoding.c')
-rw-r--r-- | doc/examples/transcoding.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index d5d410b168..8633362d46 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -128,7 +128,10 @@ static int open_output_file(const char *filename) enc_ctx->width = dec_ctx->width; enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio; /* take first format from list of supported formats */ - enc_ctx->pix_fmt = encoder->pix_fmts[0]; + if (encoder->pix_fmts) + enc_ctx->pix_fmt = encoder->pix_fmts[0]; + else + enc_ctx->pix_fmt = dec_ctx->pix_fmt; /* video time_base can be set to whatever is handy and supported by encoder */ enc_ctx->time_base = dec_ctx->time_base; } else { |