[FFmpeg-user] multiple live rtmp inputs latency

Madovsky infos at madovsky.org
Mon Feb 4 00:33:46 CET 2013


>> Madovsky <infos <at> madovsky.org> writes:
>>
>>> I just updated from git 10 mn ago and now the 2 live rtmp
>>> are well syncrhonized as long as the audio from second
>> input is not "amerge" nor "pan" with filter_complex.
>>
>> This sounds as if the problem should also be reproducible
>> with files or am I wrong?
>>
>> Carl Eugen
>
> Sorry Carl I made so many test last days (maybe a thousand)
> I think I mixed up some rersults
>
> Now I splitted the tests in 2 for finest results and less confusion.
>
> Environment
> 2 live streaming from one USB cam (in as2/3 publisher 1 NetConnection, 2 
> NetStreams)
> containing 1 speex in each channel from the same device (builtin pc mic)
>
> video test:
> from a player I can see no latency at all between the live streams 
> (audio/video ok)
> but if I overlay them in any format the video latency is occured
> command:
> ffmpeg -i "rtmp://server/app/live1 live=1" -i "rtmp://server/app/live2 
> live=1"  -i back.png -filter_complex 
> "[0:0]pad=682:450:21:105[left];[left][1:0]overlay=341:105[base]; 
> [base][2:0]overlay=0:main_h-20"  -an -vcodec flv -tune 
> zerolatency -shortest -y output.flv
>
> audio test:
> same result as video. there are about 2.4 second latency between the 2 
> audio streams
> command
> ffmpeg -i "rtmp://server/app/live1 live=1" -i "rtmp://server/app/live2 
> live=1" -filter_complex "[0:1][1:1]amerge" -ac 1 -acodec 
> libspeex -vn -tune zerolatency -shortest -y output.flv
>
> Franck


Sorry I forgot console:

video
=======
ffmpeg -i "rtmp://server/app/live1 live=1" -i "rtmp://server/app/live2
live=1"  -i back.png -filter_complex
"[0:0]pad=682:450:21:105[left];[left][1:0]overlay=341:105[base];
[base][2:0]overlay=0:main_h-20"  -an -vcodec flv -tune
zerolatency -shortest -y output.flv
ffmpeg version N-49564-gd106679 Copyright (c) 2000-2013 the FFmpeg 
developers
  built on Feb  3 2013 16:11:33 with gcc 4.3.2 (GCC) 20081105 (Red Hat 
4.3.2-7)
  configuration: --enable-static --enable-gpl --enable-nonfree --enable-libfaac 
 --enable-libx264 --enable-pthreads --enable-postproc --enable-libspeex --enable-librtmp 
 --enable-runtime-cpudetect --enable-libfreetype
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
rtmp server sent error
[flv @ 0x2086580] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://server/app/live1 live=1" -i 
"rtmp://server/app/live2
live=1'  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: flv1, yuv420p, 320x240, 16.58 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: speex, 16000 Hz, mono, s16
rtmp server sent error
[flv @ 0x211c2e0] Estimating duration from bitrate, this may be inaccurate
Input #1, flv, from  "rtmp://server/app/live1 live=1" -i 
'rtmp://server/app/live2
live=1'  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: flv1, yuv420p, 320x240, 1k tbr, 1k tbn, 1k tbc
    Stream #1:1: Audio: speex, 16000 Hz, mono, s16
Input #2, image2, from 'neterviewBack.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #2:0: Video: png, rgb24, 80x20, 25 tbr, 25 tbn, 25 tbc
Output #0, flv, to 'output.flv':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: flv1 ([2][0][0][0] / 0x0002), yuv420p, 682x450, 
q=2-31, 200 kb/s, 1k tbn, 16.58 tbc
Stream mapping:
  Stream #0:0 (flv) -> pad
  Stream #1:0 (flv) -> overlay:overlay
  Stream #2:0 (png) -> overlay:overlay
  drawtext -> Stream #0:0 (flv)
Press [q] to stop, [?] for help
frame=  277 fps= 23 q=4.5 Lsize=     729kB time=00:00:16.70 bitrate= 
357.5kbits/s dup=0 drop=7
video:724kB audio:0kB subtitle:0 global headers:0kB muxing overhead 
0.626062%
Received signal 2: terminating.



audio
=======
ffmpeg -i "rtmp://server/app/live1 live=1" -i "rtmp://server/app/live2
live=1" -filter_complex "[0:1][1:1]amerge" -ac 1 -acodec libspeex -vn -tune
zerolatency -shortest -y output.flv
ffmpeg version N-49564-gd106679 Copyright (c) 2000-2013 the FFmpeg 
developers
  built on Feb  3 2013 16:11:33 with gcc 4.3.2 (GCC) 20081105 (Red Hat 
4.3.2-7)
  configuration: --enable-static --enable-gpl --enable-nonfree --enable-libfaac 
 --enable-libx264 --enable-pthreads --enable-postproc --enable-libspeex --enable-librtmp 
 --enable-runtime-cpudetect --enable-libfreetype
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
rtmp server sent error
[flv @ 0x26a7c00] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from "rtmp://server/app/live1 live=1':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: flv1, yuv420p, 320x240, 1k tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: speex, 16000 Hz, mono, s16
rtmp server sent error
[flv @ 0x273d700] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from "rtmp://server/app/live2 live=1':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: flv1, yuv420p, 320x240, 16.58 tbr, 1k tbn, 1k tbc
    Stream #1:1: Audio: speex, 16000 Hz, mono, s16
[Parsed_amerge_0 @ 0x26dbf40] Input channel layouts overlap: output layout 
will be determined by the number of distinct input channels
Output #0, flv, to 'output.flv':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Audio: speex ([11][0][0][0] / 0x000B), 16000 Hz, mono, s16, 
27 kb/s
Stream mapping:
  Stream #0:1 (libspeex) -> amerge:in0
  Stream #1:1 (libspeex) -> amerge:in1
  amerge -> Stream #0:0 (libspeex)
Press [q] to stop, [?] for help
size=      62kB time=00:00:16.85 bitrate=  29.9kbits/s
video:0kB audio:50kB subtitle:0 global headers:0kB muxing overhead 
23.096585%
[libspeex @ 0x2769e40] 1 frames left in the queue on closing
Received signal 2: terminating.



More information about the ffmpeg-user mailing list