Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
@ 2023-08-20  4:10 Steven Liu
  2023-08-20  8:28 ` Jean-Baptiste Kempf
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Liu @ 2023-08-20  4:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Steven Liu

As the enhanced rtmp Extending NetConnection connect Command section
said, the rtmp should add a property named fourCcLive, but there should
only one codec can be set for the video stream in rtmp+flv, so user can
use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
hevc or vp9.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 doc/protocols.texi      | 17 +++++++++++++++++
 libavformat/rtmpproto.c | 22 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index b3fad55591..b5ab023066 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -896,6 +896,23 @@ be named, by prefixing the type with 'N' and specifying the name before
 the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
 times to construct arbitrary AMF sequences.
 
+@item rtmp_enhanced_flags @var{flags}
+Specify that the media is an enhanced rtmp live stream. This option have
+three flags, set one of them into fourCcLive property into Connect Command Message,
+The default is @{none}.
+
+@table @samp
+@item av1
+If the rtmp_enhanced_flags set av1, the video stream in enhanced rtmp is av1.
+
+@item hevc
+If the rtmp_enhanced_flags set hevc, the video stream in enhanced rtmp is hevc.
+
+@item vp9
+If the rtmp_enhanced_flags set vp9, the video stream in enhanced rtmp is vp9.
+
+@end table
+
 @item rtmp_flashver
 Version of the Flash plugin used to run the SWF player. The default
 is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index f0ef223f05..9dcc4bdc3a 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -69,6 +69,13 @@ typedef enum {
     STATE_STOPPED,    ///< the broadcast has been stopped
 } ClientState;
 
+typedef enum {
+    ENHANCED_NONE,
+    ENHANCED_AV1,
+    ENHANCED_HEVC,
+    ENHANCED_VP9,
+} EnhancedFlags;
+
 typedef struct TrackedMethod {
     char *name;
     int id;
@@ -123,6 +130,7 @@ typedef struct RTMPContext {
     int           nb_tracked_methods;         ///< number of tracked methods
     int           tracked_methods_size;       ///< size of the tracked methods buffer
     int           listen;                     ///< listen mode flag
+    int           enhanced_flags;             ///< 0: none, 1: av1, 2: hevc, 3: vp9
     int           listen_timeout;             ///< listen timeout to wait for new connections
     int           nb_streamid;                ///< The next stream id to return on createStream calls
     double        duration;                   ///< Duration of the stream in seconds as returned by the server (only valid if non-zero)
@@ -336,6 +344,16 @@ static int gen_connect(URLContext *s, RTMPContext *rt)
     ff_amf_write_field_name(&p, "app");
     ff_amf_write_string2(&p, rt->app, rt->auth_params);
 
+    if (rt->enhanced_flags > 0)
+        ff_amf_write_field_name(&p, "fourCcList");
+
+    if (rt->enhanced_flags == ENHANCED_AV1)
+        ff_amf_write_string(&p, "av01");
+    else if (rt->enhanced_flags == ENHANCED_HEVC)
+        ff_amf_write_string(&p, "hevc");
+    else if (rt->enhanced_flags == ENHANCED_VP9)
+        ff_amf_write_string(&p, "vp9");
+
     if (!rt->is_input) {
         ff_amf_write_field_name(&p, "type");
         ff_amf_write_string(&p, "nonprivate");
@@ -3104,6 +3122,10 @@ static const AVOption rtmp_options[] = {
     {"rtmp_conn", "Append arbitrary AMF data to the Connect message", OFFSET(conn), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
     {"rtmp_flashver", "Version of the Flash plugin used to run the SWF player.", OFFSET(flashver), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
     {"rtmp_flush_interval", "Number of packets flushed in the same request (RTMPT only).", OFFSET(flush_interval), AV_OPT_TYPE_INT, {.i64 = 10}, 0, INT_MAX, ENC},
+    {"rtmp_enhanced_flags", "Specify that the media is an enhanced rtmp live stream", OFFSET(enhanced_flags), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 3, ENC, "rtmp_enhanced_flags"},
+    {"av1", "enhanced rtmp with av1 codec", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, ENC, "rtmp_enhanced_flags"},
+    {"hevc", "enhanced rtmp with hevc codec", 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, ENC, "rtmp_enhanced_flags"},
+    {"vp9", "enhanced rtmp with vp9 codec", 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, ENC, "rtmp_enhanced_flags"},
     {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {.i64 = -2}, INT_MIN, INT_MAX, DEC, "rtmp_live"},
     {"any", "both", 0, AV_OPT_TYPE_CONST, {.i64 = -2}, 0, 0, DEC, "rtmp_live"},
     {"live", "live stream", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, DEC, "rtmp_live"},
-- 
2.39.2 (Apple Git-143)

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
  2023-08-20  4:10 [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp Steven Liu
@ 2023-08-20  8:28 ` Jean-Baptiste Kempf
  2023-08-21  1:35   ` Steven Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Jean-Baptiste Kempf @ 2023-08-20  8:28 UTC (permalink / raw)
  To: Steven Liu, ffmpeg-devel

Hello,

On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote:
> As the enhanced rtmp Extending NetConnection connect Command section
> said, the rtmp should add a property named fourCcLive, but there should
> only one codec can be set for the video stream in rtmp+flv, so user can
> use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
> hevc or vp9.

Technically, the protocol allows any type of FourCC, no?

jb
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
  2023-08-20  8:28 ` Jean-Baptiste Kempf
