Hi Steffen,
On 05/27/2010 08:52 PM, Steffen Ebersbach wrote:
I'm currently developing an application, which encode mpeg2 video and
packetize it into a mpeg transport stream. Im using
guess_format("mpegts",0,0) for the oformat of AVFormatcontext. When I
save it to a file, everything works perfect.
To Stream it over IP , i would to use RTP , my Code looks like this:
url_fopen(&focontext->pb,"rtp://127.0.0.1:5000 , URL_WRONLY))
But the Output isn't RTP but raw udp with mpegts packets, like udp:// !
Is it possibly to send mpegts over rtp using libav?
It is possible (in theory, but I never tried directly). But it is a
little bit more complex than what you did.
Basically, you used "rtp://" as a protocol, but you did not use the RTP
muxer... In this way, you basically send UDP packets.
To use the RTP muxer with an MPEG TS, you have to:
1) encode the audio and video as you are already doing
2) mux them in an MPEG TS, using the TS muxer. But instead of writing
the TS stream to a file, you have to store it in memory buffers (you
can use url_open_dyn_buf() and friends, I think - ffserver.c should
contain some code showing how to do something similar... It uses
ASF, SWF, RM, etc instead of TS, and it uses HTTP instead of RTP,
but I think you can easily see what to do from there)
3) setup a "fake" codec with codec ID CODEC_ID_MPEG2TS
4) use such a codec for opening the RTP muxer (use one single AVStream,
with this codec)
5) write in the RTP muxer the buffers where you muxed the TS (point 2)
The other Problem i found is, that when i use udp as output
(udp://<ip>:<port>) the udp-packets includes not only closed ts-packets.
So one udp-packet includes all data from 7 ts-packets plus 156 Bytes of
the next one (at all 1472 Bytes per packet).
I think you can set the UDP packet size (by adding "?pkt_size=..." to the
URL) to solve this problem. Of course, you you use the RTP muxer this
is not needed.
Luca
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user