[FFmpeg-devel] [PATCH] avformat/whip: set this muxer as experimental

Jack Lau jacklau1222gm at gmail.com
Thu Jun 5 18:12:39 EEST 2025



> On Jun 5, 2025, at 22:56, James Almer <jamrial at gmail.com> wrote:
> 
> On 6/5/2025 11:54 AM, Jack Lau via ffmpeg-devel wrote:
>> Signed-off-by: Jack Lau <jacklau1222 at qq.com>
>> ---
>>  libavformat/whip.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>> diff --git a/libavformat/whip.c b/libavformat/whip.c
>> index 0671e23635..e7cd57400d 100644
>> --- a/libavformat/whip.c
>> +++ b/libavformat/whip.c
>> @@ -1733,6 +1733,12 @@ static av_cold int whip_init(AVFormatContext *s)
>>      int ret;
>>      WHIPContext *whip = s->priv_data;
>>  +    if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
>> +        av_log(s, AV_LOG_ERROR,
>> +            "WHIP: This muxer is experimental, please set -strict experimental in order to enable it\n");
>> +        return AVERROR_EXPERIMENTAL;
>> +    }
>> +
>>      if ((ret = initialize(s)) < 0)
>>          goto end;
> 
> I think the AVFMT_EXPERIMENTAL flag is used for this.
I’ve tried this, but the whip runs normally even I don’t set `-strict experimental`

@@ -1913,7 +1913,7 @@ const FFOutputFormat ff_whip_muxer = {
     .p.long_name        = NULL_IF_CONFIG_SMALL("WHIP(WebRTC-HTTP ingestion protocol) muxer"),
     .p.audio_codec      = AV_CODEC_ID_OPUS,
     .p.video_codec      = AV_CODEC_ID_H264,
-    .p.flags            = AVFMT_GLOBALHEADER | AVFMT_NOFILE,
+    .p.flags            = AVFMT_GLOBALHEADER | AVFMT_NOFILE | AVFMT_EXPERIMENTAL,
     .p.priv_class       = &whip_muxer_class,
     .priv_data_size     = sizeof(WHIPContext),
     .init               = whip_init,

> ffmpeg -re -i input.mp4 -c copy -f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream"
ffmpeg version N-119824-gbdf45d079e Copyright (c) 2000-2025 the FFmpeg developers
  built with Apple clang version 17.0.0 (clang-1700.0.13.5)
  configuration: --enable-gpl --enable-shared --disable-static --disable-optimizations --enable-libx264 --enable-libx265 --enable-libopus --enable-sdl2 --enable-debug=3 --disable-stripping --enable-openssl --enable-version3
  libavutil      60.  3.100 / 60.  3.100
  libavcodec     62.  3.101 / 62.  3.101
  libavformat    62.  0.102 / 62.  0.102
  libavdevice    62.  0.100 / 62.  0.100
  libavfilter    11.  0.100 / 11.  0.100
  libswscale      9.  0.100 /  9.  0.100
  libswresample   6.  0.100 /  6.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.9.100
    comment         : vid:v0300fg10000cgho9hjc77u1ugkqvn10
  Duration: 00:01:47.40, start: 0.000000, bitrate: 5716 kb/s
  Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5613 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.21.100 libx264
  Stream #0:1[0x2](und): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 95 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
[WHIP muxer @ 0x119808200] WHIP: Muxer state=11, buffer_size=4096, max_packet_size=1184, elapsed=96ms(init:9,offer:0,answer:25,udp:0,ice:5,dtls:54,srtp:0)
Output #0, whip, to 'http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    comment         : vid:v0300fg10000cgho9hjc77u1ugkqvn10
    encoder         : Lavf62.0.102
  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 5613 kb/s, 30 fps, 30 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.21.100 libx264
  Stream #0:1(und): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 95 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Press [q] to stop, [?] for help
[WHIP muxer @ 0x119808200] WHIP: Dispose resource http://localhost:1985/rtc/v1/whip/?action=delete&token=i540z3223&app=live&stream=livestream&session=a2093739:93b7d050 ok
[out#0/whip @ 0x14a905320] video:1738KiB audio:25KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=   62 fps= 32 q=-1.0 Lsize=N/A time=00:00:02.03 bitrate=N/A speed=1.04x elapsed=0:00:01.94

I noticed the AVFMT_EXPERIMENTAL flag was used in this code:

format.c
186     while ((fmt1 = av_demuxer_iterate(&i))) {
187         if (fmt1->flags & AVFMT_EXPERIMENTAL)                                                                                        
188             continue;

So maybe the AVFMT_EXPERIMENTAL is only valid to demuxer for now?
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org <mailto:ffmpeg-devel at ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org <mailto:ffmpeg-devel-request at ffmpeg.org> with subject "unsubscribe".



More information about the ffmpeg-devel mailing list