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

Joel Lopez badassmexican at gmail.com
Tue May 12 21:11:50 CEST 2015


(Did this one not top post?  Trying to figure out how to avoid that on Gmail)

Thanks for the advice.  Now I guess I should encode a video using
double pass and CFR and compare them.  There seems to be a hot debate
about which is best.

The settings below are what the apple.com recommends for 4:3.  Forgive
my slowness but I'm having a tough time converting what sites
recommend into ffmpeg commands.  Now especially double pass and CFR.


>From the wiki page on encoding for streaming they show this example
https://trac.ffmpeg.org/wiki/EncodingForStreamingSites

ffmpeg -i input.mkv -vcodec libx264 -preset medium -maxrate 3000k
-bufsize 6000k \
-vf "scale=1280:-1,format=yuv420p" -g 50 -acodec libmp3lame -b:a 128k
-ac 2 -ar 44100 file.flv

so is this how I should change it?  attempting the highest and lowest

ffmpeg -i input.mp4 -vcodec libx264 -preset medium -maxrate 264k -bufsize 500k \
-vf "scale=400:-1,format=yuv420p" -g 50 -acodec aac -b:a 64k -ac 2 -ar
48000 output_400.mp4

ffmpeg -i input.mp4 -vcodec libx264 -preset medium -maxrate 5120k
-bufsize 10000k \
-vf "scale=1280:-1,format=yuv420p" -g 50 -acodec aac -b:a 128k -ac 2
-ar 48000 output_1280.mp4

I'm totally guessing on -bufsize by doubling the -maxrate.  What
should it actually be?
Also on the scale, what's the difference between -1 and -2?
Since the -g = 50 does this mean my keyframes will be aligned 5 seconds apart?

400x300
Frame Rate = 12
Total Bit Rate = 264
Video Bit Rate = 200
Audio Bit Rate = 64
Audio Sample Rate = 48
Keyframe = 36
Profile = Baseline, 3.0
B-frames = 0
Segment Size = 9

480x360
Frame Rate = 15
Total Bit Rate = 464
Video Bit Rate = 400
Audio Bit Rate = 64
Audio Sample Rate = 48
Keyframe = 45
Profile = Baseline, 3.0
B-frames = 0
Segment Size = 9

640x480
Frame Rate = 29.97
Total Bit Rate = 664
Video Bit Rate = 600
Audio Bit Rate = 64
Audio Sample Rate = 48
Keyframe = 90
Profile = Baseline, 3.0
B-frames = 0
Segment Size = 9

640x480
Frame Rate = 29.97
Total Bit Rate = 1296
Video Bit Rate = 1200
Audio Bit Rate = 96
Audio Sample Rate = 48
Keyframe = 90
Profile = Baseline, 3.1
B-frames = 0
Segment Size = 9

960x720
Frame Rate = 29.97
Total Bit Rate = 3596
Video Bit Rate = 3500
Audio Bit Rate = 96
Audio Sample Rate = 48
Keyframe = 90
Profile = Main, 3.1
B-frames = as needed
Segment Size = 9

1280x960
Frame Rate = 29.97
Total Bit Rate = 5128
Video Bit Rate = 5000
Audio Bit Rate = 128
Audio Sample Rate = 48
Keyframe = 90
Profile = Main, 3.1
B-frames = as needed
Segment Size = 9


More information about the ffmpeg-user mailing list