I'm using ffmpeg to create a video transcoding on demand system that serves the media through the HLS format.
Right now I can transcode the video and serve them as they are encoded, but I can't use the seek function of my players because the playlist (.m3u8) is only generated as the chunks get encoded. I've tried using the
-g options, setting it to 90 with chunk lengths of 3s and 30fps (29.7fps to be precise). But the actual chunk lengths fluctuate slightly. I've also tried setting the HLS flag
round_durations, but the player doesn't work with it on.
Are the chunk sizes dependent on the scenes it is transcoding, or is it possible, by probing the file, to quickly determine it's pattern and generate a virtual .m3u8 complete at the beginning? Or is there any option to make ffmpeg generate the playlist without actually encoding the files?
This is the command I'm using right now: (multi lines for clarity)
ffmpeg.exe -i input.mkv -c:v libx264 -c:a aac -crf 22 -preset faster -format hls -sn -hls_time 3 -hls_base_url http://localhost/media/ -hls_list_size 0 -hls_flags split_by_time -hls_playlist_type event -g 90 -r 30 index.m3u8