[FFmpeg-devel] ffmpeg: remove misleading and incorrect error messages

Submitted by wm4 on June 15, 2017, 4:59 p.m.

Details

Message ID 20170615165959.15378-1-nfxjfg@googlemail.com
State Accepted
Commit f1df7cc10c62b3d7a8979be36d14b9fb6fc30ff7
Headers show

Commit Message

wm4 June 15, 2017, 4:59 p.m.
It is wrong/incorrect in two aspects:
1. The pixel format is not enough to guarantee that the resulting file
   will be any more compatible with media players.
2. Media players not supporting higher profiles are not necessarily
   outdated (in fact this is simply an arrogant statement that
   libavcodec can handle these particular features).

You could add that there are plenty of other ways to produce widely
incompatible files with ffmpeg, and these don't show any warnings.

What we really want to do here is defaulting to codec profiles that
have wide compatibility, such as baseline/main/high for h264. Also,
if an encoder does not accept certain pixfmts, we should automatically
convert them to a pixfmt the encoder can accept. But the existin
message certainly is not appropriate.

It also works for 2 specific encoders only. We should remove the
message for the reason alone to avoid that this code grows in the
future, and becomes a maintenance burden.
---
 ffmpeg.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

Comments

wm4 June 15, 2017, 5:03 p.m.
Those are warnings, not error messages. Fixed locally.
Paul B Mahol June 18, 2017, 6:41 p.m.
On 6/15/17, wm4 <nfxjfg@googlemail.com> wrote:
> Those are warnings, not error messages. Fixed locally.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

should be ok
wm4 June 20, 2017, 8:08 a.m.
On Sun, 18 Jun 2017 20:41:39 +0200
Paul B Mahol <onemda@gmail.com> wrote:

> On 6/15/17, wm4 <nfxjfg@googlemail.com> wrote:
> > Those are warnings, not error messages. Fixed locally.
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >  
> 
> should be ok

Pushed with modified commit message.

Patch hide | download patch | download mbox

diff --git a/ffmpeg.c b/ffmpeg.c
index 6170bd453c..a783e6e04b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3343,20 +3343,7 @@  static int init_output_stream_encode(OutputStream *ost)
             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 }) :
             av_buffersink_get_sample_aspect_ratio(ost->filter->filter);
-        if (!strncmp(ost->enc->name, "libx264", 7) &&
-            enc_ctx->pix_fmt == AV_PIX_FMT_NONE &&
-            av_buffersink_get_format(ost->filter->filter) != 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(av_buffersink_get_format(ost->filter->filter)));
-        if (!strncmp(ost->enc->name, "mpeg2video", 10) &&
-            enc_ctx->pix_fmt == AV_PIX_FMT_NONE &&
-            av_buffersink_get_format(ost->filter->filter) != 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(av_buffersink_get_format(ost->filter->filter)));
+
         enc_ctx->pix_fmt = av_buffersink_get_format(ost->filter->filter);
         if (dec_ctx)
             enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,