Thank you,

> 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.

I'm tested the parameter "?pkt_size" and it works fine, for TS-Pakekts it
must be 1316 so max. 7 in one UDP-packet.


But i still can't get around with the RTP thing.

> 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)

Ok, i create a ByteIOcontext with url_open_dyn_buf() and set it to
AVFormatContext->pb from my mpegts with mpeg2 video so when i make
av_write_interleaved_frame() on ths context the paketes go to this buffer.


> 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)

my code for this:

AVFormatContext *rtpcontext = av_alloc_context()
AVStream *fakevideo = 0;
fakevideo = av_new_stream(rtpcontext,0);        //Videostream
if (!fakevideo) return -1;
rtpcontext->oformat = guess_format("rtp",0,0);
rtpcontext->video_codec_id = CODEC_ID_MPEG2TS; //fakecodec
url_fopen(&rtpcontext->pb,"rtp://1.1.1.1:8000", URL_RDWR);


> 5) write in the RTP muxer the buffers where you muxed the TS (point 2)

That's the problem , i use get_bufer() from the ts-context and when
put_buffer with the rtpcontext. But everytime only 1024 Bytes are read, an
the output on IP is wrong. I think this is because url_open_dyn_buf()
returns a write only buffer (see avio.h)

The second way i make, is that i create the rtpcontext make
url_fopen("rtp://) and write the pb in the pb of the ts-context, but the
output was udp.


Steffen




_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to