[FFmpeg-user] Encoding multiple files for adaptive bit rate streaming using RTMP and HLS

Werner Robitza werner.robitza at gmail.com
Tue May 12 11:31:18 CEST 2015

On Tue, May 12, 2015 at 1:25 AM, Joel Lopez <badassmexican at gmail.com> wrote:
> Can I add a few lower versions to the mix and a higher one?

Yes, you should do that.

> Can I realign the keyframes of the existing files?

That's going to be hard. You're better off re-encoding from scratch
with a fixed interval.

> I'm not so sure how crucial aligned key frames are.  What have you seen out there?

The recommendation is definitely to keep them aligned; otherwise
you'll run into sync issues.

> What bitrates and dimensions do you think they're using?  What do you
> recommend is good for adaptive bit rate switching?

See https://developer.apple.com/library/ios/technotes/tn2224/_index.html#//apple_ref/doc/uid/DTS40009745-CH1-SETTINGSFILES

It's a good starting point.

> He said I didn't need to change the dimensions when making
> different bit rate versions.  What's your opinion?

Typically you should vary both bit rate and resolution, and frame rate
if you're targeting really crappy devices.
Changing just the bit rate but not the resolution may make the video
look worse at lower bit rates than if it had a lower resolution and
the same low bit rate. I recently did a test with bitrate-only
switching and I'm not sure if I'd recommend that.

> How do I change this command to make the different bitrate or sizes?
> ffmpeg [rawvideo demuxer options if required] -i input -c:v libx264
> -crf 23 -preset medium -pix_fmt yuv420p -c:a libfdk_aac -vbr 5
> -movflags +faststart output.mp4

Check the H.264 encoding guide
(https://trac.ffmpeg.org/wiki/Encode/H.264). Do not use the CRF option
but use "-b:v 1M" for 1 MBit/s, or similar. Ideally, do a two-pass
encode for better quality, if you have the time.

More information about the ffmpeg-user mailing list