[Libav-user] Only capturing Metadata from RTSP stream

g.parry at commandrooms.com g.parry at commandrooms.com
Wed Oct 11 18:58:42 EEST 2023

Hi there


I am working on a C++ library file that captures an RTSP stream and extracts
Onvif metadata.

My libraries are


extern "C" {

#include <libavformat/avformat.h>

#include <libavcodec/avcodec.h>

#include <libavutil/avutil.h>



The problem is I don't want the video or audio tracks because the CPU
workload is too high.


If I could send DESCRIBE and SETUP requests in FFmpeg my DESCRIBE url would
be rtsp://<ip>/Src/MediaInput/stream_1?event=1

And my SETUP url would be rtsp://<ip>/Src/MediaInput/trackID=4  ( metadata )


I've tried using a filtergraph


  char* filtergraph = av_strdup("!a:codec_type=video !a:codec_type=audio");


        // Set the filtergraph expression as an option

        av_dict_set(&format_opts, "map", filtergraph, 0);

        //  Set TCP as an option

        av_dict_set(&format_opts, "rtsp_transport", "tcp", 0);


       // Open the RTSP stream with the filtergraph expression

        int ret = avformat_open_input(&formatContext, fullrtspstring,
nullptr, &format_opts);


but trackID=1  the Video track is still captured.


Any suggestions welcome on streaming with just the metadata track.











-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20231011/0bc3fc88/attachment.htm>

More information about the Libav-user mailing list