Jump to content
  • 0

Trying to stream live TV via WebRTC


Peter De Groot
 Share

Question



Hi guys..

Can I get some advice on streaming live TV.

So.. a bit of background.

I have a Silicon Dust  TV tuner that supplies a rtp video stream.

According to ffprobe I get

Input #0, rtp, from 'rtp://239.0.2.2:5678':
  Duration: N/A, start: 43387.993622, bitrate: N/A
  Program 2391
    Stream #0:1: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [sAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2(eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:0(eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x
0006)
Unsupported codec with id 94215 for input stream 0

Notes
  1)  Does not like the teletext .. which is fine..
  2)  Note the DAR.. the display aspect ratio.  Basically the pixels are rectangular and not square..   Will get talk about this later

Moving on

I have OBS running that receives this stream and then forwards it to the ant media server.  Am very keen to
use WebRTC to minimise the lag..

First problem..

I can create the stream on the ant media server and then point the obs to it.  And very often I can see the video in the view link.
But it is very jerky.

But if I change the streaming parameters... and then restream....the server says it is receiving the stream, but the player says
Will start playing automatically when it is live..

The logs are full of stuff like.  ( deleted a lot of multiple lines)

019-08-01 15:48:19,957 [http-nio2-0.0.0.0-5080-exec-355] INFO  i.a.e.w.WebSocketEnterpriseHandler - websocket onOpen datastore: io.antmedia.datastore.db.MapDBStore@7f53c71c appsettings:io.antmedia.AppSettings$$EnhancerBySpringCGLIB$$41fbc384@25be0d73 applicationAdaptor:io.antmedia.enterprise.webrtcapp.WebRTCSampleApplication@3183b1c5 vertx:io.vertx.core.impl.VertxImpl@29938928 session id 9ab
2019-08-01 15:48:19,969 [http-nio2-0.0.0.0-5080-exec-353] INFO  i.a.e.w.WebSocketEnterpriseHandler - websocket onOpen datastore: io.antmedia.datastore.db.MapDBStore@7f53c71c

2019-08-01 15:49:50,744 [Red5_Scheduler_Worker-22] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 0
2019-08-01 15:49:53,970 [Red5_Scheduler_Worker-9] INFO  i.a.AntMediaApplicationAdapter - update source quality for stream: 440403888621333407000333 quality:good speed:1.014358415121774
2019-08-01 15:50:05,435 [Red5_Scheduler_Worker-4] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 0
2019-08-01 15:50:20,119 [Red5_Scheduler_Worker-32] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size:
1
^C


And to the second problem.. and after days of googling..  How do I fix up the aspect ratio of the picture...  The is a pile of stuff
about canvas size but trying to change it does not seem to help.

Snap of what I am trying currently in OBS to fix the size and judder.  But I cannot see as I cannot play it.,..



Cheers
Peter



1864324634_AutoGeneratedInlineImage1.jpg.cc45da99aa89a9ef5285c7585900f3bf.jpg

Link to comment
Share on other sites

  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

5 answers to this question

Recommended Posts

  • 0
Hi Peter,

Which version of Ant Media are you using?

Best regards,

On Thursday, August 1, 2019 at 9:56:23 AM UTC+2, peter.de.groot@education.wa.edu.au wrote:


Hi guys..

Can I get some advice on streaming live TV.

So.. a bit of background.

I have a Silicon Dust  TV tuner that supplies a rtp video stream.

According to ffprobe I get

Input #0, rtp, from 'rtp://239.0.2.2:5678':
  Duration: N/A, start: 43387.993622, bitrate: N/A
  Program 2391
    Stream #0:1: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [sAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2(eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:0(eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x
0006)
Unsupported codec with id 94215 for input stream 0

Notes
  1)  Does not like the teletext .. which is fine..
  2)  Note the DAR.. the display aspect ratio.  Basically the pixels are rectangular and not square..   Will get talk about this later

Moving on

I have OBS running that receives this stream and then forwards it to the ant media server.  Am very keen to
use WebRTC to minimise the lag..

First problem..

I can create the stream on the ant media server and then point the obs to it.  And very often I can see the video in the view link.
But it is very jerky.

But if I change the streaming parameters... and then restream....the server says it is receiving the stream, but the player says
Will start playing automatically when it is live..

The logs are full of stuff like.  ( deleted a lot of multiple lines)

019-08-01 15:48:19,957 [http-nio2-0.0.0.0-5080-exec-355] INFO  i.a.e.w.WebSocketEnterpriseHandler - websocket onOpen datastore: io.antmedia.datastore.db.MapDBStore@7f53c71c appsettings:io.antmedia.AppSettings$$EnhancerBySpringCGLIB$$41fbc384@25be0d73 applicationAdaptor:io.antmedia.enterprise.webrtcapp.WebRTCSampleApplication@3183b1c5 vertx:io.vertx.core.impl.VertxImpl@29938928 session id 9ab
2019-08-01 15:48:19,969 [http-nio2-0.0.0.0-5080-exec-353] INFO  i.a.e.w.WebSocketEnterpriseHandler - websocket onOpen datastore: io.antmedia.datastore.db.MapDBStore@7f53c71c

