[FFmpeg-user] Synchronize various quality outputs for HLS
Arnaud Wijns
arnaud.wijns at ulb.ac.be
Thu May 21 15:54:27 CEST 2015
Hello everybody,
I am currently trying to create an HLS live stream from a video input. I want to output various qualities streams for adaptive HLS.
For the moment, I have succeeded to output various qualities streams but they are not saved synchronously. Using the following command, there is a delay between the "high" and "low" output streams.
ffmpeg -re -f decklink -i 'UltraStudio Mini Recorder at 11' \
-force_key_frames "expr:gte(t,n_forced*3)" -vcodec libx264 -r 1 -crf 18 -profile:v baseline -maxrate 256k -bufsize 480k -pix_fmt yuv420p \
-f segment -segment_list low/demo.m3u8 -segment_list_flags +live -segment_time 3 -segment_time_delta 0.05 low/demo%03d.ts \
-force_key_frames "expr:gte(t,n_forced*3)" -threads 3 -vcodec libx264 -r 25 -crf 18 -profile:v main -maxrate 1000k -bufsize 1835k -pix_fmt yuv420p \
-f segment -segment_list high/demo.m3u8 -segment_list_flags +live -segment_time 3 -segment_time_delta 0.05 high/demo%03d.ts
What does the command do ?
1) Gets an input stream from a BMD capture device
2) Saves a high quality HLS stream (25fps / main profile / keyframe every 3 sec / constant segment duration 3 sec)
3) Saves a low quality HLS stream (1fps / baseline profile / keyframe every 3 sec / constant segment duration 3 sec)
Lets say, the 15 first segments of the "high" output are saved, and only after that, the segments of the "low" output are saved.
For instance, my directories will contain :
./high/demo001.ts - ./low/demo001.ts
./high/demo002.ts
./high/demo003.ts
./high/demo004.ts
...
./high/demo014.ts
./high/demo015.ts - ./low/demo001.ts
./high/demo016.ts - ./low/demo002.ts
./high/demo017.ts - ./low/demo003.ts
./high/demo018.ts - ./low/demo004.ts
From what I have observed, the delay is due to the framerate. The lower framerate (-r 1) takes more time to start. When I tried with a higher framerate (-r 10), both « slow » and « high » qualities were created simultaneously. As if FFMPEG required to fill in a cache before delivering the video segments.
Any idea what could I change to prevent the delay with very low framerate ?
Thank you for your help.
Arnaud.
Arnaud WIJNS
ULB Podcast | Informaticien
http://podcast.ulb.ac.be <http://podcast.ulb.ac.be/>
Téléphone : 02/650.29.26
Email : arnaud.wijns at ulb.ac.be <mailto:arnaud.wijns at ulb.ac.be>
Université libre de Bruxelles
Campus du Solbosch - CP 160/26
Avenue F.D. Roosevelt, 50 - 1050 Ixelles
More information about the ffmpeg-user
mailing list