I'm using ffmpeg over 3 years now mainly I'm doing live broadcasting on my site , currently I'm preparing to do 5 livebroadcast on the same time using my VPS server CPU E3-1240 v5 OpenVZ Since I'm only allowed to use 1 vCore CPU usage jumps high very fast . What I ask , I know H264 algorithm based on calculation of previous frame (ref frame) and I frame So I tried -copyinkf and -break_non_keyframes 1 with no effect on the speed BTW here is my main broadcast command :-

ffmpeg -re -i "http://sorce.m3u " -s 720x406 -r 23.976 -vcodec libx264  -profile:v high444  \ 
-crf 35 -copyinkf - break_non_keyframes 1 -preset slow -acodec libfdk_aac \
-profile:a aac_he_v2 -b:a 8k -map_metadata -1 -f flv rtmp://localhost/hls/live 

Current I use -preset slow to improve image quality little bit CPU usage 60% even with preset fast CPU usage were 47% -preset veryfast CPU-usage 35%

  • What's wrong with the faster presets?
    – Gyan
    Commented Jan 29, 2019 at 19:15
  • it's peak the CPU usage sometime goes up 50% which will kill the tow process , and their is huge quality drop, this setting is the lowest I can get for ~265kbpsbroadcast ,,+ I test it without the extra -copyinkf flags with no different at all , BTW I'm using crf method with value of 35
    – Salem F
    Commented Jan 29, 2019 at 22:04
  • There is no way to use less CPU without reducing quality. If there was, that setting would be turned on by default.
    – SlimSCSI
    Commented Jan 30, 2019 at 17:06
  • I'm using low pic size 720x406 with low bitrate , on my laptop cpu its run it fast , but the server VPS limited to 1 vCore so my code above will uses more cpu resources .
    – Salem F
    Commented Jan 30, 2019 at 18:23
  • Alright I found out what's was peak CPU usage -profile:v high444 once I remove it the cpu usage drooped dramatically to less then 30%
    – Salem F
    Commented Jan 30, 2019 at 20:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.