diff mbox series

[FFmpeg-devel,v6] avcodec/mpeg12enc: support mpeg2 encoder const profile

Message ID 1590845364-9074-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit dd76226842f268c7f85a125da1834e3af2413be4
Headers show
Series [FFmpeg-devel,v6] avcodec/mpeg12enc: support mpeg2 encoder const profile | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Lance Wang May 30, 2020, 1:29 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 doc/encoders.texi      | 14 ++++++++++++++
 libavcodec/mpeg12enc.c |  2 ++
 libavcodec/profiles.h  |  8 ++++++++
 3 files changed, 24 insertions(+)

Comments

Marton Balint May 31, 2020, 5:19 p.m. UTC | #1
On Sat, 30 May 2020, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> doc/encoders.texi      | 14 ++++++++++++++
> libavcodec/mpeg12enc.c |  2 ++
> libavcodec/profiles.h  |  8 ++++++++
> 3 files changed, 24 insertions(+)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 954f0f6..1331b79 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
> @subsection Options
> 
> @table @option
> +@item profile @var{integer}
> +Select the mpeg2 profile to encode:
> +
> +@table @samp
> +@item 422
> +@item main
> +@item ss
> +Spatially Scalable
> +@item snr
> +SNR Scalable
> +@item high
> +@item simple
> +@end table
> +
> @item seq_disp_ext @var{integer}
> Specifies if the encoder should write a sequence_display_extension to the
> output.
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index cab7076..9fbbcef 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -41,6 +41,7 @@
> #include "mpeg12data.h"
> #include "mpegutils.h"
> #include "mpegvideo.h"
> +#include "profiles.h"
> 
> static const uint8_t svcd_scan_offset_placeholder[] = {
>     0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
>     {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
>     {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
>     FF_MPV_COMMON_OPTS
> +    FF_MPEG2_PROFILE_OPTS
>     { NULL },
> };
> 
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index e414ea7..d241925 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -43,6 +43,14 @@
>     FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
>     FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> 
> +#define FF_MPEG2_PROFILE_OPTS \
> +    FF_AVCTX_PROFILE_OPTION("422",           NULL, VIDEO, FF_PROFILE_MPEG2_422)\
> +    FF_AVCTX_PROFILE_OPTION("high",          NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
> +    FF_AVCTX_PROFILE_OPTION("ss",            NULL, VIDEO, FF_PROFILE_MPEG2_SS)\
> +    FF_AVCTX_PROFILE_OPTION("snr",           NULL, VIDEO, FF_PROFILE_MPEG2_SNR_SCALABLE)\
> +    FF_AVCTX_PROFILE_OPTION("main",          NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
> +    FF_AVCTX_PROFILE_OPTION("simple",        NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
> +
> extern const AVProfile ff_aac_profiles[];
> extern const AVProfile ff_dca_profiles[];
> extern const AVProfile ff_dnxhd_profiles[];
> --

LGTM, thanks.

Marton
Lance Wang May 31, 2020, 10:56 p.m. UTC | #2
On Sun, May 31, 2020 at 07:19:24PM +0200, Marton Balint wrote:
> 
> 
> On Sat, 30 May 2020, lance.lmwang@gmail.com wrote:
> 
> >From: Limin Wang <lance.lmwang@gmail.com>
> >
> >Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> >---
> >doc/encoders.texi      | 14 ++++++++++++++
> >libavcodec/mpeg12enc.c |  2 ++
> >libavcodec/profiles.h  |  8 ++++++++
> >3 files changed, 24 insertions(+)
> >
> >diff --git a/doc/encoders.texi b/doc/encoders.texi
> >index 954f0f6..1331b79 100644
> >--- a/doc/encoders.texi
> >+++ b/doc/encoders.texi
> >@@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
> >@subsection Options
> >
> >@table @option
> >+@item profile @var{integer}
> >+Select the mpeg2 profile to encode:
> >+
> >+@table @samp
> >+@item 422
> >+@item main
> >+@item ss
> >+Spatially Scalable
> >+@item snr
> >+SNR Scalable
> >+@item high
> >+@item simple
> >+@end table
> >+
> >@item seq_disp_ext @var{integer}
> >Specifies if the encoder should write a sequence_display_extension to the
> >output.
> >diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> >index cab7076..9fbbcef 100644
> >--- a/libavcodec/mpeg12enc.c
> >+++ b/libavcodec/mpeg12enc.c
> >@@ -41,6 +41,7 @@
> >#include "mpeg12data.h"
> >#include "mpegutils.h"
> >#include "mpegvideo.h"
> >+#include "profiles.h"
> >
> >static const uint8_t svcd_scan_offset_placeholder[] = {
> >    0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> >@@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
> >    {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
> >    {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
> >    FF_MPV_COMMON_OPTS
> >+    FF_MPEG2_PROFILE_OPTS
> >    { NULL },
> >};
> >
> >diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> >index e414ea7..d241925 100644
> >--- a/libavcodec/profiles.h
> >+++ b/libavcodec/profiles.h
> >@@ -43,6 +43,14 @@
> >    FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
> >    FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> >
> >+#define FF_MPEG2_PROFILE_OPTS \
> >+    FF_AVCTX_PROFILE_OPTION("422",           NULL, VIDEO, FF_PROFILE_MPEG2_422)\
> >+    FF_AVCTX_PROFILE_OPTION("high",          NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
> >+    FF_AVCTX_PROFILE_OPTION("ss",            NULL, VIDEO, FF_PROFILE_MPEG2_SS)\
> >+    FF_AVCTX_PROFILE_OPTION("snr",           NULL, VIDEO, FF_PROFILE_MPEG2_SNR_SCALABLE)\
> >+    FF_AVCTX_PROFILE_OPTION("main",          NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
> >+    FF_AVCTX_PROFILE_OPTION("simple",        NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
> >+
> >extern const AVProfile ff_aac_profiles[];
> >extern const AVProfile ff_dca_profiles[];
> >extern const AVProfile ff_dnxhd_profiles[];
> >--
> 
> LGTM, thanks.

thanks, will apply.

> 
> Marton
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
mypopy@gmail.com June 1, 2020, 1:24 a.m. UTC | #3
On Sat, May 30, 2020 at 9:29 PM <lance.lmwang@gmail.com> wrote:
>
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  doc/encoders.texi      | 14 ++++++++++++++
>  libavcodec/mpeg12enc.c |  2 ++
>  libavcodec/profiles.h  |  8 ++++++++
>  3 files changed, 24 insertions(+)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 954f0f6..1331b79 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
>  @subsection Options
>
>  @table @option
> +@item profile @var{integer}
> +Select the mpeg2 profile to encode:
> +
> +@table @samp
> +@item 422
> +@item main
> +@item ss
> +Spatially Scalable
> +@item snr
> +SNR Scalable
> +@item high
> +@item simple
> +@end table
> +
>  @item seq_disp_ext @var{integer}
>  Specifies if the encoder should write a sequence_display_extension to the
>  output.
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index cab7076..9fbbcef 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -41,6 +41,7 @@
>  #include "mpeg12data.h"
>  #include "mpegutils.h"
>  #include "mpegvideo.h"
> +#include "profiles.h"
>
>  static const uint8_t svcd_scan_offset_placeholder[] = {
>      0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
>      {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
>      {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
>      FF_MPV_COMMON_OPTS
> +    FF_MPEG2_PROFILE_OPTS
>      { NULL },
>  };
>
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index e414ea7..d241925 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -43,6 +43,14 @@
>      FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
>      FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
>
> +#define FF_MPEG2_PROFILE_OPTS \
> +    FF_AVCTX_PROFILE_OPTION("422",           NULL, VIDEO, FF_PROFILE_MPEG2_422)\
> +    FF_AVCTX_PROFILE_OPTION("high",          NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
> +    FF_AVCTX_PROFILE_OPTION("ss",            NULL, VIDEO, FF_PROFILE_MPEG2_SS)\
> +    FF_AVCTX_PROFILE_OPTION("snr",           NULL, VIDEO, FF_PROFILE_MPEG2_SNR_SCALABLE)\
Same as the off-line discussion, is it mpeg2 encoder support
FF_PROFILE_MPEG2_SS and FF_PROFILE_MPEG2_SNR_SCALABLE profile ?

> +    FF_AVCTX_PROFILE_OPTION("main",          NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
> +    FF_AVCTX_PROFILE_OPTION("simple",        NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
> +
>  extern const AVProfile ff_aac_profiles[];
>  extern const AVProfile ff_dca_profiles[];
>  extern const AVProfile ff_dnxhd_profiles[];
> --
> 1.8.3.1
Lance Wang June 1, 2020, 1:55 a.m. UTC | #4
On Mon, Jun 01, 2020 at 09:24:13AM +0800, mypopy@gmail.com wrote:
> On Sat, May 30, 2020 at 9:29 PM <lance.lmwang@gmail.com> wrote:
> >
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  doc/encoders.texi      | 14 ++++++++++++++
> >  libavcodec/mpeg12enc.c |  2 ++
> >  libavcodec/profiles.h  |  8 ++++++++
> >  3 files changed, 24 insertions(+)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 954f0f6..1331b79 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
> >  @subsection Options
> >
> >  @table @option
> > +@item profile @var{integer}
> > +Select the mpeg2 profile to encode:
> > +
> > +@table @samp
> > +@item 422
> > +@item main
> > +@item ss
> > +Spatially Scalable
> > +@item snr
> > +SNR Scalable
> > +@item high
> > +@item simple
> > +@end table
> > +
> >  @item seq_disp_ext @var{integer}
> >  Specifies if the encoder should write a sequence_display_extension to the
> >  output.
> > diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> > index cab7076..9fbbcef 100644
> > --- a/libavcodec/mpeg12enc.c
> > +++ b/libavcodec/mpeg12enc.c
> > @@ -41,6 +41,7 @@
> >  #include "mpeg12data.h"
> >  #include "mpegutils.h"
> >  #include "mpegvideo.h"
> > +#include "profiles.h"
> >
> >  static const uint8_t svcd_scan_offset_placeholder[] = {
> >      0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> > @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
> >      {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
> >      {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
> >      FF_MPV_COMMON_OPTS
> > +    FF_MPEG2_PROFILE_OPTS
> >      { NULL },
> >  };
> >
> > diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> > index e414ea7..d241925 100644
> > --- a/libavcodec/profiles.h
> > +++ b/libavcodec/profiles.h
> > @@ -43,6 +43,14 @@
> >      FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
> >      FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> >
> > +#define FF_MPEG2_PROFILE_OPTS \
> > +    FF_AVCTX_PROFILE_OPTION("422",           NULL, VIDEO, FF_PROFILE_MPEG2_422)\
> > +    FF_AVCTX_PROFILE_OPTION("high",          NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
> > +    FF_AVCTX_PROFILE_OPTION("ss",            NULL, VIDEO, FF_PROFILE_MPEG2_SS)\
> > +    FF_AVCTX_PROFILE_OPTION("snr",           NULL, VIDEO, FF_PROFILE_MPEG2_SNR_SCALABLE)\
> Same as the off-line discussion, is it mpeg2 encoder support
> FF_PROFILE_MPEG2_SS and FF_PROFILE_MPEG2_SNR_SCALABLE profile ?
I don't think so. As I said in another reply, user can set the ss and snr by 2
and 3 anyway, so I add then with const for consistent.

> 
> > +    FF_AVCTX_PROFILE_OPTION("main",          NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
> > +    FF_AVCTX_PROFILE_OPTION("simple",        NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
> > +
> >  extern const AVProfile ff_aac_profiles[];
> >  extern const AVProfile ff_dca_profiles[];
> >  extern const AVProfile ff_dnxhd_profiles[];
> > --
> > 1.8.3.1
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Carl Eugen Hoyos June 19, 2020, 4:50 p.m. UTC | #5
Am Sa., 30. Mai 2020 um 15:29 Uhr schrieb <lance.lmwang@gmail.com>:
>
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  doc/encoders.texi      | 14 ++++++++++++++
>  libavcodec/mpeg12enc.c |  2 ++
>  libavcodec/profiles.h  |  8 ++++++++
>  3 files changed, 24 insertions(+)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 954f0f6..1331b79 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
>  @subsection Options
>
>  @table @option
> +@item profile @var{integer}
> +Select the mpeg2 profile to encode:
> +
> +@table @samp
> +@item 422
> +@item main
> +@item ss
> +Spatially Scalable
> +@item snr
> +SNR Scalable
> +@item high
> +@item simple
> +@end table

Above looks wrong (as reported on the user mailing list):
high and main have to be swapped, no?

Carl Eugen
Lance Wang June 19, 2020, 10:44 p.m. UTC | #6
On Fri, Jun 19, 2020 at 06:50:03PM +0200, Carl Eugen Hoyos wrote:
> Am Sa., 30. Mai 2020 um 15:29 Uhr schrieb <lance.lmwang@gmail.com>:
> >
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  doc/encoders.texi      | 14 ++++++++++++++
> >  libavcodec/mpeg12enc.c |  2 ++
> >  libavcodec/profiles.h  |  8 ++++++++
> >  3 files changed, 24 insertions(+)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 954f0f6..1331b79 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
> >  @subsection Options
> >
> >  @table @option
> > +@item profile @var{integer}
> > +Select the mpeg2 profile to encode:
> > +
> > +@table @samp
> > +@item 422
> > +@item main
> > +@item ss
> > +Spatially Scalable
> > +@item snr
> > +SNR Scalable
> > +@item high
> > +@item simple
> > +@end table
> 
> Above looks wrong (as reported on the user mailing list):
> high and main have to be swapped, no?

User can't assume the integer value by the order, it's const 
string. I recall ffmpeg -h full can give the detail integer,
now it's missing for the profile options, what's the problem?

But I'll fix the order to avoid such confusing.

> 
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Marton Balint June 19, 2020, 11:05 p.m. UTC | #7
On Sat, 20 Jun 2020, lance.lmwang@gmail.com wrote:

> On Fri, Jun 19, 2020 at 06:50:03PM +0200, Carl Eugen Hoyos wrote:
>> Am Sa., 30. Mai 2020 um 15:29 Uhr schrieb <lance.lmwang@gmail.com>:
>> >
>> > From: Limin Wang <lance.lmwang@gmail.com>
>> >
>> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
>> > ---
>> >  doc/encoders.texi      | 14 ++++++++++++++
>> >  libavcodec/mpeg12enc.c |  2 ++
>> >  libavcodec/profiles.h  |  8 ++++++++
>> >  3 files changed, 24 insertions(+)
>> >
>> > diff --git a/doc/encoders.texi b/doc/encoders.texi
>> > index 954f0f6..1331b79 100644
>> > --- a/doc/encoders.texi
>> > +++ b/doc/encoders.texi
>> > @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
>> >  @subsection Options
>> >
>> >  @table @option
>> > +@item profile @var{integer}
>> > +Select the mpeg2 profile to encode:
>> > +
>> > +@table @samp
>> > +@item 422
>> > +@item main
>> > +@item ss
>> > +Spatially Scalable
>> > +@item snr
>> > +SNR Scalable
>> > +@item high
>> > +@item simple
>> > +@end table
>> 
>> Above looks wrong (as reported on the user mailing list):
>> high and main have to be swapped, no?
>
> User can't assume the integer value by the order, it's const 
> string.

I agree. As I explaned in the ffmpeg-user thread, the only confusing thing 
might be that @var{integer} is listed, maybe the @var{integer} parameter 
should be removed to avoid the confusion.

> I recall ffmpeg -h full can give the detail integer,
> now it's missing for the profile options, what's the problem?
>
> But I'll fix the order to avoid such confusing.

Fix it if you want, I don't really mind either way, but I think its not 
needed, because the user can't assume any mapping in general for 
constant options and their integer mappings.

Regards,
Marton
diff mbox series

Patch

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 954f0f6..1331b79 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2740,6 +2740,20 @@  MPEG-2 video encoder.
 @subsection Options
 
 @table @option
+@item profile @var{integer}
+Select the mpeg2 profile to encode:
+
+@table @samp
+@item 422
+@item main
+@item ss
+Spatially Scalable
+@item snr
+SNR Scalable
+@item high
+@item simple
+@end table
+
 @item seq_disp_ext @var{integer}
 Specifies if the encoder should write a sequence_display_extension to the
 output.
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index cab7076..9fbbcef 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -41,6 +41,7 @@ 
 #include "mpeg12data.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
+#include "profiles.h"
 
 static const uint8_t svcd_scan_offset_placeholder[] = {
     0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
@@ -1167,6 +1168,7 @@  static const AVOption mpeg2_options[] = {
     {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
     {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
     FF_MPV_COMMON_OPTS
+    FF_MPEG2_PROFILE_OPTS
     { NULL },
 };
 
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index e414ea7..d241925 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -43,6 +43,14 @@ 
     FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
     FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
 
+#define FF_MPEG2_PROFILE_OPTS \
+    FF_AVCTX_PROFILE_OPTION("422",           NULL, VIDEO, FF_PROFILE_MPEG2_422)\
+    FF_AVCTX_PROFILE_OPTION("high",          NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
+    FF_AVCTX_PROFILE_OPTION("ss",            NULL, VIDEO, FF_PROFILE_MPEG2_SS)\
+    FF_AVCTX_PROFILE_OPTION("snr",           NULL, VIDEO, FF_PROFILE_MPEG2_SNR_SCALABLE)\
+    FF_AVCTX_PROFILE_OPTION("main",          NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
+    FF_AVCTX_PROFILE_OPTION("simple",        NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
+
 extern const AVProfile ff_aac_profiles[];
 extern const AVProfile ff_dca_profiles[];
 extern const AVProfile ff_dnxhd_profiles[];