Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Play Multiple Streams with FFPLAY at the Same Time using RTSP Url

I am trying to play live stream coming from the server with RTSP URL. A sample RTSP URL is given below:

rtsp://username:password@machine_ip/42331536059e9f21

Actually, this stream is the call between two participants (caller & called). But when I play this URL with FFPLAY, I get just one stream(called) while I should get both streams (caller and called). I am using the following command:

ffplay rtsp://username:password@machine_ip/42331536059e9f21

Am I missing some parameters along with this command to fetch all streams.

like image 483
Bilal Ahmed Yaseen Avatar asked Sep 19 '25 14:09

Bilal Ahmed Yaseen


2 Answers

You can use ffmpeg, attach the streams to each other using vstack/hstack and pipe it through ffplay

ffmpeg\
    -i "rtsp://user:[email protected]:554/" \
    -i "rtsp://user:[email protected]:554/" \
    -filter_complex\
        "[0:v][1:v]hstack=inputs=2[v]"\
        -map "[v]"\
        -c:v libx264 -f nut - | ffplay -i -

or launch ffplayer twice

ffplay "rtsp://user:[email protected]:554/" &
ffplay "rtsp://user:[email protected]:554/" &
like image 134
mcantsin Avatar answered Sep 23 '25 05:09

mcantsin


It's actually the limitation of FFPLAY that it doesn't support multiple streams at the same time.

FFplay has currently no support for playing two audio streams simultaneously.

Here is the reference of this answer.

like image 32
Bilal Ahmed Yaseen Avatar answered Sep 23 '25 06:09

Bilal Ahmed Yaseen