Jump to content


Photo

Problem playing live HLS stream with gstreamer.


  • Please log in to reply
22 replies to this topic

#1 Taapat

  • PLi® Core member
  • 2,343 posts

+120
Excellent

Posted 4 August 2015 - 18:14

Using youtube plugin users complain about a strange problem that occurs using gstreamer.

 

Here is a link to the channel 112 live hls stream in youtube: https://manifest.goo...list/index.m3u8
I do not know how often they change links, and how long this link will work.

 

If I open these link in our sh4 receiver who uses libeplayer with ffmpeg, I can see this live broadcast. Channel clock shows the current time.

 

The same is when you open this link on your PC with VLC. The channel can be seen in live.

 

If the same link open in receiver with gstreamer, then judging by the channel clock channel is shown with a 4 hour delay rather than in live.

 

This problem is both to the last openpli with 0.1 gstreamer and on the other image with 1.X gstreamer.
The only difference is that on 0.1 gstreamer channel shuttering, sometimes sound is not synchronized, the channel can not be watch normal.
On the 1.X gstreamer channel plays very good, but with the same 4 hour delay.

Users report that this 4 hour delay is also on others live channels.

 

Maybe someone knows how fix this delay using gstreamer, to be able watch the live hls stream broadcast without 4 hour delay?


Edited by Taapat, 4 August 2015 - 18:15.


Re: Problem playing live HLS stream with gstreamer. #2 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 4 August 2015 - 18:44

Just checked and there is 4hours delay between box with openatv 5.0 and pc youtube i checked two channels live channel 112 and live jazeera

Re: Problem playing live HLS stream with gstreamer. #3 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 4 August 2015 - 19:24

Hi,

I used the following command to get the (dynamic) url from youtube (using livestreamer)
livestreamer -v --stream-url https://www.youtube.com/watch?v=06Of44NSDdg  best
The I downloaded the m3u8 file and here what it contains:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:5
#EXT-X-MEDIA-SEQUENCE:2158299
#EXT-X-PROGRAM-DATE-TIME:2015-08-04T13:50:45.018+00:00
#EXTINF:5.000000,
http://r1---sn-jvnhvux-5uie.googlevideo.com/videoplayback/id/06Of44NSDdg.1/itag/95/source/yt_live_broadcast/sq/2158299/file/seg.ts?ratebypass=yes&cm...4345689&clen=1549120&dur=5.000
#EXTINF:5.000000,
....
....
http://r1---sn-jvnhvux-5uie.googlevideo.com/videoplayback/id/06Of44NSDdg.1/itag/95/source/yt_live_broadcast/sq/2161179/file/seg.ts?ratebyp...10654580486&clen=1679968&dur=5.000
The m3u8 file is 2.4M and contains segments from 2158299 to 2161179. But m3u8 points back to time. Other players might have trick to use correct segment. Livestreamer also uses live (not vod).
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Problem playing live HLS stream with gstreamer. #4 samsamsam

  • Senior Member
  • 2,024 posts

+146
Excellent

Posted 4 August 2015 - 19:32

@athoik

Please try the same link with IPTVPlayer in buffering mode.

 

If the list m3u8 has no marker END it means that this is live stream, so gstreamer similart to IPTVPlayer in buffering mode should start at the end of list.



Re: Problem playing live HLS stream with gstreamer. #5 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 4 August 2015 - 20:01

@samsamsam,

I am away from my receivers atm, somebody else should provide logs for now.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Problem playing live HLS stream with gstreamer. #6 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 4 August 2015 - 21:26

This problem is both to the last openpli with 0.1 gstreamer and on the other image with 1.X gstreamer.


I guess you are not using latest GStreamer 1.5.1 (or 1.5.2) right? Cause most probably you hit that bug: https://bugzilla.gno...g.cgi?id=727742

Above fix exists on 1.5.1+ versions.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Problem playing live HLS stream with gstreamer. #7 Taapat

  • PLi® Core member
  • 2,343 posts

+120
Excellent

Posted 5 August 2015 - 07:04

I do not have mipsel receiver, so I do not use gstreamer.
About this problem reported users. They tried to openATV and RuDream. I'm not very much interested which version used in this images, but as far I understand it is 1.2 or 1.4, but in my opinion definitely not 1.5.

 

Thanks for the information that this is fixed in 1.5.



Re: Problem playing live HLS stream with gstreamer. #8 Taapat

  • PLi® Core member
  • 2,343 posts

+120
Excellent

Posted 6 August 2015 - 17:11

Unfortunately, users report that also on the gstreamer 1.5.2 is this 4 hour delay.
Moreover check that in the source codes is these changes.
I do not use gstreamer, so about it do not know anything, but is it possible that this corrected gst-plugins-bad is not used for playing hls live stream?



Re: Problem playing live HLS stream with gstreamer. #9 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 6 August 2015 - 18:57

Can you post the youtube url? In order to have a look, it might be another GStreamer bug...
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Problem playing live HLS stream with gstreamer. #10 Taapat

  • PLi® Core member
  • 2,343 posts

