This topic describes how to integrate Native RTS SDK for macOS with a third-party player that is based on FFmpeg to use RTS in ApsaraVideo Live.

Procedure

  1. Download and decompress the Native RTS SDK package. For more information about the download URL, see Download SDKs.
  2. Copy the rtsdec.c and rtsenc.c files to the libavformat directory of the FFmpeg-based player.

    Modify the Makefile file. Add the descriptions of the rtsdec.o and rtsenc.o files to the Makefile file, as shown in the following figure.

    001
  3. Modify the allformats.c files to support the ARTC protocol.
    002
    extern AVInputFormat ff_rtc_demuxer;
    av_register_input_format(&ff_rtc_demuxer);
  4. Modify the ffplay.c file.
    ffplay.c
    /* connect rts library to rts plugin
     */
    struct rts_glue_funcs;
    extern const struct rts_glue_funcs *get_rts_funcs(int version);
    extern void av_set_rts_demuxer_funcs(const struct rts_glue_funcs *funcs);
    1.1
     || !strcmp(s->iformat->name, "artc")
    1
    av_set_rts_demuxer_funcs(get_rts_funcs(2));
  5. Modify the Makefile file where ffplay.c is located.
    2
    $(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(EXTRALIBS-$(1)) -lRtsSDK --verbose
    
    ifeq ($(TARGET_OS),windows)
    LDFLAGS += -L../../release/windows/x86_64/RtsSDK/lib/ -lRtsSDK
    endif
    ifeq  ($(TARGET_OS),mac)
      LDFLAGS += -L../../release/mac/x86_64/RtsSDK/lib -lRtsSDK
    endif
  6. Compile and run the code.

    ./ffplay -i "artc://<Streaming URL>"