Opened 11 months ago

Last modified 8 months ago

#6490 new defect

youtube live stream stopt play

Reported by: mobifon Owned by:
Priority: important Component: avformat
Version: git-master Keywords: regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
youtube live stream play stops in a few seconds.
This bug i have after this merge commit d0fc5de3a643fe7f974ed14e410c2ac2f4147d7e ( 81306fd4bdeb5c17d4db771e4fec684773b5790f )
How to reproduce:

ffplay  $(curl https://www.youtube.com/watch?v=Ga3maNZ0x0w | grep -o "hlsvp\(.*\)m3u8" | sed 's#\\##g' | grep -o "http\(.*\)m3u8")

ffmpeg version
built on ...

I have for me this workaround
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 01731bd36b..064839b15b 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -891,9 +891,11 @@ static int read_from_url(struct playlist *pls, struct segment *seg,

ret = avio_read(pls->input, buf, buf_size);
if (ret != buf_size)

av_log(NULL, AV_LOG_ERROR, "Could not read complete segment.\n");

  • } else

+ } else{

ret = avio_read(pls->input, buf, buf_size);

-
+ if (ret != buf_size)
+ ret = 0;
+ }

if (ret > 0)

pls->cur_seg_offset += ret;


Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (5)

comment:1 Changed 9 months ago by stevenliu

The server sometime give me a 403 response.

localhost:ffmpeg StevenLiu$ wget -i "https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/seg.ts?requiressl=yes&ratebypass=yes&cmbypass=yes&goi=160&sgoap=gir=yes;itag=139&sgovp=gir=yes;itag=160&hls_chunk_host=r2---sn-a5meknl6.googlevideo.com&gcr=us&ei=RsOqWbzZA8_F-wOzga7QAg&playlist_type=DVR&mm=32&mn=sn-a5meknl6&ms=lv&mv=m&pl=22&keepalive=yes&mt=1504363216&ip=128.1.68.62&ipbits=0&expire=1504384934&sparams=ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,gcr,ei,playlist_type,mm,mn,ms,mv,pl&signature=1B4673C3F3D80E84B96C6EABE7206FCEDE91A367.8BB7CA502D508837C5C7D816C56338F5DDF34A62&key=dg_yt0&playlist=index.m3u8&live=1&goap=clen=32261;lmt=1504363970510411&govp=clen=82693;lmt=1504363970510411&dur=5.005" -O a2.ts
--2017-09-02 22:55:58--  https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/seg.ts?requiressl=yes&ratebypass=yes&cmbypass=yes&goi=160&sgoap=gir=yes;itag=139&sgovp=gir=yes;itag=160&hls_chunk_host=r2---sn-a5meknl6.googlevideo.com&gcr=us&ei=RsOqWbzZA8_F-wOzga7QAg&playlist_type=DVR&mm=32&mn=sn-a5meknl6&ms=lv&mv=m&pl=22&keepalive=yes&mt=1504363216&ip=128.1.68.62&ipbits=0&expire=1504384934&sparams=ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,gcr,ei,playlist_type,mm,mn,ms,mv,pl&signature=1B4673C3F3D80E84B96C6EABE7206FCEDE91A367.8BB7CA502D508837C5C7D816C56338F5DDF34A62&key=dg_yt0&playlist=index.m3u8&live=1&goap=clen=32261;lmt=1504363970510411&govp=clen=82693;lmt=1504363970510411&dur=5.005
Resolving r2---sn-a5meknl6.googlevideo.com... 173.194.166.72, 2607:f8b0:4007:29::8
Connecting to r2---sn-a5meknl6.googlevideo.com|173.194.166.72|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://r13---sn-a5m7znes.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/requiressl/yes/ratebypass/yes/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D139/sgovp/gir%3Dyes%3Bitag%3D160/gcr/us/ei/RsOqWbzZA8_F-wOzga7QAg/playlist_type/DVR/pl/22/keepalive/yes/ip/128.1.68.62/ipbits/0/expire/1504384934/sparams/cmbypass,ei,expire,gcr,goi,hls_chunk_host,id,ip,ipbits,ipbypass,itag,live,mip,mm,mn,ms,mv,pl,playlist_type,ratebypass,requiressl,sgoap,sgovp,source/signature/49332FEF89A2658E83B1CB732EBC2EE7C3134268.705EA56C1806577FF5C798AD5C0DFA3B54D09AA6/key/cms1/playlist/index.m3u8/live/1/goap/clen%3D32261%3Blmt%3D1504363970510411/govp/clen%3D82693%3Blmt%3D1504363970510411/dur/5.005/redirect_counter/1/req_id/a4e8239a673fa3ee/cms_redirect/yes/ipbypass/yes/mip/162.221.192.2/mm/32/mn/sn-a5m7znes/ms/lv/mt/1504364055/mv/m?file=seg.ts [following]
--2017-09-02 22:56:00--  https://r13---sn-a5m7znes.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/requiressl/yes/ratebypass/yes/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D139/sgovp/gir%3Dyes%3Bitag%3D160/gcr/us/ei/RsOqWbzZA8_F-wOzga7QAg/playlist_type/DVR/pl/22/keepalive/yes/ip/128.1.68.62/ipbits/0/expire/1504384934/sparams/cmbypass,ei,expire,gcr,goi,hls_chunk_host,id,ip,ipbits,ipbypass,itag,live,mip,mm,mn,ms,mv,pl,playlist_type,ratebypass,requiressl,sgoap,sgovp,source/signature/49332FEF89A2658E83B1CB732EBC2EE7C3134268.705EA56C1806577FF5C798AD5C0DFA3B54D09AA6/key/cms1/playlist/index.m3u8/live/1/goap/clen%3D32261%3Blmt%3D1504363970510411/govp/clen%3D82693%3Blmt%3D1504363970510411/dur/5.005/redirect_counter/1/req_id/a4e8239a673fa3ee/cms_redirect/yes/ipbypass/yes/mip/162.221.192.2/mm/32/mn/sn-a5m7znes/ms/lv/mt/1504364055/mv/m?file=seg.ts
Resolving r13---sn-a5m7znes.googlevideo.com... 173.194.12.242, 2607:f8b0:401c:1a::12
Connecting to r13---sn-a5m7znes.googlevideo.com|173.194.12.242|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘a2.ts’

    [   <=>                                                                                                                                                                                                                                 ] 135,736      176KB/s   in 0.8s