+120
Excellent

Posted 6 August 2015 - 19:02

Search in youtube 112: https://www.youtube....h?v=06Of44NSDdg
Direct link to the m3u8: https://manifest.goo...list/index.m3u8


Edited by Taapat, 6 August 2015 - 19:03.


Re: Problem playing live HLS stream with gstreamer. #11 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 6 August 2015 - 19:34

i found  only one live channel without delay

https://www.youtube.com/watch?v=qaNVnFRkP8M


Re: Problem playing live HLS stream with gstreamer. #12 Taapat

  • PLi® Core member
  • 2,343 posts

+120
Excellent

Posted 6 August 2015 - 19:43

Looking in the log, a user report that you can see that these changes work:

0:00:12.356327844   987   0x74b1b0 DEBUG             fragmented m3u8.c:617:gst_m3u8_update: FIXME parse date
0:00:12.362641548   987   0x74b1b0 DEBUG             fragmented m3u8.c:617:gst_m3u8_update: FIXME parse date
0:00:12.372397252   987   0x74b1b0 WARN              fragmented m3u8.c:523:gst_m3u8_update: EXTINF duration > TARGETDURATION
0:00:12.377511955   987   0x74b1b0 WARN              fragmented m3u8.c:523:gst_m3u8_update: EXTINF duration > TARGETDURATION
0:00:12.388299770   987   0x74b1b0 WARN              fragmented m3u8.c:523:gst_m3u8_update: EXTINF duration > TARGETDURATION
0:00:12.388560437   987   0x74b1b0 DEBUG             fragmented m3u8.c:617:gst_m3u8_update: FIXME parse date
0:00:12.395484400   987   0x74b1b0 WARN              fragmented m3u8.c:523:gst_m3u8_update: EXTINF duration > TARGETDURATION
0:00:12.402578696   987   0x74b1b0 WARN              fragmented m3u8.c:523:gst_m3u8_update: EXTINF duration > TARGETDURATION
0:00:12.418664511   987   0x74b1b0 WARN              fragmented m3u8.c:523:gst_m3u8_update: EXTINF duration > TARGETDURATION
0:00:12.419190955   987   0x74b1b0 WARN              fragmented m3u8.c:523:gst_m3u8_update: EXTINF duration > TARGETDURATION
0:00:12.421533696   987   0x74b1b0 DEBUG             fragmented m3u8.c:865:gst_m3u8_client_update: Setting first sequence at 2194818
0:00:12.422122289   987   0x74b1b0 DEBUG               GST_PADS gstpad.c:1875:gst_pad_set_iterate_internal_links_function_full:<GstProxyPad@

fragmented m3u8.c:865:gst_m3u8_client_update: Setting first sequence at 2194818

 
But despite this is a 4 hour delay.


Edited by Taapat, 6 August 2015 - 19:44.


Re: Problem playing live HLS stream with gstreamer. #13 Alexvrs

  • Senior Member
  • 36 posts

+4
Neutral

Posted 7 August 2015 - 07:34

Patch for fix from rudream in attached file  :)

diff -u --recursive --new-file original/ext/hls/m3u8.c new/ext/hls/m3u8.c
--- original/ext/hls/m3u8.c	2015-06-07 10:04:45.000000000 +0300
+++ new/ext/hls/m3u8.c	2015-08-06 23:41:02.348000058 +0300
@@ -850,7 +850,6 @@
   }
 
   if (m3u8->files && self->sequence == -1) {
-    self->current_file = g_list_first (m3u8->files);
     if (GST_M3U8_CLIENT_IS_LIVE (self)) {
       /* for live streams, start GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE from
          the end of the playlist. See section 6.3.3 of HLS draft */
@@ -859,8 +858,10 @@
       self->sequence =
           GST_M3U8_MEDIA_FILE (g_list_nth_data (m3u8->files,
               pos >= 0 ? pos : 0))->sequence;
-    } else
+    } else {
+      self->current_file = g_list_first (m3u8->files);
       self->sequence = GST_M3U8_MEDIA_FILE (self->current_file->data)->sequence;
+    }
     self->sequence_position = 0;
     GST_DEBUG ("Setting first sequence at %u", (guint) self->sequence);
   }

Attached Files


Один — стоит, Единый движется.


Re: Problem playing live HLS stream with gstreamer. #14 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 7 August 2015 - 07:53

Nice that you fix it already. Please report the bug also in gstreamer bug tracking system: http://gstreamer.freedesktop.org/bugs/ (under bad).
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Problem playing live HLS stream with gstreamer. #15 Alexvrs

  • Senior Member
  • 36 posts

+4
Neutral

Posted 7 August 2015 - 08:56

TNX, Done

 

https://bugzilla.gno...g.cgi?id=753344


Один — стоит, Единый движется.


Re: Problem playing live HLS stream with gstreamer. #16 Alexvrs

  • Senior Member
  • 36 posts

+4
Neutral

Posted 7 August 2015 - 09:55

For those who do not understand that the changes the patch:

 

Otherwise after If use GST_M3U8_CLIENT_IS_LIVE = True:

