FPS drop in FFMPEG streaming processes to FB from production server

1

I have made a rails app that can stream live videos to facebook rtmp server and deployed it on AWS. I have used nginx as web server. The major problem that I am encountering after viewing log files of FFMpeg processes is that sometimes the FPS of FFmpeg process starts to drop. In some cases, it remains stable at 25 FPS but in some cases, it remains at 25 only for sometime, and after that it starts to drop and sometimes it falls to even 3-4 FPS which is unacceptable during live streaming. As FFMpeg process is quite heavy, I would also like to share my CPU info as well.

CPU information is:

cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 63 model name : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz stepping : 2 microcode : 0x25 cpu MHz : 2400.070 cache size : 30720 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid bogomips : 4800.14 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management:

FFMPEG log file with unstable fps: https://drive.google.com/open?id=0B1gtp1iXJppkUndFamk4M0lRYzA

FFMPEG log file with stable fps: https://drive.google.com/open?id=0B1gtp1iXJppkMkVCZEJjYWJrVTA

When FPS was stable, I also tried to run another parallel FFMpeg process from the same server which resulted in FPS dropping of both the processes to 13-14 FPS.

I am currently using this FFMPEG command:

ffmpeg -loop 1 -re -y -f image2 -i "image_path" -i "audio_path.aac" -acodec copy -bsf:a aac_adtstoasc -pix_fmt yuv420p -profile:v high -s 1280x720 -vb 400k -maxrate 400k -minrate 400k -bufsize 600k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -t 14400 -strict -2 -f flv "rtmp_server_link"

I never face this problem when I try to stream to FB using app on my localhost.

So, my questions are:

  1. What can be the reason for this FPS drop?
  2. Can upscaling production server help me fix this issue?
  3. Can I run multiple FFMpeg processes for streaming from same server without performance drop?

Thanks in advance :)

Aakash Gupta

Posted 2017-01-26T16:21:15.933

Reputation: 111

Answers

0

  1. The reason of FPS drop was certainly the inefficiency of CPU to encode video as this encoding is quite heavy.

  2. Yes, upgrading production server with more CPU cores helped me to fix the issue.

  3. That depends on the type of processes that are running simultaneously. If we are re-encoding complete video, then it is quite heavy. But if we try to change only video container or use any kther process that use copying of video stream, then it is somewhat light as compared to other.

Aakash Gupta

Posted 2017-01-26T16:21:15.933

Reputation: 111