Merge commit '93afb6c98df876b15e3d911a9450ad55f92080ce'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 18 May 2014 12:30:43 +0000 (14:30 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 18 May 2014 12:38:36 +0000 (14:38 +0200)
* commit '93afb6c98df876b15e3d911a9450ad55f92080ce':
  avconv: set output avg_frame_rate when known

Conflicts:
ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
ffmpeg.c
tests/ref/lavf/wtv

diff --cc ffmpeg.c
+++ b/ffmpeg.c
@@@ -2654,49 -1845,23 +2654,51 @@@ static int transcode_init(void
                  enc_ctx->width  = ost->filter->filter->inputs[0]->w;
                  enc_ctx->height = ost->filter->filter->inputs[0]->h;
                  enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio =
 -                    ost->frame_aspect_ratio ? // overridden by the -aspect cli option
 -                    av_d2q(ost->frame_aspect_ratio * enc_ctx->height/enc_ctx->width, 255) :
 +                    ost->frame_aspect_ratio.num ? // overridden by the -aspect cli option
 +                    av_mul_q(ost->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) :
                      ost->filter->filter->inputs[0]->sample_aspect_ratio;
 +                if (!strncmp(ost->enc->name, "libx264", 7) &&
 +                    enc_ctx->pix_fmt == AV_PIX_FMT_NONE &&
 +                    ost->filter->filter->inputs[0]->format != AV_PIX_FMT_YUV420P)
 +                    av_log(NULL, AV_LOG_WARNING,
 +                           "No pixel format specified, %s for H.264 encoding chosen.\n"
 +                           "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
 +                           av_get_pix_fmt_name(ost->filter->filter->inputs[0]->format));
 +                if (!strncmp(ost->enc->name, "mpeg2video", 10) &&
 +                    enc_ctx->pix_fmt == AV_PIX_FMT_NONE &&
 +                    ost->filter->filter->inputs[0]->format != AV_PIX_FMT_YUV420P)
 +                    av_log(NULL, AV_LOG_WARNING,
 +                           "No pixel format specified, %s for MPEG-2 encoding chosen.\n"
 +                           "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
 +                           av_get_pix_fmt_name(ost->filter->filter->inputs[0]->format));
                  enc_ctx->pix_fmt = ost->filter->filter->inputs[0]->format;
  
 -                if (dec_ctx &&
 -                    (enc_ctx->width   != dec_ctx->width  ||
 -                     enc_ctx->height  != dec_ctx->height ||
 -                     enc_ctx->pix_fmt != dec_ctx->pix_fmt)) {
 -                    enc_ctx->bits_per_raw_sample = 0;
+                 ost->st->avg_frame_rate = ost->frame_rate;
 +                if (!dec_ctx ||
 +                    enc_ctx->width   != dec_ctx->width  ||
 +                    enc_ctx->height  != dec_ctx->height ||
 +                    enc_ctx->pix_fmt != dec_ctx->pix_fmt) {
 +                    enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
                  }
  
 -                if (ost->forced_keyframes)
 -                    parse_forced_key_frames(ost->forced_keyframes, ost,
 -                                            ost->st->codec);
 +                if (ost->forced_keyframes) {
 +                    if (!strncmp(ost->forced_keyframes, "expr:", 5)) {
 +                        ret = av_expr_parse(&ost->forced_keyframes_pexpr, ost->forced_keyframes+5,
 +                                            forced_keyframes_const_names, NULL, NULL, NULL, NULL, 0, NULL);
 +                        if (ret < 0) {
 +                            av_log(NULL, AV_LOG_ERROR,
 +                                   "Invalid force_key_frames expression '%s'\n", ost->forced_keyframes+5);
 +                            return ret;
 +                        }
 +                        ost->forced_keyframes_expr_const_values[FKF_N] = 0;
 +                        ost->forced_keyframes_expr_const_values[FKF_N_FORCED] = 0;
 +                        ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN;
 +                        ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN;
 +                    } else {
 +                        parse_forced_key_frames(ost->forced_keyframes, ost, ost->st->codec);
 +                    }
 +                }
                  break;
              case AVMEDIA_TYPE_SUBTITLE:
                  enc_ctx->time_base = (AVRational){1, 1000};
index dd55af7,0000000..b0ae7d1
mode 100644,000000..100644
--- /dev/null
@@@ -1,3 -1,0 +1,3 @@@
- fc6436e36e32a2c5c01f3e31df1c2cd1 *./tests/data/lavf/lavf.wtv
++b74b14ee41830aed90380bf6252dcfdb *./tests/data/lavf/lavf.wtv
 +413696 ./tests/data/lavf/lavf.wtv
 +./tests/data/lavf/lavf.wtv CRC=0x71287e25