kolyvan / kxmovie

movie player for iOS using ffmpeg
2.83k stars 916 forks source link

FLV pseudo streaming #112

Open phamducgiam opened 8 years ago

phamducgiam commented 8 years ago

Hi guys.

Anyone got the idea how to implemented pseudo streaming for flv video format?

Thanks.

gregoryking commented 8 years ago

Do you mean getting a stream through to kxmovie with minimal latency? If so, I have some code that I can push to a fork of kxmovie that will give you some ideas.

phamducgiam commented 8 years ago

Hi.

I meant streaming flv file and allow user to seek to another position without downloading file. For example, I have a flv file like http://example.com/sample.flv. The file already contains metadata for pseudo streaming, including keyframes. To seek to new position, I can make request like http://example.com/sample.flv?start=[param] where param is position in file.

I already tried vlc media player for iOS (it uses ffmpeg too). It can play pseudo streaming url but it can decode audio frame only, no picture at all. I think the problem is when I make new request, the information about video is lost, so it can not decode picture from video frame. I think I need to save information about video when the original url was opened, then reuse that information to parse new stream after seeking but I don't figure how to do it.

Please consider the link http://flash.flowplayer.org/plugins/streaming/pseudostreaming.html for more detail about pseudo streaming for flv.

Thanks.

gregoryking commented 8 years ago

I'm not familiar with pseudo streaming. I've used rtmp mainly for live streams (using nginx-rtmp and crtmpserver) but I'm pretty sure that when I did the odd test streaming an flv file the seek support in kxmovie worked well with rtmp. Might be worth looking into?

phamducgiam commented 8 years ago

Thanks.

My thought was right. I need to save AVFormatContext after making new request . The problem now is I need to get keyframes from stream. I know they are transfer at the begin of the stream, I just need to find how to extract them.