[Libav-user] Determine if input protocol is RTSP or file

Philippe Gorley philippe.gorley at savoirfairelinux.com
Fri Jul 5 16:12:40 EEST 2019

On 2019-07-05 2:23 a.m., lukas wrote:
> Dear libavusers,
> I patched some files of libavformat and libavcodec to include timestamps
> from RTPDemuxContext in the AVPacket (I did it similar to [1]). This is
> for the purpose of synchronizing multiple streams on the receiver side
> and works fine. Of course, it only works when the stream protocol is
> RTSP or RTP, not if the input is a file or another protocol that does
> not use RTPDemuxContext.
> Is there any value in AVFormatContext (or similar) which indicates of
> what protocol an opened stream is? Or do I have to manually parse the
> url to determine, if a RTSP source or a file is opened?

AVFormatContext.iformat.name should be "rtp" or "rtsp".

> Also, it would be helpful if the RTP and NTP timestamps from
> RTPDemuxContext would be exposed in the public API, so that no patch is
> needed. I found some solutions [2] which use the internal header files,
> but finally decided to just patch the public API since I could not get
> it compiled with the internal headers. Would it make sense to include
> this modification? Or does it brake compatibility with other protocols?

I'd suggest having a chat with the devs over on #ffmpeg-devel 
(freenode). They're better placed to give you an answer.

> Kind regards,
> Lukas Bommes
> [1] https://github.com/bytedeco/javacpp-presets/issues/374
> [2]
> https://stackoverflow.com/questions/20094998/retrieving-timestamp-in-rtp-rtsp 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".


Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

More information about the Libav-user mailing list