How do I create a perfect MP4 to HLS encode?
Hi everyone,
I have a VOD MP4 file with:
- Scenario A: 23.976 FPS (CFR Source)
- Scenario B: 23.976 FPS (VFR Source)
- Scenario C: 24.0 FPS (CFR Source)
They are best for HLS? No latency and smooth play on any device?just use handbrake for windows or ffmpeg on linux , just make sure during encoding to set them to H.264/AAC to be supported on all devices
They are best for HLS? No latency and smooth play on any device?
I mean,Huh? What encoding has to do with smooth playing? Encoding has effect only on what you see in the screen (pixelation). Your streaming server is responsible for smooth playback.
I mean,
- Video freeze / black frame at segment start
- iOS / Apple devices stutter
- Seeking inaccurate
The black frame at segment start comes from lack of IDR per segment, for that you need to ensure that each segment starts from keyframe. For 6 second segments you go with
-hls_time 6
-hls_flags independent_segments (This enforces keyframes for each segment).
-force_key_frames "expr:gte(t,n_forced*6)" (This ensures key frames every 6 seconds independently from fps since you have each video with diff fps).
-sc_threshold 0 (This eliminated GOP floating)
Stutter at IOS usually happens if your video is having floating VFR so if you want your videos always working on IOS/Mac you should go with stable CFR eg 25/30. This will fix the seeking as well.