Receiving streams from two RTP stream sources, stacking them and sending to RTMP

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Receiving streams from two RTP stream sources, stacking them and sending to RTMP

Nestor Morales
Hello everyone,

I have two RTP sources (they will be more in the future, but I am starting
with these two), sent from two different source in a Janus server. Each
input has video and audio, which received at a different port each.

I am able to receive these inputs, create a mosaic, and then send the
result to a .mp4 file. However, if I try to send the resulting mosaic to a
RTMP endpoint (Youtube, in this case), I start having issues, I guess that
due to synchronization related problems. In Youtube, I sometimes receive
the content, for a few seconds, then it is lost, it comes back...

This is the expected schema:

RTP1
           \
              >> ffmpeg --> RTMP
           /
RTP2

This is what I have up to this point. I've tried with other configurations
but, in general, the obtained errors are always the same.

/usr/bin/ffmpeg \
  -vsync 1 -protocol_whitelist file,udp,rtp -analyzeduration 60M -probesize
60M -i ../janus1.sdp \
  -vsync 1 -protocol_whitelist file,udp,rtp -analyzeduration 60M -probesize
60M -i ../janus2.sdp \
  -c:v libx264 -preset veryfast -tune zerolatency \
  -g 60 -keyint_min 30 -sc_threshold 0 -dts_delta_threshold 0 \
  -b:v:0 1000k -profile:v:0 baseline \
  -c:a aac -b:a 128k -ar 48000 \
  -filter_complex \
    "
        [0:v]fps=fps=30, setpts='PTS-STARTPTS', showinfo,
scale=320x480[vid1];
        [1:v]fps=fps=30, setpts='PTS-STARTPTS', showinfo,
scale=320x480[vid2];
        [vid1][vid2]hstack
    " \
  -max_muxing_queue_size 1024 \
  -strict experimental \
  -f flv "rtmp://a.rtmp.youtube.com/live2/####-####-####-####"

As you can see, I'm just ignoring audio at this point, until I reach
something acceptable.

janus1.sdp:
v=0
o=- 0 0 IN IP4 0.0.0.0
s=RTP Video
c=IN IP4 0.0.0.0
t=0 0
a=tool:libavformat 56.15.102
m=audio 10033 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 10038 RTP/AVP 98
a=rtpmap:98 VP8/90000
a=fmtp:98

janus2.sdp:
v=0
o=- 0 0 IN IP4 0.0.0.0
s=RTP Video
c=IN IP4 0.0.0.0
t=0 0
a=tool:libavformat 56.15.102
m=audio 10043 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 10048 RTP/AVP 98
a=rtpmap:98 VP8/90000
a=fmtp:98

The output:
ffmpeg version 3.3.4-2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.2.0-8ubuntu2)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened
--libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu
--enable-gpl --disable-stripping --enable-avresample --enable-avisynth
--enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite
--enable-libfontconfig --enable-libfreetype --enable-libfribidi
--enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libpulse
--enable-librubberband --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora
--enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq
--enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2
--enable-libdc1394 --enable-libiec61883 --enable-chromaprint
--enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[sdp @ 0x5653ccfbaf40] Keyframe missing
Input #0, sdp, from '../janus1.sdp':
  Metadata:
    title           : RTP Video
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Stream #0:1: Video: vp8, yuv420p(tv, bt470bg/unknown/unknown), 320x240,
250 tbr, 90k tbn, 90k tbc
[sdp @ 0x5653ccfc18e0] Keyframe missing
Input #1, sdp, from '../janus2.sdp':
  Metadata:
    title           : RTP Video
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Audio: opus, 48000 Hz, stereo, fltp
    Stream #1:1: Video: vp8, yuv420p(tv, bt470bg/unknown/unknown), 320x240,
250 tbr, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:1 (vp8) -> fps (graph 0)
  Stream #1:1 (vp8) -> fps (graph 0)
  hstack (graph 0) -> Stream #0:0 (libx264)
  Stream #0:0 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[Parsed_showinfo_2 @ 0x5653cd12e200] config in time_base: 1/30, frame_rate:
30/1
[Parsed_showinfo_2 @ 0x5653cd12e200] config out time_base: 0/0, frame_rate:
0/0
[Parsed_showinfo_6 @ 0x5653cd10c880] config in time_base: 1/30, frame_rate:
30/1
[Parsed_showinfo_6 @ 0x5653cd10c880] config out time_base: 0/0, frame_rate:
0/0
[libx264 @ 0x5653cd039a80] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x5653cd039a80] profile Constrained Baseline, level 3.0
[libx264 @ 0x5653cd039a80] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options:
cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=2 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=7
lookahead_threads=7 sliced_threads=1 slices=7 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=60
keyint_min=30 scenecut=0 intra_refresh=0 rc=abr mbtree=0 bitrate=1000
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/####-####-####-####':
  Metadata:
    title           : RTP Video
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p,
640x480, q=-1--1, 1000 kb/s, 30 fps, 1k tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc57.89.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz,
stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc57.89.100 aac
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   0 pts:      0 pts_time:0
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:1 type:I
checksum:F4E5B94F plane_checksum:[8C29DC23 43B75F12 2BE57E0B] mean:[191 110
125] stdev:[41.2 16.5 9.8]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   0 pts:      0 pts_time:0
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:1 type:I
checksum:D37F5C42 plane_checksum:[A893D213 463ECB0C 8B5DBF05] mean:[130 119
129] stdev:[37.2 9.5 6.4]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   1 pts:      1 pts_time:0.0333333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:0E45C2B4 plane_checksum:[F0A9D56F 0AA36785 F68785B1] mean:[191 111
125] stdev:[41.2 16.6 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   1 pts:      1 pts_time:0.0333333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:F21C5088 plane_checksum:[7A6BC3C0 A9AECD99 3A6CBF11] mean:[130 119
129] stdev:[37.3 9.5 6.5]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   2 pts:      2 pts_time:0.0666667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:BAA1BB62 plane_checksum:[87D6D467 C7C364A8 D3448244] mean:[191 111
125] stdev:[41.2 16.6 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   2 pts:      2 pts_time:0.0666667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:9F5B4FBD plane_checksum:[5BD1C286 51A3CDAF F2AFBF6A] mean:[130 119
129] stdev:[37.3 9.5 6.5]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   3 pts:      3 pts_time:0.1
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:3D1FC211 plane_checksum:[0814D45D 5E1065DD 8F4B87C8] mean:[191 111
125] stdev:[41.2 16.6 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   3 pts:      3 pts_time:0.1
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:CB224DBF plane_checksum:[8808BF7A C33ECE71 CA14BFB6] mean:[130 119
129] stdev:[37.3 9.5 6.5]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   4 pts:      4 pts_time:0.133333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:0164C04F plane_checksum:[0B95D27F FE7F665A 32DD8767] mean:[191 111
125] stdev:[41.2 16.6 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   4 pts:      4 pts_time:0.133333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:13DA5549 plane_checksum:[066DC641 B2D4D007 D641BEE3] mean:[130 119
129] stdev:[37.3 9.6 6.5]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   5 pts:      5 pts_time:0.166667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:A147BC54 plane_checksum:[7F2DD24D DC486696 3A138362] mean:[191 111
125] stdev:[41.2 16.6 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   5 pts:      5 pts_time:0.166667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:66234E4A plane_checksum:[A450C1BA ABDECF58 1B72BD1A] mean:[130 119
129] stdev:[37.3 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   6 pts:      6 pts_time:0.2
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:F57FB95F plane_checksum:[2A4ED268 DCD86486 C8BF8262] mean:[191 111
125] stdev:[41.2 16.6 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   6 pts:      6 pts_time:0.2
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:98A74DA6 plane_checksum:[BF43C14D 899ACEBD A2AABD7E] mean:[130 119
129] stdev:[37.3 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   7 pts:      7 pts_time:0.233333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:C72EB5E6 plane_checksum:[43AECC97 FED3639A 304585A6] mean:[191 111
125] stdev:[41.2 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   7 pts:      7 pts_time:0.233333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:EB19565A plane_checksum:[DD7ECA0D 1D36CEA4 C9CEBD8B] mean:[130 119
129] stdev:[37.3 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   8 pts:      8 pts_time:0.266667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:0136B3C5 plane_checksum:[048ECA46 22BE64D2 A282849E] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   8 pts:      8 pts_time:0.266667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:95D15554 plane_checksum:[86D7C8AA 01E7CF5E 7382BD2E] mean:[130 119
129] stdev:[37.3 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:   9 pts:      9 pts_time:0.3
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:27F5AF6C plane_checksum:[6F29C6CB 451C6510 41D08382] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:   9 pts:      9 pts_time:0.3
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:1AAF59BA plane_checksum:[41D6CA7F 281DD14C 768FBDD1] mean:[130 119
129] stdev:[37.3 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  10 pts:     10 pts_time:0.333333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:39FFB2C7 plane_checksum:[A07ECC0D EBDD643A 572B8271] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  10 pts:     10 pts_time:0.333333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:54645C10 plane_checksum:[D7F9CE99 1F75CF59 FC3FBE00] mean:[130 119
129] stdev:[37.3 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  11 pts:     11 pts_time:0.366667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:8B94AB48 plane_checksum:[46D0C31C 61E563C5 5A158458] mean:[191 111
125] stdev:[41.2 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  11 pts:     11 pts_time:0.366667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:4D0E63C6 plane_checksum:[EFA4D36E F6A4D1BA 9817BE80] mean:[130 119
129] stdev:[37.2 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  12 pts:     12 pts_time:0.4
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:0A30B0D7 plane_checksum:[9EFAC924 B58263A5 A85B83FF] mean:[191 111
125] stdev:[41.2 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  12 pts:     12 pts_time:0.4
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:FB9069BB plane_checksum:[F855DBFE 4B7ED075 7A72BD2A] mean:[130 119
129] stdev:[37.2 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  13 pts:     13 pts_time:0.433333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:F03AA8F0 plane_checksum:[E8C7C544 C72262EA 614B80B3] mean:[191 111
125] stdev:[41.2 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  13 pts:     13 pts_time:0.433333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:5A2C6F58 plane_checksum:[ED4CE19C 9293D0DC A8CCBCC2] mean:[130 119
129] stdev:[37.2 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  14 pts:     14 pts_time:0.466667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:D038AE51 plane_checksum:[E340C87A C7C36271 FAFE8357] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  14 pts:     14 pts_time:0.466667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:0FB9779A plane_checksum:[E00FE83A F137D1D5 477CBD6D] mean:[130 119
129] stdev:[37.2 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  15 pts:     15 pts_time:0.5
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:AC60BB98 plane_checksum:[02A1D4F7 290F6442 67D18250] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  15 pts:     15 pts_time:0.5
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:215F7C53 plane_checksum:[8C81ED1A C6AAD2C0 8F5DBC5B] mean:[130 119
129] stdev:[37.2 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  16 pts:     16 pts_time:0.533333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:4BEDAB8A plane_checksum:[A2DEC60F 6E5E6397 B0B581D5] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  16 pts:     16 pts_time:0.533333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:3A3E8040 plane_checksum:[0315F1F8 3174D1B7 2FB9BC73] mean:[130 119
129] stdev:[37.1 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  17 pts:     17 pts_time:0.566667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:6077B20C plane_checksum:[AC8BC9BF 81C163EB CA518453] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  17 pts:     17 pts_time:0.566667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:57B787E7 plane_checksum:[B696F787 F0B4D37F 3FAABCC3] mean:[131 119
129] stdev:[37.1 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  18 pts:     18 pts_time:0.6
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:EEF7B3A0 plane_checksum:[74FECE16 FAF96314 F7B28267] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  18 pts:     18 pts_time:0.6
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:38A09124 plane_checksum:[3072012D 4A29D269 F5BFBD7F] mean:[131 119
129] stdev:[37.1 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  19 pts:     19 pts_time:0.633333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:9360AFBB plane_checksum:[40DACAD1 8CEF6364 57B58177] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  19 pts:     19 pts_time:0.633333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:0A3094DA plane_checksum:[61AC04F3 0DD0D267 4353BD71] mean:[131 119
129] stdev:[37.1 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  20 pts:     20 pts_time:0.666667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:D670AA5B plane_checksum:[F4E9C4BC F34C627C FFB68314] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  20 pts:     20 pts_time:0.666667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:DD6696B6 plane_checksum:[9B9B089E 7DA2D0AD A01DBD5C] mean:[131 119
129] stdev:[37.1 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  21 pts:     21 pts_time:0.7
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:36F2AACD plane_checksum:[87E7C3EE 1DFC6345 773B838B] mean:[191 111
125] stdev:[41.3 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  21 pts:     21 pts_time:0.7
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:9D6C9A99 plane_checksum:[EC270D54 4F5ACF5C 313FBDDA] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  22 pts:     22 pts_time:0.733333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:BFDF9868 plane_checksum:[9A8BB115 8C3C630D B3E88437] mean:[191 111
125] stdev:[41.4 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  22 pts:     22 pts_time:0.733333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:72D3A425 plane_checksum:[A26314FB DE46D1E5 7609BD36] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  23 pts:     23 pts_time:0.766667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:66DC71DB plane_checksum:[76318C23 5C5A6183 34B68426] mean:[191 111
125] stdev:[41.6 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  23 pts:     23 pts_time:0.766667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:A11CA30B plane_checksum:[E7B31569 F3E2D15B 41FEBC38] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  24 pts:     24 pts_time:0.8
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:D4784FC6 plane_checksum:[11AE6772 CAD361D1 B5928674] mean:[191 111
125] stdev:[41.8 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  24 pts:     24 pts_time:0.8
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:AC5EA565 plane_checksum:[DDB0166C CAFCD1A5 0606BD45] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  25 pts:     25 pts_time:0.833333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:B24331EF plane_checksum:[DB1F485A CED962E3 9C7E86A3] mean:[190 111
125] stdev:[42.1 16.6 10.0]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  25 pts:     25 pts_time:0.833333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:8D38A9CF plane_checksum:[32531B72 8656D0A2 0C38BDAC] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  26 pts:     26 pts_time:0.866667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:65A90642 plane_checksum:[A79820BC 09C0602C E1C0854B] mean:[190 110
125] stdev:[42.3 16.6 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  26 pts:     26 pts_time:0.866667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:35FFA9D8 plane_checksum:[A4891AD7 A712D15D 2D1ABD95] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  27 pts:     27 pts_time:0.9
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:1F26DC58 plane_checksum:[BBA5FB31 89185FB2 B96D8166] mean:[190 110
125] stdev:[42.6 16.5 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  27 pts:     27 pts_time:0.9
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:3028AF2C plane_checksum:[17DE1FE2 44D1D263 B160BCD8] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  28 pts:     28 pts_time:0.933333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:FAB7B02C plane_checksum:[72DCD0DE 2B565E62 C77780DD] mean:[190 110
125] stdev:[42.8 16.5 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  28 pts:     28 pts_time:0.933333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:DF85B2AD plane_checksum:[15BF21BE 83CFD21E 63C0BEC2] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  29 pts:     29 pts_time:0.966667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:A839AC77 plane_checksum:[5D6ECD35 23D65E46 EC8A80ED] mean:[190 110
125] stdev:[42.8 16.5 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  29 pts:     29 pts_time:0.966667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:8D97B4EF plane_checksum:[015524DA 417BD156 80A8BEB0] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  30 pts:     30 pts_time:1
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:CC96AC7C plane_checksum:[3302CD24 AB5A60A4 16067EA5] mean:[190 110
125] stdev:[42.9 16.5 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  30 pts:     30 pts_time:1
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:3365B4F6 plane_checksum:[3A0624DC F7ADD133 4D0BBED8] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  31 pts:     31 pts_time:1.03333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:BD86A438 plane_checksum:[31D2C468 5BCC609E 8E947F23] mean:[190 110
125] stdev:[43.0 16.5 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  31 pts:     31 pts_time:1.03333
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:D8DFBA9E plane_checksum:[5D1F2AC2 9129D18B 749EBE42] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  32 pts:     32 pts_time:1.06667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:D53EAD0E plane_checksum:[8B13CE10 88C76050 36827E9F] mean:[190 110
125] stdev:[43.0 16.5 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  32 pts:     32 pts_time:1.06667
pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:60B1BE5F plane_checksum:[925A2ECA 6AA2D11C A129BE6A] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[sdp @ 0x5653ccfbaf40] max delay reached. need to consume packet
[sdp @ 0x5653ccfbaf40] RTP: missed 364 packets
[sdp @ 0x5653ccfbaf40] max delay reached. need to consume packet
[sdp @ 0x5653ccfbaf40] RTP: missed 809 packets
[sdp @ 0x5653ccfbaf40] Missed a picture, sequence broken
[sdp @ 0x5653ccfc18e0] max delay reached. need to consume packet
[sdp @ 0x5653ccfc18e0] RTP: missed 11 packets
[sdp @ 0x5653ccfc18e0] Missed a picture, sequence broken
[Parsed_showinfo_2 @ 0x5653cd12e200] n:  33 pts:     33 pts_time:1.1
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:F681B964 plane_checksum:[87E2DAD3 830A5F77 453E7F0B] mean:[190 110
125] stdev:[43.0 16.5 9.9]
[Parsed_showinfo_6 @ 0x5653cd10c880] n:  33 pts:     33 pts_time:1.1
 pos:       -1 fmt:yuv420p sar:0/1 s:320x240 i:P iskey:0 type:P
checksum:3894C4FD plane_checksum:[72C6330F 4DDCD200 51F9BFDF] mean:[131 119
129] stdev:[37.0 9.6 6.6]
[flv @ 0x5653cd159b00] Failed to update header with correct duration.
[flv @ 0x5653cd159b00] Failed to update header with correct filesize.
frame=   33 fps=6.9 q=21.0 Lsize=     392kB time=00:00:23.60 bitrate=
136.2kbits/s speed=4.94x

Any help will be really appreciated.

Best regards,
Néstor

--
Néstor Morales
Vanquish Technology, S.L.U
T: +34 673 93 48 65
E: [hidden email]


http://www.system73.com
Plaza Fray Albino 6, San Cristóbal de La Laguna - Santa Cruz de Tenerife -
38201 – Canary Islands - Spain
NOTICE:  In accordance with the law 34/2002, Society Services of
Information and Commercial Emailing (LSSI-CE), including the Organic Law
15/1999 (Data Protection Act), we hereby advise you that your email and fax
information form part of a dossier owned by Vanquish Technology, S.L.U,
CIF-76736347 a System73™ Company or associated companies, whose purpose is
to inform you of our different commercial products, services and
announcements from Vanquish Technology, S.L.U, CIF-76736347 a System73™
Company or associated companies, relating to our activities.  We hereby
inform you that you are able to perform your right to access,
rectification, cancellation or objection, resending this email and heading
the notification DO NOT USE MY DATA/INFORMATION.  You may also inform us of
your decision by post to the following address:
Vanquish Technology, S.L.U, CIF-76736347 a System73™ Company, Plaza Fray
Albino 6, San Cristóbal de La Laguna - Santa Cruz de Tenerife - 38201 –
Canary Islands - Spain
We hereby remind you that your information we hold on file will not be
disclosed under any circumstances to a third party, and is strictly used
for the specific purposes for which it was collected in accordance with our
internal file information.
AVISO: De conformidad con la Ley 34/2002 de Servicios de la Sociedad de la
Información y de Comercio Electrónico (LSSI-CE), así como con la Ley
Orgánica 15/1999 de Protección de Datos de Carácter Personal, le
comunicamos que su dirección de correo electrónico y su fax forman parte de
un fichero titularidad de Vanquish Technology, S.L.U, CIF-76736347,
System73™ o empresas asociadas, cuya finalidad es poder informar sobre los
diferentes productos comerciales, servicios y comunicaciones de Vanquish
Technology, S.L.U, CIF-76736347, System73™ o empresas asociadas,
relacionadas con nuestras actividades. Asimismo le informamos que podrá
ejercitar sus derechos de acceso, rectificación, cancelación y oposición
reenviando este correo y en asunto poner NO UTILIZAR MIS DATOS, o bien
mediante una comunicación postal a la siguiente dirección:
Vanquish Technology, S.L.U, CIF-76736347, System73™ Plaza Fray Albino 6,
San Cristóbal de La Laguna - Santa Cruz de Tenerife - 38201 – Canary
Islands - Spain.
Le recordamos que sus datos anunca son suministrados a terceros bajo ningún
concepto, siendo únicamente utilizados de acuerdo con la finalidad de
nuestro fichero.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

Screen Shot 2017-05-09 at 23.16.50.png (13K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Receiving streams from two RTP stream sources, stacking them and sending to RTMP

Carl Eugen Hoyos-2
2019-02-08 13:02 GMT+01:00, Nestor Morales <[hidden email]>:

> Hello everyone,
>
> I have two RTP sources (they will be more in the future, but I am starting
> with these two), sent from two different source in a Janus server. Each
> input has video and audio, which received at a different port each.
>
> I am able to receive these inputs, create a mosaic, and then send the
> result to a .mp4 file. However, if I try to send the resulting mosaic to a
> RTMP endpoint (Youtube, in this case), I start having issues, I guess that
> due to synchronization related problems. In Youtube, I sometimes receive
> the content, for a few seconds, then it is lost, it comes back...
>
> This is the expected schema:
>
> RTP1
>            \
>               >> ffmpeg --> RTMP
>            /
> RTP2
>
> This is what I have up to this point. I've tried with other configurations
> but, in general, the obtained errors are always the same.
>
> /usr/bin/ffmpeg \
>   -vsync 1 -protocol_whitelist file,udp,rtp -analyzeduration 60M -probesize
> 60M -i ../janus1.sdp \
>   -vsync 1 -protocol_whitelist file,udp,rtp -analyzeduration 60M -probesize
> 60M -i ../janus2.sdp \
>   -c:v libx264 -preset veryfast -tune zerolatency \
>   -g 60 -keyint_min 30 -sc_threshold 0 -dts_delta_threshold 0 \
>   -b:v:0 1000k -profile:v:0 baseline \
>   -c:a aac -b:a 128k -ar 48000 \
>   -filter_complex \
>     "
>         [0:v]fps=fps=30, setpts='PTS-STARTPTS', showinfo,
> scale=320x480[vid1];
>         [1:v]fps=fps=30, setpts='PTS-STARTPTS', showinfo,
> scale=320x480[vid2];
>         [vid1][vid2]hstack
>     " \
>   -max_muxing_queue_size 1024 \
>   -strict experimental \
>   -f flv "rtmp://a.rtmp.youtube.com/live2/####-####-####-####"

Can you rule out that you see a performance issue caused by
the console output of the showinfo filter?

Please remove your email footer, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Receiving streams from two RTP stream sources, stacking them and sending to RTMP

Nestor Morales
Hello,

thanks for your answer.

yes, CPU is normal, so I discard performance issues. See the attached
screenshot.

I managed to make it work, but now I have some issues with the audio, which
has a really long delay (last test, up to 21 seconds delayed):

1) For each RTP input, re-encode it and re-timestamp it using vsync drop
option. Then, send it to a local UDP socket.
/usr/bin/ffmpeg \
  -vsync drop -protocol_whitelist file,udp,rtp -analyzeduration 30M
-probesize 30M -i janus1.sdp \
  -c:v libx264 -preset veryfast -tune zerolatency \
  -g 60 -keyint_min 30 -sc_threshold 0 -dts_delta_threshold 0 \
  -b:v:0 1000k -profile:v:0 baseline \
  -c:a aac -b:a 128k -ar 48000 \
  -filter_complex \
    "
        [0:v]fps=fps=30, setpts='(time(0)*1000000 - RTCSTART) / ((1/30) *
1000000)';
        [0:a]aresample=async=1:min_hard_comp=0.100000,
asetpts='PTS-STARTPTS'
    " \
  -strict experimental \
  -max_muxing_queue_size 1024 \
  -f mpegts udp://127.0.0.1:100001

/usr/bin/ffmpeg \
  -vsync drop -protocol_whitelist file,udp,rtp -analyzeduration 30M
-probesize 30M -i janus2.sdp \
  -c:v libx264 -preset veryfast -tune zerolatency \
  -g 60 -keyint_min 30 -sc_threshold 0 -dts_delta_threshold 0 \
  -b:v:0 1000k -profile:v:0 baseline \
  -c:a aac -b:a 128k -ar 48000 \
  -filter_complex \
    "
        [0:v]fps=fps=30, setpts='(time(0)*1000000 - RTCSTART) / ((1/30) *
1000000)';
        [0:a]aresample=async=1:min_hard_comp=0.100000,
asetpts='PTS-STARTPTS'
    " \
  -strict experimental \
  -max_muxing_queue_size 1024 \
  -f mpegts udp://127.0.0.1:100002

2) Do the mosaic, using the previously re-timestamped UDP inputs:
/usr/bin/ffmpeg \
  -vsync 1 -protocol_whitelist file,udp,rtp -analyzeduration 5M -probesize
5M -i udp://127.0.0.1:10001 \
  -vsync 1 -protocol_whitelist file,udp,rtp -analyzeduration 5M -probesize
5M -i udp://127.0.0.1:10002 \
  -c:v libx264 -preset veryfast -tune zerolatency \
  -g 60 -keyint_min 30 -sc_threshold 0 -dts_delta_threshold 0 \
  -b:v:0 1000k -profile:v:0 baseline \
  -c:a aac -b:a 128k -ar 48000 \
  -filter_complex \
    "
        [0:v]fps=fps=30, setpts='(time(0)*1000000 - RTCSTART) / ((1/30) *
1000000)', scale=320x480[vid1];
        [1:v]fps=fps=30, setpts='(time(0)*1000000 - RTCSTART) / ((1/30) *
1000000)', scale=320x480[vid2];
        [vid1][vid2]hstack;
        [0:a]aresample=async=1:min_hard_comp=0.100000,
asetpts='PTS-STARTPTS'
    " \
  -max_muxing_queue_size 1024 \
  -strict experimental \
  -f flv "rtmp://a.rtmp.youtube.com/live2/####-####-####-####"

I guess that I should re-timestamp the audio properly, but I am still on
it. Any suggestions?

Best regards,
Néstor

PS: Sorry for the long signature, I noticed about it just after sending the
email. It is removed now.

[image: image.png]

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

image.png (450K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Receiving streams from two RTP stream sources, stacking them and sending to RTMP

Moritz Barsnick
In reply to this post by Nestor Morales
On Fri, Feb 08, 2019 at 12:02:03 +0000, Nestor Morales wrote:

In the meantime:

> The output:
> ffmpeg version 3.3.4-2 Copyright (c) 2000-2017 the FFmpeg developers
>   built with gcc 7 (Ubuntu 7.2.0-8ubuntu2)

Have you considered using a much newer version of ffmpeg? This one is
17 months old, and it last received feature and performance
enhancements 22 months ago.

If you can't find a different repository, and don't care to build
ffmpeg yourself, please grab a binary here:
https://johnvansickle.com/ffmpeg/

(Left-hand colum, version "git:", preferred here.)

I can't promise performance improvements, but it's better you
double-checked.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Receiving streams from two RTP stream sources, stacking them and sending to RTMP

Nestor Morales
Thanks you for your suggestion, I will try with a more recent version.

On Mon, Feb 11, 2019 at 10:39 AM Moritz Barsnick <[hidden email]> wrote:

> On Fri, Feb 08, 2019 at 12:02:03 +0000, Nestor Morales wrote:
>
> In the meantime:
>
> > The output:
> > ffmpeg version 3.3.4-2 Copyright (c) 2000-2017 the FFmpeg developers
> >   built with gcc 7 (Ubuntu 7.2.0-8ubuntu2)
>
> Have you considered using a much newer version of ffmpeg? This one is
> 17 months old, and it last received feature and performance
> enhancements 22 months ago.
>
> If you can't find a different repository, and don't care to build
> ffmpeg yourself, please grab a binary here:
> https://johnvansickle.com/ffmpeg/
>
> (Left-hand colum, version "git:", preferred here.)
>
> I can't promise performance improvements, but it's better you
> double-checked.
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".