[FFmpeg-user] Facing issues in streaming videos

karthik karthikdas81 at gmail.com
Mon Mar 16 12:56:41 EET 2020


hi ,

    I tried with simple ffmpeg command

     ffmpeg -threads 1 -i udp://224.1.1.1:1100 -c:v copy -c:a copy -f
/home/user/ffmpeg-4.2.2/mw_movies.m3u8

     In that also I faced memory leakage issue I have listed below console
output and memory usage details

===================================================================================================
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: --prefix=/root/home/user/ffmpeg-4.2.2
--pkg-config-flags=--static
--extra-cflags=-I/root/home/user/ffmpeg-4.2.2/include
--extra-ldflags=-L/root/home/user/ffmpeg-4.2.2/lib --extra-libs='-lpthread
-lm' --bindir=/root/bin --enable-gpl --enable-libx264 --enable-nonfree
  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
  libpostproc    55.  5.100 / 55.  5.100
[0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mSPS unavailable in
decode_picture_timing
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mnon-existing PPS 1 referenced
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mdecode_slice_header error
[0m [0;36m[h264 @ 0x2bd1640] [0m [1;31mno frame!
[0mInput #0, mpegts, from 'udp://224.1.1.1:1100':
  Duration: N/A, start: 68810.527311, bitrate: N/A
  Program 1
    Metadata:
      service_name    : Multicaster1
      service_provider: www.amigofx.com
    Stream #0:0[0x400]: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 60 tbr, 90k tbn,
60 tbc
    Stream #0:1[0x401]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, fltp, 128 kb/s
File '/home/user/ffmpeg-4.2.2/mw_movies.m3u8' already exists. Overwrite ?
[y/N] y
Output #0, mpegts, to '/home/user/ffmpeg-4.2.2/mw_movies.m3u8':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top
first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 60 tbr, 90k tbn, 90k
tbc
    Stream #0:1: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo,
fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  447 fps=0.0 q=-1.0 size=    7680kB time=00:00:07.80
bitrate=8059.7kbits/s speed=15.4x
frame=  477 fps=474 q=-1.0 size=    8448kB time=00:00:08.30
bitrate=8332.0kbits/s speed=8.25x
frame=  509 fps=331 q=-1.0 size=    8960kB time=00:00:08.83
bitrate=8303.8kbits/s speed=5.75x
frame=  539 fps=264 q=-1.0 size=    9472kB time=00:00:09.33
bitrate=8308.3kbits/s speed=4.58x
frame=  569 fps=224 q=-1.0 size=    9984kB time=00:00:09.83
bitrate=8312.4kbits/s speed=3.87x
frame=  601 fps=192 q=-1.0 size=   10496kB time=00:00:10.37
bitrate=8289.4kbits/s speed=3.32x
frame=  631 fps=174 q=-1.0 size=   11008kB time=00:00:10.87
bitrate=8293.9kbits/s speed=2.99x
frame=  661 fps=160 q=-1.0 size=   11520kB time=00:00:11.37
bitrate=8298.1kbits/s speed=2.75x
frame=  695 fps=149 q=-1.0 size=   12288kB time=00:00:11.93
bitrate=8431.2kbits/s speed=2.57x
frame=  725 fps=140 q=-1.0 size=   12800kB time=00:00:12.43
bitrate=8429.5kbits/s speed= 2.4x
frame=  755 fps=133 q=-1.0 size=   13568kB time=00:00:12.93
bitrate=8590.0kbits/s speed=2.28x
frame=  787 fps=127 q=-1.0 size=   14080kB time=00:00:13.47
bitrate=8561.3kbits/s speed=2.17x
frame=  819 fps=122 q=-1.0 size=   14592kB time=00:00:14.00
bitrate=8534.7kbits/s speed=2.08x
frame=  849 fps=118 q=-1.0 size=   15104kB time=00:00:14.50
bitrate=8529.7kbits/s speed=2.01x
frame=  879 fps=114 q=-1.0 size=   15616kB time=00:00:15.00
bitrate=8525.0kbits/s speed=1.94x
frame=  909 fps=110 q=-1.0 size=   16128kB time=00:00:15.50
bitrate=8520.6kbits/s speed=1.88x
frame=  941 fps=108 q=-1.0 size=   16640kB time=00:00:16.03
bitrate=8498.8kbits/s speed=1.84x
frame=  971 fps=105 q=-1.0 size=   17152kB time=00:00:16.53
bitrate=8495.4kbits/s speed=1.79x
frame=  997 fps=102 q=-1.0 size=   17920kB time=00:00:16.97
bitrate=8649.2kbits/s speed=1.74x
frame= 1029 fps=100 q=-1.0 size=   18432kB time=00:00:17.50
bitrate=8625.3kbits/s speed=1.71x
frame= 1063 fps= 99 q=-1.0 size=   18944kB time=00:00:18.07
bitrate=8586.9kbits/s speed=1.68x
frame= 1095 fps= 97 q=-1.0 size=   19456kB time=00:00:18.60
bitrate=8566.2kbits/s speed=1.65x
frame= 1125 fps= 95 q=-1.0 size=   19968kB time=00:00:19.10
bitrate=8561.6kbits/s speed=1.62x
frame= 1155 fps= 94 q=-1.0 size=   20480kB time=00:00:19.60
bitrate=8557.2kbits/s speed=1.59x
frame= 1185 fps= 92 q=-1.0 size=   20992kB time=00:00:20.10
bitrate=8553.0kbits/s speed=1.57x
frame= 1215 fps= 91 q=-1.0 size=   21760kB time=00:00:20.60
bitrate=8650.8kbits/s speed=1.54x
frame= 1251 fps= 90 q=-1.0 size=   22272kB time=00:00:21.20
bitrate=8603.8kbits/s speed=1.52x
frame= 1281 fps= 89 q=-1.0 size=   22784kB time=00:00:21.70
bitrate=8598.8kbits/s speed=1.51x
frame= 1290 fps= 88 q=-1.0 Lsize=   23163kB time=00:00:21.85
bitrate=8681.7kbits/s speed= 1.5x


==================================================================================

When CPU memory utilization is below

top - 15:31:22 up 6 days,  2:39,  4 users,  load average: 0.00, 0.00, 0.00
Tasks: 376 total,   2 running, 275 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0.0 us,  0.1 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,
 0.0 st
KiB Mem : 16423264 total,   174636 free,   969200 used, 15279428 buff/cache
KiB Swap:   999420 total,   964224 free,    35196 used. 15005416 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 9694 user      20   0   63104  22116  10460 R   1.7  0.1   0:04.65 ffmpeg
 9752 root      20   0   49224   3804   2984 R   0.3  0.0   0:00.67 top
17063 root      20   0  402016  68548  37332 S   0.3  0.4   2:18.72 Xorg
17647 user      20   0 1489812 110572  71540 S   0.3  0.7  20:47.17 compiz

=====================================================================


But after one hour of observation used memory is gradually increasing


op - 16:25:19 up 6 days,  3:33,  4 users,  load average: 0.00, 0.00, 0.00
Tasks: 379 total,   1 running, 279 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0.1 us,  0.1 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,
 0.0 st
KiB Mem : 16423264 total,   157332 free,   973664 used, 15292268 buff/cache
KiB Swap:   999420 total,   968480 free,    34940 used. 15000732 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 9694 user      20   0   63104  22116  10460 S   2.0  0.1   1:06.04 ffmpeg
 9297 root      20   0       0      0      0 I   0.3  0.0   0:00.83
kworker/4:2
 9452 root      20   0       0      0      0 I   0.3  0.0   0:02.32
kworker/14:1

Kindly into this and give us solution

On Tue, Mar 10, 2020 at 1:32 PM 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
> =============================================================
>
>
>
>


More information about the ffmpeg-user mailing list