2017-09-02 22:56:02 (176 KB/s) - ‘a2.ts’ saved [135736]

--2017-09-02 22:56:02--  https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/G@
Connecting to r2---sn-a5meknl6.googlevideo.com|173.194.166.72|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-09-02 22:56:04 ERROR 403: Forbidden.

--2017-09-02 22:56:04--  https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/seg.ts?requiressl=yes&ratebypass=yes&cmbypass=yes&goi=160&sgoap=gir=yes;itag=139&sgovp=gir=yes;itag=160&hls_chunk_host=r2---sn-a5meknl6.googlevideo.com&gcr=us&ei=RsOqWbzZA8_F-wOzga7QAg&playlist_type=DVR&mm=32&mn=sn-a5meknl6&ms=lv&mv=m&pl=22&keepalive=yes&mt=1504363216&ip=128.1.68.62&ipbits=0&expire=1504384934&sparams=ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,gcr,ei,playlist_type,mm,mn,ms,mv,pl&signature=1B4673C3F3D80E84B96C6EABE7206FCEDE91A367.8BB7CA502D508837C5C7D816C56338F5DDF34A62&key=dg_yt0&playlist=index.m3u8&live=1&goap=clen=32261;lmt=1504363970510411&govp=clen=82693;lmt=1504363970510411&dur=5.005
Connecting to r2---sn-a5meknl6.googlevideo.com|173.194.166.72|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://r13---sn-a5m7znes.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/requiressl/yes/ratebypass/yes/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D139/sgovp/gir%3Dyes%3Bitag%3D160/gcr/us/ei/RsOqWbzZA8_F-wOzga7QAg/playlist_type/DVR/pl/22/keepalive/yes/ip/128.1.68.62/ipbits/0/expire/1504384934/sparams/cmbypass,ei,expire,gcr,goi,hls_chunk_host,id,ip,ipbits,ipbypass,itag,live,mip,mm,mn,ms,mv,pl,playlist_type,ratebypass,requiressl,sgoap,sgovp,source/signature/0BB2F31085C8D4FACB820B47A2D52FD0D4F360C7.705F8AF8CFA9A89BCCCA169BEFB8D306D18924FF/key/cms1/playlist/index.m3u8/live/1/goap/clen%3D32261%3Blmt%3D1504363970510411/govp/clen%3D82693%3Blmt%3D1504363970510411/dur/5.005/redirect_counter/1/req_id/2dc5ceb41f06a3ee/cms_redirect/yes/ipbypass/yes/mip/162.221.192.2/mm/32/mn/sn-a5m7znes/ms/lv/mt/1504364055/mv/m?file=seg.ts [following]
--2017-09-02 22:56:05--  https://r13---sn-a5m7znes.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/requiressl/yes/ratebypass/yes/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D139/sgovp/gir%3Dyes%3Bitag%3D160/gcr/us/ei/RsOqWbzZA8_F-wOzga7QAg/playlist_type/DVR/pl/22/keepalive/yes/ip/128.1.68.62/ipbits/0/expire/1504384934/sparams/cmbypass,ei,expire,gcr,goi,hls_chunk_host,id,ip,ipbits,ipbypass,itag,live,mip,mm,mn,ms,mv,pl,playlist_type,ratebypass,requiressl,sgoap,sgovp,source/signature/0BB2F31085C8D4FACB820B47A2D52FD0D4F360C7.705F8AF8CFA9A89BCCCA169BEFB8D306D18924FF/key/cms1/playlist/index.m3u8/live/1/goap/clen%3D32261%3Blmt%3D1504363970510411/govp/clen%3D82693%3Blmt%3D1504363970510411/dur/5.005/redirect_counter/1/req_id/2dc5ceb41f06a3ee/cms_redirect/yes/ipbypass/yes/mip/162.221.192.2/mm/32/mn/sn-a5m7znes/ms/lv/mt/1504364055/mv/m?file=seg.ts
Reusing existing connection to r13---sn-a5m7znes.googlevideo.com:443.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘a2.ts’

    [    <=>                                                                                                                                                                                                                                ] 135,736      180KB/s   in 0.7s