@ 2023-08-21  1:35   ` Steven Liu
  2023-08-23 15:39     ` Jean-Baptiste Kempf
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Liu @ 2023-08-21  1:35 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Steven Liu

Jean-Baptiste Kempf <jb@videolan.org> 于2023年8月20日周日 16:29写道:
>
> Hello,
Hi
>
> On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote:
> > As the enhanced rtmp Extending NetConnection connect Command section
> > said, the rtmp should add a property named fourCcLive, but there should
> > only one codec can be set for the video stream in rtmp+flv, so user can
> > use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
> > hevc or vp9.
>
> Technically, the protocol allows any type of FourCC, no?
The protocol should allows any type of FourCC, i saw there have three
codecs in the example["av01", "vp09", "hvc1"].
I think not all servers support fourCcList in connect command, so this
should set by user.


Thanks
Steven
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
  2023-08-21  1:35   ` Steven Liu
@ 2023-08-23 15:39     ` Jean-Baptiste Kempf
  2023-08-23 16:17       ` Martin Storsjö
  0 siblings, 1 reply; 7+ messages in thread
From: Jean-Baptiste Kempf @ 2023-08-23 15:39 UTC (permalink / raw)
  To: Steven Liu, ffmpeg-devel; +Cc: Steven Liu

Hello,

On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote:
> Jean-Baptiste Kempf <jb@videolan.org> 于2023年8月20日周日 16:29写道:
>>
>> Hello,
> Hi
>>
>> On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote:
>> > As the enhanced rtmp Extending NetConnection connect Command section
>> > said, the rtmp should add a property named fourCcLive, but there should
>> > only one codec can be set for the video stream in rtmp+flv, so user can
>> > use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
>> > hevc or vp9.
>>
>> Technically, the protocol allows any type of FourCC, no?
> The protocol should allows any type of FourCC, i saw there have three
> codecs in the example["av01", "vp09", "hvc1"].

My question is then why have 0,1,2,3 and not a fourcc then? Or does this question make no sense on the protocol level?

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
  2023-08-23 15:39     ` Jean-Baptiste Kempf
@ 2023-08-23 16:17       ` Martin Storsjö
  2023-08-23 17:40         ` Marton Balint
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Storsjö @ 2023-08-23 16:17 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Steven Liu, Steven Liu

On Wed, 23 Aug 2023, Jean-Baptiste Kempf wrote:

> Hello,
>
> On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote:
>> Jean-Baptiste Kempf <jb@videolan.org> 于2023年8月20日周日 16:29写道:
>>>
>>> Hello,
>> Hi
>>>
>>> On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote:
>>> > As the enhanced rtmp Extending NetConnection connect Command section
>>> > said, the rtmp should add a property named fourCcLive, but there should
>>> > only one codec can be set for the video stream in rtmp+flv, so user can
>>> > use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
>>> > hevc or vp9.
>>>
>>> Technically, the protocol allows any type of FourCC, no?
>> The protocol should allows any type of FourCC, i saw there have three
>> codecs in the example["av01", "vp09", "hvc1"].
>
> My question is then why have 0,1,2,3 and not a fourcc then? Or does this question make no sense on the protocol level?