2019-08-01 15:49:50,744 [Red5_Scheduler_Worker-22] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 0
2019-08-01 15:49:53,970 [Red5_Scheduler_Worker-9] INFO  i.a.AntMediaApplicationAdapter - update source quality for stream: 440403888621333407000333 quality:good speed:1.014358415121774
2019-08-01 15:50:05,435 [Red5_Scheduler_Worker-4] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 0
2019-08-01 15:50:20,119 [Red5_Scheduler_Worker-32] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size:
1
^C


And to the second problem.. and after days of googling..  How do I fix up the aspect ratio of the picture...  The is a pile of stuff
about canvas size but trying to change it does not seem to help.

Snap of what I am trying currently in OBS to fix the size and judder.  But I cannot see as I cannot play it.,..

Auto%20Generated%20Inline%20Image%201?pa


Cheers
Peter
Link to comment
Share on other sites

  • 0

After a day of playing around ... I have got no further.. sadly.

After a ffmpeg suggestion from the support email guys..  I use this ffmpeg command to send an rtsp stream to the antmedia server

ffmpeg -sn -i rtp://239.0.2.2:5678  -c:v libx264 -tune zerolatency -f flv rtmp://e4182s01sv026/WebRTCAppEE/440403888621333407000333

Sadly... the antmedia server shows it coming in . but when I click on the play button... it comes up with the dreaded

What I have done is .... stopped the server and deleted all of the log files.  Set the log level to debug and restarted.
Then restarted the ffmpeg and then tried to viewer again

A zipped up copy of the logs is attached.  Also a .flv of the stream to a file.  Looks  good.

Please help.......... so close...

Cheers
Peter





antmedia-logs.tar.gz

out.flv

1511393131_AutoGeneratedInlineImage1.jpg.1df90289d9ad8a941aa8b54c058e61c5.jpg

Link to comment
Share on other sites

  • 0
Hi Peter,

Could you please ensure that UDP ports 5000 to 65535 of your server are open.

Then please have a look at here: http://docs.antmedia.io/en/latest/FAQ.html#id11

Best regards,

On Friday, August 2, 2019 at 9:23:40 AM UTC+2, peter.de.groot@education.wa.edu.au wrote:


After a day of playing around ... I have got no further.. sadly.

After a ffmpeg suggestion from the support email guys..  I use this ffmpeg command to send an rtsp stream to the antmedia server

ffmpeg -sn -i rtp://239.0.2.2:5678  -c:v libx264 -tune zerolatency -f flv rtmp://e4182s01sv026/WebRTCAppEE/440403888621333407000333

Sadly... the antmedia server shows it coming in . but when I click on the play button... it comes up with the dreaded
Auto%20Generated%20Inline%20Image%201?pa

What I have done is .... stopped the server and deleted all of the log files.  Set the log level to debug and restarted.
Then restarted the ffmpeg and then tried to viewer again

A zipped up copy of the logs is attached.  Also a .flv of the stream to a file.  Looks  good.

Please help.......... so close...

Cheers
Peter


Link to comment
Share on other sites

  • 0

Many tx for the reply..

More information...

It was not the port issue.  It seems if I have set the adaptive frame rate.  I do not get the WebRTC stream.
Possibly because my source is does not fit into into one of those categories ??

Interestingly ... when I enabled HLS I did get a picture (with the correct aspect ratio)

Have put a slab of info logs, for when it works, at the bottom of this...

One thing I did find .. .and I would love to be proved wrong... is when I change the stream settings page.. I have
to do a save and RESTART the server for them to take effect...
Doing this made my problem solving a bit more intuitive..  as the setting corresponded with what I was seeing..

Cheers
Peter



