using ffmpeg to demux stream(video h.264 , audio aac) and do the time search

ffmpeg is a very famouse multimedia library.

##There are several sites I think are very helpful for multimedia developer:##

1 ffmpeg detail

2 ffmpeg decode procedure

3 An ffmpeg and SDL Tutorial

##Today I want to talk how to demux network stream by ffmpeg, the full procedure is as following:

1 register movie container format and codec by calling av_rigister_all()

2 open the network stream by calling ‘av_open_input_stream()’

3 find the stream info by calling ‘av_find_stream_info()’

4 loop all the stream and find audio and video by checking the ‘codec_type’ of each ‘stream(nb_streams)’

5 alloc memory for packet of frame by calling ‘av_init_packet’ or ‘avcodec_alloc_frame’

6 read frame from stream by calling ‘av_read_frame’

7 check the type of stream(audio or video)

8 after read all the frame calling ‘av_close_input_stream’ to close the stream

##if want to do time search,the procedure is as following:

1 call ‘av_seek_frame’ to seek by time or by byte

2 call ‘av_read_frame’ to read packet and do demux and decode

#refer source code:

1 ffmpeg demux/remux

2 ffmpeg demux

知道是不会有人点的,但万一有人呢:)