Setting first sequence from the END of the playlist,

in gst_m3u8_client_has_next_fragment function in code:

   if (! client-> current_file) {
     client-> current_file =
         find_next_fragment (client, client-> current-> files, forward);
   }

The following function is not executed:

find_next_fragment (client-> current_file has already been appointed)
as well as the following code not executed too:
 
client-> sequence = file-> sequence;

And setting up again the:

Setting first sequence from the TOP of the playlist


Один — стоит, Единый движется.


Re: Problem playing live HLS stream with gstreamer. #17 Alexvrs

  • Senior Member
  • 36 posts

+4
Neutral

Posted 7 August 2015 - 10:03

Debug log do fix:

 
0:00:12.421533696   987   0x74b1b0 DEBUG             fragmented m3u8.c:865:gst_m3u8_client_update: Setting first sequence at 2194818
0:00:12.449049215   987   0x74b1b0 DEBUG             fragmented m3u8.c:1021:gst_m3u8_client_get_next_fragment: Looking for fragment 2194818
0:00:12.449157733   987   0x74b1b0 DEBUG             fragmented m3u8.c:1038:gst_m3u8_client_get_next_fragment: Got fragment with sequence 2191939 (client sequence 2194818#ERROR Lowered sequence, but should be increased
0:00:12.452527585   987   0x691800 DEBUG             fragmented m3u8.c:1021:gst_m3u8_client_get_next_fragment: Looking for fragment 2191939
0:00:12.452665474   987   0x691800 DEBUG             fragmented m3u8.c:1038:gst_m3u8_client_get_next_fragment: Got fragment with sequence 2191939 (client sequence 2191939)
0:00:22.092428876   987   0x5c9920 DEBUG             fragmented m3u8.c:1148:gst_m3u8_client_advance_fragment: Advancing from sequence 2191939
 
 
Debug log after fix:
 
0:00:14.934132806  1827   0x79a7b0 DEBUG             fragmented m3u8.c:867:gst_m3u8_client_update: Setting first sequence at 2198075
0:00:14.960840954  1827   0x79a7b0 DEBUG             fragmented m3u8.c:1028:gst_m3u8_client_get_next_fragment: Looking for fragment 2198075
0:00:15.328647991  1827   0x6e1200 DEBUG             fragmented m3u8.c:1047:gst_m3u8_client_get_next_fragment: Got fragment with sequence 2198075 (client sequence 2198075) #OK
0:00:23.860507431  1827   0x61a920 DEBUG             fragmented m3u8.c:1163:gst_m3u8_client_advance_fragment: Advancing from sequence 2198075 #OK
0:00:23.891802171  1827   0x6e1200 DEBUG             fragmented m3u8.c:1028:gst_m3u8_client_get_next_fragment: Looking for fragment 2198076 #OK sequence increased
0:00:23.891868542  1827   0x6e1200 DEBUG             fragmented m3u8.c:1047:gst_m3u8_client_get_next_fragment: Got fragment with sequence 2198076 (client sequence 2198076) forward #OK

Edited by Alexvrs, 7 August 2015 - 10:04.

Один — стоит, Единый движется.


Re: Problem playing live HLS stream with gstreamer. #18 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 7 August 2015 - 10:18

@alexvrs,

Thanks for your explanation.

Can you try also the following? (actually is your fix but also sets the current_file to correct one).

diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index 5e78d94..c080a95 100755
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -850,17 +850,16 @@ gst_m3u8_client_update (GstM3U8Client * self, gchar * data)
   }
 
   if (m3u8->files && self->sequence == -1) {
-    self->current_file = g_list_first (m3u8->files);
     if (GST_M3U8_CLIENT_IS_LIVE (self)) {
       /* for live streams, start GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE from
          the end of the playlist. See section 6.3.3 of HLS draft */
       gint pos =
           g_list_length (m3u8->files) - GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE;
-      self->sequence =
-          GST_M3U8_MEDIA_FILE (g_list_nth_data (m3u8->files,
-              pos >= 0 ? pos : 0))->sequence;
+      self->current_file = g_list_nth (m3u8->files,
+              pos >= 0 ? pos : 0)
     } else
-      self->sequence = GST_M3U8_MEDIA_FILE (self->current_file->data)->sequence;
+      self->current_file = g_list_first (m3u8->files);
+    self->sequence = GST_M3U8_MEDIA_FILE (self->current_file->data)->sequence;
     self->sequence_position = 0;
     GST_DEBUG ("Setting first sequence at %u", (guint) self->sequence);
   }

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Problem playing live HLS stream with gstreamer. #19 Alexvrs

  • Senior Member
  • 36 posts

+4
Neutral

Posted 7 August 2015 - 10:25

@athoik

Tnx!

 

Yes, I saw it, the result should be the same, now check and report test results!


Один — стоит, Единый движется.


Re: Problem playing live HLS stream with gstreamer. #20 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 7 August 2015 - 11:47

@Alexvrs,

Dejavu? https://github.com/c...amer/issues/224

:)
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users