[Libav-user] [mpegts on RTP] avformat_open_input returns with no stream
Charles Buysschaert
c.buysschaert at intopix.com
Thu Mar 31 17:49:23 CEST 2016
Hello all,
I am trying to extract video frames from an mpeg2ts stream sent over RTP.
My input packets are Mpeg2Ts packets sent on UDP with a RTP Header, RTP "payload_type" is properly set to 33 (mpeg2ts).
When calling avformat_open_input with filename set to "udp://address:port" the returned "AVFormatContext" contains the video/audio streams that are contained in my TS stream.
When calling avformat_open_input with filename set to "rtp://address:port" the returned "AVFormatContext" does not fail but contains 0 streams.
I took a quick look at ffmpeg code (release 3.0):
With "udp://" :
===============
"avformat_open_input" understands that there is a TS stream, and calls "mpegts_read_header" function at the end of "avformat_open_input". This read_header function put the streams inside the context.
After, if I use the context to get frames, some are correct, but other have errors. (It is expected, as my flow contains RTP headers. I see headers are properly removed with "mpegts_resync" call except when there is a 0x47 in the RTP header)
So I guess I have to use rtp://address:port.
With "rtp://"
============================
I activated "trace" log and see that a SDP is created with following content. This is correct. 33 is the payload id properly retrieved from packets.
[rtp @ 0xf62990] SDP:
v=0
c=IN IP4 224.1.1.1
m=application 80 RTP/AVP 33
However, the function "avformat_open_input" just returns a context without any stream.
Can anyone help me with this?
Thank you,
Best regards,
Charles Buysschaert
More information about the Libav-user
mailing list