Put another way, why map a string to a number and back to a string - why 
not just keep it a string throughout?

// Martin
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
  2023-08-23 16:17       ` Martin Storsjö
@ 2023-08-23 17:40         ` Marton Balint
  2023-08-24  5:33           ` Steven Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Marton Balint @ 2023-08-23 17:40 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On Wed, 23 Aug 2023, Martin Storsjö wrote:

> On Wed, 23 Aug 2023, Jean-Baptiste Kempf wrote:
>
>>  Hello,
>>
>>  On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote:
>>>  Jean-Baptiste Kempf <jb@videolan.org> 于2023年8月20日周日 16:29写道:
>>>>
>>>>  Hello,
>>>  Hi
>>>>
>>>>  On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote:
>>>> >  As the enhanced rtmp Extending NetConnection connect Command section
>>>> >  said, the rtmp should add a property named fourCcLive, but there 
>>>> >  should
>>>> >  only one codec can be set for the video stream in rtmp+flv, so user 
>>>> >  can
>>>> >  use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
>>>> >  hevc or vp9.
>>>>
>>>>  Technically, the protocol allows any type of FourCC, no?
>>>  The protocol should allows any type of FourCC, i saw there have three
>>>  codecs in the example["av01", "vp09", "hvc1"].
>>
>>  My question is then why have 0,1,2,3 and not a fourcc then? Or does this
>>  question make no sense on the protocol level?
>
> Put another way, why map a string to a number and back to a string - why not 
> just keep it a string throughout?

Agreed. Plus it is actually list, so you eventually you might want to 
support multiple fourcc-s by splitting the fourcc list. And the 
type is a strict array, so simply putting a string wihtout array length 
seems suspicious anyway.

Regards,
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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
  2023-08-23 17:40         ` Marton Balint
@ 2023-08-24  5:33           ` Steven Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Liu @ 2023-08-24  5:33 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Marton Balint <cus@passwd.hu> 于2023年8月24日周四 01:43写道:
>
>
>
> On Wed, 23 Aug 2023, Martin Storsjö wrote:
>
> > On Wed, 23 Aug 2023, Jean-Baptiste Kempf wrote:
> >
> >>  Hello,
> >>
> >>  On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote:
> >>>  Jean-Baptiste Kempf <jb@videolan.org> 于2023年8月20日周日 16:29写道:
> >>>>
> >>>>  Hello,
> >>>  Hi
> >>>>
> >>>>  On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote:
> >>>> >  As the enhanced rtmp Extending NetConnection connect Command section
> >>>> >  said, the rtmp should add a property named fourCcLive, but there
> >>>> >  should
> >>>> >  only one codec can be set for the video stream in rtmp+flv, so user
> >>>> >  can
> >>>> >  use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
> >>>> >  hevc or vp9.
> >>>>
> >>>>  Technically, the protocol allows any type of FourCC, no?
> >>>  The protocol should allows any type of FourCC, i saw there have three
> >>>  codecs in the example["av01", "vp09", "hvc1"].
> >>
> >>  My question is then why have 0,1,2,3 and not a fourcc then? Or does this
> >>  question make no sense on the protocol level?
> >
> > Put another way, why map a string to a number and back to a string - why not
> > just keep it a string throughout?
>
> Agreed. Plus it is actually list, so you eventually you might want to
> support multiple fourcc-s by splitting the fourcc list. And the
> type is a strict array, so simply putting a string wihtout array length
> seems suspicious anyway.

new version patchset is comming:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313444.html

>
> Regards,
> 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".
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-24  5:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-20  4:10 [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp Steven Liu
2023-08-20  8:28 ` Jean-Baptiste Kempf
2023-08-21  1:35   ` Steven Liu
2023-08-23 15:39     ` Jean-Baptiste Kempf
2023-08-23 16:17       ` Martin Storsjö
2023-08-23 17:40         ` Marton Balint
2023-08-24  5:33           ` Steven Liu

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git