X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg.cc;h=c39ad8aabc4365131621e071d7aadace04e20764;hb=27173512f4ea4f2c324b9488180ba7cbd7173ec3;hp=fa369dda429c9342c2b08eed7a4b74ee50a38c35;hpb=c6c082c4a8016f85ba4207f4b8ccee1d5770e4a4;p=dcpomatic.git diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index fa369dda4..c39ad8aab 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -106,7 +106,10 @@ FFmpeg::setup_general () for (uint32_t i = 0; i < _format_context->nb_streams; ++i) { AVStream* s = _format_context->streams[i]; - if (s->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + /* Files from iTunes sometimes have two video streams, one with the avg_frame_rate.num and .den set + to zero. Ignore these streams. + */ + if (s->codec->codec_type == AVMEDIA_TYPE_VIDEO && s->avg_frame_rate.num > 0 && s->avg_frame_rate.den > 0) { _video_stream = i; } } @@ -149,7 +152,15 @@ FFmpeg::setup_decoders () AVCodec* codec = avcodec_find_decoder (context->codec_id); if (codec) { - if (avcodec_open2 (context, codec, 0) < 0) { + + /* This option disables decoding of DCA frame footers in our patched version + of FFmpeg. I believe these footers are of no use to us, and they can cause + problems when FFmpeg fails to decode them (mantis #352). + */ + AVDictionary* options = 0; + av_dict_set (&options, "disable_footer", "1", 0); + + if (avcodec_open2 (context, codec, &options) < 0) { throw DecodeError (N_("could not open decoder")); } }