This topic describes how to integrate Native RTS SDK for Windows with a third-party player that is based on FFmpeg to use RTS in ApsaraVideo Live.
Procedure
This topic uses MSYS2 to compile FFmpeg as an example. In the MSYS2 installation directory, open the mingw64.exe command line interface.
Download and decompress the Native RTS SDK package. For more information about the download URL, see Release notes.
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.
Modify the allformats.c files to support the ARTC protocol.
extern AVInputFormat ff_rtc_demuxer;
Modify the ffplay.c file.
/* 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);
|| !strcmp(s->iformat->name, "artc")
av_set_rts_demuxer_funcs(get_rts_funcs(2));
Modify the Makefile file where ffplay.c is located.
$(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
Compile and run the code.
./ffplay -i "artc://<Streaming URL>"
NoteTo use low-latency streaming: ./ffplay -fflags nobuffer -flags low_delay "artc://<Streaming URL>"
PREFIX_DIR=`pwd`/"build-out-windows" CFLAGS="$CFLAGS -DWIN32 -D_WIN32 -DNDEBUG" ./configure \ --prefix=$PREFIX_DIR \ --extra-cflags="$CFLAGS" \ --enable-shared \ --disable-static \ --enable-gpl \ --enable-nonfree \ --enable-libfdk-aac \ --disable-decoder=hevc \ --disable-parser=hevc \ --disable-encoders || exit 1 make TARGET_OS=windows -j8 && make install || exit 1 cp /mingw64/bin/SDL2.dll ${PREFIX_DIR}/bin cp ../../release/windows/x86_64/RtsSDK/lib/RtsSDK.dll ${PREFIX_DIR}/bin echo "FFmpeg created in $PREFIX_DIR"