I want to convert the FLV live stream to HLS and play the HLS stream in my app.So how could I convert the FLV live stream to HLS? ..Is there any tools to convert FLV to HLS (convert FLV to h264 acc, h264 acc to HLS) realtime? Please help.
FLV is a container format, similar to mp4 for example, and HLS is a streaming protocol which can stream a video container from a server to a client.
In simple terms, looking at a raw video and how it is 'wrapped' or modified before streaming:
'raw' video -> encoded video (e.g. h.264) -> container (e.g. FLV, mp4) -> fragmented container (e.g. fragmented MP4) -> Streaming protocol including index and segments or fragments of video (e.g. HLS, DASH)
The general ffmpeg way to convert from fav to mp4 is:
ffmpeg -i yourVideo.flv yourVideo.mp4
However, if your FLV video is recent and the encoder is h.264, which is probably the most commonly supported codec, then you may only need to convert the container rather the the encoding. This is less processing so that generally a good thing. You can tell ffmpeg to do this by using the 'copy' parameter - an example here:
You can also use ffmpeg to create a HLS index and segment files from the mp4:
ffmpeg -I yourVideo.mp4 -c:v h264 -flags +cgop -g 30 -hls_time 1 yourVideo.m3u8
More details are available from the ffmpeg documentation here: http://ffmpeg.org/ffmpeg-all.html#hls-2
Its worth being aware that even if your video is h.264 encoded, there are different profiles and options within the h.264 spec so you will still need to check your target device(s) can support the encoding format your video uses.