undefinedwebrtc.WebRTCClient - registering webrtc client io.antmedia.enterprise.webrtc.WebRTCClient@5d0f51c7 to webrtc adaptor for streamId 034304370766559693968668
2019-08-05 15:25:36,334 [vert.x-eventloop-thread-4] INFO  i.a.enterprise.webrtc.WebRTCMuxer - register webrtc client to webrtc muxer for stream: 034304370766559693968668
2019-08-05 15:25:36,341 [vert.x-eventloop-thread-4] INFO  i.a.e.w.WebRTCPlayStreamInfoListener - A new viewer started streaming of 034304370766559693968668
2019-08-05 15:25:36,364 [EncoderQueue - 2476] INFO  i.a.e.w.codec.VirtualH264Encoder - initEncode: 1 x 1. @ 300kbps 60fps automaticResizeOn: true adjusted bitrate: 300000 for client:
2019-08-05 15:25:40,310 [Red5_Scheduler_Worker-31] INFO  i.a.AntMediaApplicationAdapter - update source quality for stream: 034304370766559693968668 quality:good speed:1.0790099682827368
2019-08-05 15:25:41,346 [vert.x-eventloop-thread-4] INFO  i.a.enterprise.webrtc.WebRTCAdaptor - not found a more suitable adapted muxer for 034304370766559693968668 current muxer video bitrate: 0 audio bitrate: 96000 webrtc client target bitrate: 1430000
2019-08-05 15:25:44,276 [Red5_Scheduler_Worker-5] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:25:46,345 [vert.x-eventloop-thread-4] INFO  i.a.enterprise.webrtc.WebRTCAdaptor - not found a more suitable adapted muxer for 034304370766559693968668 current muxer video bitrate: 0 audio bitrate: 96000 webrtc client target bitrate: 1638000
2019-08-05 15:25:51,345 [vert.x-eventloop-thread-4] INFO  i.a.enterprise.webrtc.WebRTCAdaptor - not found a more suitable adapted muxer for 034304370766559693968668 current muxer video bitrate: 0 audio bitrate: 96000 webrtc client target bitrate: 1990000
2019-08-05 15:25:56,345 [vert.x-eventloop-thread-4] INFO  i.a.enterprise.webrtc.WebRTCAdaptor - not found a more suitable adapted muxer for 034304370766559693968668 current muxer video bitrate: 0 audio bitrate: 96000 webrtc client target bitrate: 2142000
2019-08-05 15:25:59,270 [Red5_Scheduler_Worker-21] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:25:59,354 [http-nio2-0.0.0.0-5080-exec-7] INFO  i.a.e.w.WebSocketEnterpriseHandler - onClose session 0
2019-08-05 15:25:59,355 [http-nio2-0.0.0.0-5080-exec-7] INFO  i.a.e.w.WebSocketEnterpriseHandler - Stop command received in session 0
2019-08-05 15:25:59,356 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Stop is called for 034304370766559693968668 for 1561285063
2019-08-05 15:25:59,359 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCMuxer - unregister webrtc client to webrtc muxer for stream: 034304370766559693968668
2019-08-05 15:25:59,359 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Disposing audio source for stream Id 034304370766559693968668
2019-08-05 15:25:59,359 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Disposing video source for stream Id 034304370766559693968668
2019-08-05 15:25:59,360 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Closing and disposing peer connection for stream Id 034304370766559693968668 for 1561285063
2019-08-05 15:25:59,360 [network_thread - 2468] INFO  i.a.enterprise.webrtc.WebRTCClient - IceConnectionState: CLOSED instance: 1561285063
2019-08-05 15:25:59,360 [network_thread - 2468] INFO  i.a.enterprise.webrtc.WebRTCClient - Stop is already called for 034304370766559693968668
2019-08-05 15:25:59,360 [network_thread - 2468] INFO  i.a.enterprise.webrtc.WebRTCClient - onSignalingChange : CLOSED
2019-08-05 15:25:59,363 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Closing peer connection factory for 034304370766559693968668
2019-08-05 15:25:59,370 [webrtc-client-1561285063] INFO  i.a.e.w.WebRTCPlayStreamInfoListener - A viewer stopped streaming for 034304370766559693968668
2019-08-05 15:25:59,370 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Stopping webrtc client number of send audio packet call: 1149 send video packet call: 576 client id: 1561285063
2019-08-05 15:25:59,370 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Average sendVideoPacket call interval 39ms client id:1561285063
2019-08-05 15:25:59,370 [webrtc-client-1561285063] INFO  i.a.enterprise.webrtc.WebRTCClient - Average sendAudioPacket call interval 19ms client id:1561285063
2019-08-05 15:26:14,275 [Red5_Scheduler_Worker-29] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:26:29,270 [Red5_Scheduler_Worker-15] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:26:44,276 [Red5_Scheduler_Worker-32] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:26:59,275 [Red5_Scheduler_Worker-30] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:27:11,515 [Red5_Scheduler_Worker-4] INFO  i.a.AntMediaApplicationAdapter - update source quality for stream: 034304370766559693968668 quality:good speed:1.0289929459746276
2019-08-05 15:27:14,284 [Red5_Scheduler_Worker-9] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 1
2019-08-05 15:27:29,280 [Red5_Scheduler_Worker-23] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:27:44,274 [Red5_Scheduler_Worker-6] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:27:59,275 [Red5_Scheduler_Worker-13] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:28:14,274 [Red5_Scheduler_Worker-26] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:28:29,276 [Red5_Scheduler_Worker-13] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:28:44,271 [Red5_Scheduler_Worker-30] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:28:59,276 [Red5_Scheduler_Worker-27] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
2019-08-05 15:29:14,275 [Red5_Scheduler_Worker-26] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor queue size: 6
Link to comment
Share on other sites

 Share

×
×
  • Create New...