2017-09-02 22:56:06 (180 KB/s) - ‘a2.ts’ saved [135736]

--2017-09-02 22:56:06--  https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/%EB%A9%E1x%89%BC%60l%94v%0E%BD%03%254%07%FF%90O%F0%EF%BD%01b%CC%E0%D59=%CB%FCzm%02%1F%E7?%22%D2%A5a%B8%CA%153%DB_'%F2%ED%B5%D0gG%01
Connecting to r2---sn-a5meknl6.googlevideo.com|173.194.166.72|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-09-02 22:56:08 ERROR 403: Forbidden.

Warning: wildcards not supported in HTTP.
--2017-09-02 22:56:08--  https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/0%F3y%EB%91%A7%AB%F0%17%CA]%AF%11%80%8B%81P%DCH~%1EB%02%A9%7C[%03W%3Cb%1DJ%E0%0F%A2%AB%0B%7C%1A%CF%9D%9A%9B%E3.%D4V%A2%1C%99X%CA%C38%D4%C9%0F%B1r%99[%C9%B0n%04?%85a%8B%5EDq%EA;.v%E9%D3%88%B9%B8%B9%94%0CL%CB%E2%C9J%A9(%7F%8A%9BD%7Cc%99]%B8%FE0%81%FE%B6%FC%AE%C7%5C%C3%FDX%D2%89%AD%DD%AF%13%8F%22:%FE%8Fq%01%14%B1G%01
Connecting to r2---sn-a5meknl6.googlevideo.com|173.194.166.72|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-09-02 22:56:09 ERROR 403: Forbidden.

Warning: wildcards not supported in HTTP.
--2017-09-02 22:56:09--  https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/]%FBCV%1F%FBq%8E%5E%C4%82l4%C8%0D%DBJ5%AE%FC@%F1%A61%DC%F4m+%5CPDT%90%FB%D7%82e%81S%B6%E4%CEQ%138%5C%B1%D7b%7C1%FB%D5%DB%0D0%C5%F0a%88%1CPaI%82%5C9%7FM%1CE%80FkJ%E3%DD%D6*%84%F8J%CD%04%1E,%C8n%A0%FE%08%3E4%D1%AF%AB%89%13%FF%C6%FBw%F1%141%15*-RY%A2%1C0%D3r%7B%AE%95G%01
Connecting to r2---sn-a5meknl6.googlevideo.com|173.194.166.72|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-09-02 22:56:11 ERROR 403: Forbidden.

--2017-09-02 22:56:11--  https://r2---sn-a5meknl6.googlevideo.com/videoplayback/id/Ga3maNZ0x0w.2/itag/91/source/yt_live_broadcast/sq/750747/file/seg.ts?%25%7Bb%AE%CD2z;
Connecting to r2---sn-a5meknl6.googlevideo.com|173.194.166.72|:443... connected.
^C

comment:2 Changed 9 months ago by stevenliu

comment:3 Changed 9 months ago by mobifon

Can nobody really fix the live youtube play?
With old ffmpeg before commit d0fc5de3a643fe7f974ed14e410c2ac2f4147d7e work perfect.

Last edited 9 months ago by mobifon (previous) (diff)

comment:4 Changed 8 months ago by mobifon

This 3 patches fix this Bug.

https://patchwork.ffmpeg.org/patch/5414/
https://patchwork.ffmpeg.org/patch/5415/
https://patchwork.ffmpeg.org/patch/5416/

ffplay -http_keepalive 1 <url> work ok.
Thx Aman Gupta.

comment:5 Changed 8 months ago by cehoyos

  • Keywords regression added
  • Priority changed from normal to important

Please mention the ticket in the commit message.

Note: See TracTickets for help on using tickets.