[FFmpeg-user] Facing issues in streaming videos

Mark Filipak markfilipak.windows+ffmpeg at gmail.com
Tue Mar 10 10:43:58 EET 2020


On 03/10/2020 04:35 AM, Dennis Mungai wrote:
> On Tue, 10 Mar 2020, 11:15 karthik, <karthikdas81 at gmail.com> wrote:
> 
>> I am using below hardware specs for streaming 20 channels
>>
>> Cpu:
>>          AMD Ryzen 7 2700
>>          AMD A320 chipset
>>          16GB DDR4 RAM
>>          NVidia GT 710 2GB card
>>
>>
>> Am using ffmpeg Version :
>>
>> ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
>>    built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
>>    configuration:
>>    libavutil      56. 31.100 / 56. 31.100
>>    libavcodec     58. 54.100 / 58. 54.100
>>    libavformat    58. 29.100 / 58. 29.100
>>    libavdevice    58.  8.100 / 58.  8.100
>>    libavfilter     7. 57.100 /  7. 57.100
>>    libswscale      5.  5.100 /  5.  5.100
>>    libswresample   3.  5.100 /  3.  5.100
>>
>>
>> ================================================================================
>> Tasks: 289 total,  12 running, 176 sleeping,   0 stopped,   0 zombie
>> %Cpu(s): 58.3 us,  1.9 sy, 38.9 ni,  0.4 id,  0.0 wa,  0.0 hi,  0.5 si,
>>   0.0 st
>> KiB Mem : 16423264 total, 11093572 free,  4733008 used,   596684 buff/cache
>> KiB Swap:   999420 total,   999420 free,        0 used. 11328952 avail Mem
>>
>>    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
>>   5025 root      20   0 3598168 229808  33836 R 126.4  1.4   0:08.70 ffmpeg
>>   4613 root      20   0 3598308 231520  33964 R 119.5  1.4   0:10.89 ffmpeg
>>   5231 root      20   0 3598536 223284  33920 R 117.2  1.4   0:05.79 ffmpeg
>>   5460 root      20   0 2541288 207180  33596 R 115.8  1.3   0:06.18 ffmpeg
>>   4446 root      20   0 3471104 292120  33896 R 110.2  1.8   0:20.06 ffmpeg
>>   5563 root      20   0 2545748 206224  33140 R 103.3  1.3   0:03.52 ffmpeg
>>   4476 root      20   0 3643392 324660  33932 S  82.5  2.0   0:14.31 ffmpeg
>>   4482 root      20   0 3650476 301012  34032 R  78.9  1.8   0:14.06 ffmpeg
>>   4504 root      20   0 3598264 231616  33868 S  75.2  1.4   0:11.53 ffmpeg
>>   4458 root      20   0 3649952 297736  33896 R  74.9  1.8   0:17.60 ffmpeg
>>   4452 root      20   0 3473868 296656  33928 S  73.3  1.8   0:15.71 ffmpeg
>>   4819 root      20   0 3598336 220988  34028 S  64.4  1.3   0:07.31 ffmpeg
>>   4510 root      20   0 3597992 222540  34152 S  64.0  1.4   0:09.64 ffmpeg
>>   4490 root      20   0 3649456 290672  33732 R  63.4  1.8   0:13.47 ffmpeg
>>   4922 root      20   0 3598496 228344  33796 S  63.4  1.4   0:05.26 ffmpeg
>>   4470 root      20   0 3639348 317708  33688 R  63.0  1.9   0:14.01 ffmpeg
>>   4464 root      20   0 3639132 316420  34032 R  61.4  1.9   0:12.07 ffmpeg
>>   4498 root      20   0 3597804 222796  34088 S  58.1  1.4   0:11.54 ffmpeg
>>   5128 root      20   0 3598156 217808  33676 S  50.2  1.3   0:03.97 ffmpeg
>>   4716 root      20   0 1952556 129808  34060 S  19.8  0.8   0:03.28 ffmpeg
>>     94 root      20   0       0      0      0 S   0.3  0.0   0:00.08
>> ksoftirqd/14
>>    171 root      20   0       0      0      0 I   0.3  0.0   0:00.28
>> kworker/1:1
>>    173 root      20   0       0      0      0 I   0.3  0.0   0:00.22
>> kworker/5:1
>>    176 root      20   0       0      0      0 I   0.3  0.0   0:00.45
>> kworker/8:1
>>    178 root      20   0       0      0      0 I   0.3  0.0   0:00.51
>> kworker/10:1
>>    897 root      20   0       0      0      0 I   0.3  0.0   0:00.27
>> kworker/3:2
>>   1045 root      20   0       0      0      0 I   0.3  0.0   0:00.37
>> kworker/12:2
>>   1461 www-data  20   0  360740   4080   2580 S   0.3  0.0   0:00.51 apache2
>>   1462 www-data  20   0  360740   4080   2580 S   0.3  0.0   0:00.51 apache2
>>      1 root      20   0  185216   5876   4044 S   0.0  0.0   0:01.49 systemd
>>      2 root      20   0       0      0      0 S   0.0  0.0   0:00.00
>> kthreadd
>>      3 root      20   0       0      0      0 I   0.0  0.0   0:00.01
>> kworker/0:0
>>
>> ===========================================================================
>>
>> But am facing memory consumption issue within 2 hours all RAM memories are
>> full and streams are jerking to play.
>>
>> What is the solution for this problem. Is hardware is enough to play 20
>> streamers.
>>
>> Am using below commands for streaming services
>>
>>
>> =================================================================
>> # Stream 1
>> STREAM_NAME=stream1
>> STREAM_PID_PATH=/tmp/$STREAM_NAME-pid
>> INPUT_URL=udp://224.1.1.1:1100
>> CH_NAME=mv_movies_hd
>>
>>
>>
>>       ffmpeg -i "$INPUT_URL?overrun_nonfatal=1&fifo_size=5000000"  \
>>      -filter_complex
>>
>> "[v:0]split=2[vtemp001][vtemp002];[vtemp001]scale=w=640:h=360[vout001],[vtemp002]scale=w=854:h=480[vout002]"
>> \
>>      -map [vout001] -c:v:0 mpeg2video -b:v:0 600k -maxrate:v:0 900k
>> -bufsize:v:0 1200k \
>>      -map [vout002] -c:v:1 mpeg2video -b:v:1 1000k -maxrate:v:1 1500k
>> -bufsize:v:1 2000k \
>>      -map a:0 -map a:0 -c:a aac -b:a 128k -ac 2 \
>>      -f hls -hls_time 2 -hls_list_size 4 \
>>      -hls_wrap 40 -hls_allow_cache 0 \
>>      -hls_delete_threshold 1 \
>>      -hls_flags delete_segments \
>>      -hls_start_number_source datetime \
>>      -start_number 10 \
>>      -hls_playlist_type event -master_pl_name $CH_NAME.mpeg \
>>      -hls_segment_filename stream_%v/data%06d.ts \
>>       -use_localtime_mkdir 1 \
>>      -var_stream_map "v:0,a:0 v:1,a:1" -crf 22  stream_%v.mpeg
>> =============================================================
> 
> Look at the previous responses to the same query earlier on.
> 
> 16 GB isn't even enough for the workload you're hitting.

I'm a newbie, but what you write doesn't seem right to me, Dennis. If 
karthik is running for 2 hours before the problem shows up, it seems 
likely to me that there may be a stale-buffer issue.

...just my 2 cents.


More information about the ffmpeg-user mailing list