[FFmpeg-devel] lavc/mpegvideo_enc: allow to force low_delay by increasing strict_std_compliance

Submitted by Stefano Sabatini on May 24, 2017, 8:31 a.m.

Details

Message ID 20170524083110.GC7027@barisone
State New
Headers show

Commit Message

Stefano Sabatini May 24, 2017, 8:31 a.m.
On date Tuesday 2017-05-23 15:07:31 +0200, Moritz Barsnick encoded:
> On Tue, May 23, 2017 at 12:28:48 +0200, Stefano Sabatini wrote:
> > -        if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
> > +        if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
> > +            s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
> >              av_log(avctx, AV_LOG_ERROR,
> > -                  "low delay forcing is only available for mpeg2\n");
> > +                  "low delay forcing is only available for mpeg2, increase strict_std_compliance to force it\n");
> 
> Mathematically speaking, you need to decrease, not increase it (so that
> it makes s->strict_std_compliance >= FF_COMPLIANCE_NORMAL false).
> 
> #define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
> #define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
> #define FF_COMPLIANCE_NORMAL        0
> #define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
> #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
> 
> The text is also confusing (while correct) in that you'll be "forcing
> the forcing (of low delay)".
> 
> Perhaps something like:

> "[...] set strict_std_compliance to 'unofficial' or lower in order to
> allow it", or "enable it nevertheless". (I'm too lazy to check for
> other wordings.)

This sounds fine. Patch amended.

Thanks.

Comments

Michael Niedermayer May 26, 2017, 10:07 p.m.
On Wed, May 24, 2017 at 10:31:10AM +0200, Stefano Sabatini wrote:
> On date Tuesday 2017-05-23 15:07:31 +0200, Moritz Barsnick encoded:
> > On Tue, May 23, 2017 at 12:28:48 +0200, Stefano Sabatini wrote:
> > > -        if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
> > > +        if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
> > > +            s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
> > >              av_log(avctx, AV_LOG_ERROR,
> > > -                  "low delay forcing is only available for mpeg2\n");
> > > +                  "low delay forcing is only available for mpeg2, increase strict_std_compliance to force it\n");
> > 
> > Mathematically speaking, you need to decrease, not increase it (so that
> > it makes s->strict_std_compliance >= FF_COMPLIANCE_NORMAL false).
> > 
> > #define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
> > #define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
> > #define FF_COMPLIANCE_NORMAL        0
> > #define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
> > #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
> > 
> > The text is also confusing (while correct) in that you'll be "forcing
> > the forcing (of low delay)".
> > 
> > Perhaps something like:
> 
> > "[...] set strict_std_compliance to 'unofficial' or lower in order to
> > allow it", or "enable it nevertheless". (I'm too lazy to check for
> > other wordings.)
> 
> This sounds fine. Patch amended.
> 
> Thanks.
> -- 
> FFmpeg = Fabulous & Fascinating Maxi Power Elitist Gangster

>  mpegvideo_enc.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 0fa1dff6e9dbb5122cbea81ba56eb1892a0bb398  0003-lavc-mpegvideo_enc-allow-low_delay-for-non-MPEG2-cod.patch
> From 536d88be287613a3a49dd60c1023c2418e9b8810 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab@gmail.com>
> Date: Tue, 23 May 2017 12:22:41 +0200
> Subject: [PATCH] lavc/mpegvideo_enc: allow low_delay for non MPEG2 codecs
>  depending on strict_std_compliance
> 
> Forcing low_delay can be useful, even if not officially supported.
> ---
>  libavcodec/mpegvideo_enc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

probably ok

thanks

[...]
Stefano Sabatini June 6, 2017, 10:23 a.m.
On date Saturday 2017-05-27 00:07:38 +0200, Michael Niedermayer encoded:
> On Wed, May 24, 2017 at 10:31:10AM +0200, Stefano Sabatini wrote:
[...]
> >  mpegvideo_enc.c |    6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 0fa1dff6e9dbb5122cbea81ba56eb1892a0bb398  0003-lavc-mpegvideo_enc-allow-low_delay-for-non-MPEG2-cod.patch
> > From 536d88be287613a3a49dd60c1023c2418e9b8810 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab@gmail.com>
> > Date: Tue, 23 May 2017 12:22:41 +0200
> > Subject: [PATCH] lavc/mpegvideo_enc: allow low_delay for non MPEG2 codecs
> >  depending on strict_std_compliance
> > 
> > Forcing low_delay can be useful, even if not officially supported.
> > ---
> >  libavcodec/mpegvideo_enc.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> probably ok
> 
> thanks

Applied, thanks.

Patch hide | download patch | download mbox

From 536d88be287613a3a49dd60c1023c2418e9b8810 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <stefasab@gmail.com>
Date: Tue, 23 May 2017 12:22:41 +0200
Subject: [PATCH] lavc/mpegvideo_enc: allow low_delay for non MPEG2 codecs
 depending on strict_std_compliance

Forcing low_delay can be useful, even if not officially supported.
---
 libavcodec/mpegvideo_enc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index db241c8..bef9a28 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -671,9 +671,11 @@  FF_ENABLE_DEPRECATION_WARNINGS
     }
 
     if (s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY) {
-        if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
+        if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
+            s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
             av_log(avctx, AV_LOG_ERROR,
-                  "low delay forcing is only available for mpeg2\n");
+                  "low delay forcing is only available for mpeg2, "
+                   "set strict_std_compliance to 'unofficial' or lower in order to allow it\n");
             return -1;
         }
         if (s->max_b_frames != 0) {
-- 
1.9.1