[FFmpeg-devel] how to save rtp stream?

Michael Niedermayer michaelni at gmx.at
Wed May 25 03:18:39 CEST 2011

On Wed, May 25, 2011 at 09:07:00AM +0800, 孙大伟 wrote:
> Hi all,
>     I have send this mail to the libav-user at ffmpeg.org, but got no reply,I
> really need someone's help!
>     I got RTP strem from a IP camera, decode ervery frame and display it,
> and now I want to save the stream to file for later playing.
>     My question is, can i directly save AVPacket data to a file, like the
> following:
>        while(av_read_frame(pFormatCtx, &packet)>=0) {
>         if(packet.stream_index==videoStream) {
>             here I write packet.data to a file.
>     After doing that, I got a file,and with the same program I play it.Is
> this process correct?

it depends on the video codec. if its mpeg1/2/4 h263/4 simply storing
the video packets can work. You would end with an elementary stream

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110525/65043df9/attachment.asc>

More information about the ffmpeg-devel mailing list