Could not play youtube video smoothly.

This forum is about all development around libVLC.
sanmool
Blank Cone
Blank Cone
Posts: 20
Joined: 02 Apr 2023 12:01

Could not play youtube video smoothly.

Postby sanmool » 22 Apr 2023 21:15

Hi,

I have used libvlc to make youtube playing app on Linux. Some youtube videos(For example https://www.youtube.com/watch?v=El1kgCqD7Xk) play smoothly. But some of youtube videos(for example, https://www.youtube.com/watch?v=pIgZ7gMze7A) freeze intermittently(stops and play stops and play...). I don't know what makes them different.

I have tried many options. --network-caching=999999 could work but I had to wait to long(more than a minute) to start video. So I set a reasonable number --network-caching=3000. but this results in not smooth play. Is there any options I can get around this choppy play?

Could it be something to do with video resolution? I thought I may change the preferred resolution by setting --preferred-resolution=240(low quality) but there were no changes on resolution. Can I edit youtube.lua to set youtube-resolution to 240?


Here is the debug message I got.

Code: Select all

[00007f4bb40069e0] main input debug: Buffering 69% [00007f4bb40069e0] main input debug: Buffering 76% [00007f4bb40069e0] main input debug: Buffering 83% [00007f4bb40069e0] main input debug: Buffering 90% [00007f4bb40069e0] main input debug: Buffering 97% [00007f4bb40069e0] main input debug: Stream buffering done (3750 ms in 6431 ms) [00007f4bb40069e0] main input debug: Decoder wait done in 0 ms [0000000001d65380] main audio output warning: buffer too late (-47558028 us): dropped [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 47518 ms) [00007f4bac96c440] avcodec decoder debug: available hardware decoder output format 100 (vdpau) [00007f4bac96c440] avcodec decoder debug: available hardware decoder output format 119 (cuda) [00007f4bac96c440] avcodec decoder debug: available hardware decoder output format 46 (vaapi_vld) [00007f4bac96c440] avcodec decoder debug: available software decoder output format 0 (yuv420p) [00007f4bac96c440] avcodec decoder debug: reusing decoder output format 0 [h264 @ 0x7f4bac76ff40] Reinit context to 464x368, pix_fmt: yuv420p [00007f4bac81e0b0] main decoder debug: end of audio preroll [0000000001d65380] alsa audio output error: cannot estimate delay: Input/output error [00007f4bac96c440] main decoder debug: end of video preroll [00007f4bb0048200] main video output debug: picture might be displayed late (missing 3 ms) [00007f4bb40069e0] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 2401 ms) [00007f4bb40069e0] main input debug: ES_OUT_RESET_PCR called [00007f4bac96c440] main decoder debug: Received first picture [00007f4bac96c440] main decoder error: Timestamp conversion failed for 50120001: no reference clock [00007f4bac96c440] main decoder error: Could not convert timestamp 0 for FFmpeg [00007f4bb40069e0] main input debug: Buffering 0% [00007f4bac96c440] avcodec decoder debug: available hardware decoder output format 100 (vdpau) [00007f4bac96c440] avcodec decoder debug: available hardware decoder output format 119 (cuda) [00007f4bac96c440] avcodec decoder debug: available hardware decoder output format 46 (vaapi_vld) [00007f4bac96c440] avcodec decoder debug: available software decoder output format 0 (yuv420p) [00007f4bac96c440] avcodec decoder debug: reusing decoder output format 0 [h264 @ 0x7f4bac76ff40] Reinit context to 464x368, pix_fmt: yuv420p [h264 @ 0x7f4bac76ff40] co located POCs unavailable [00007f4bb40069e0] main input debug: Buffering 10% [00007f4bb40069e0] main input debug: Buffering 20% [00007f4bb40069e0] main input debug: Buffering 31% [00007f4bb40069e0] main input debug: Buffering 41% [00007f4bb40069e0] main input debug: Buffering 52% [00007f4bb40069e0] main input debug: Buffering 62% [00007f4bb40069e0] main input debug: Buffering 72% [00007f4bb40069e0] main input debug: Buffering 83% [00007f4bb40069e0] main input debug: Buffering 93% [00007f4bb40069e0] main input debug: Stream buffering done (2500 ms in 3953 ms) [00007f4bb40069e0] main input debug: Decoder wait done in 0 ms [0000000001d65380] main audio output warning: buffer too late (-300355 us): dropped [0000000001d65380] alsa audio output error: cannot estimate delay: Input/output error [0000000001d65380] main audio output warning: playback way too early (-156361): playing silence [0000000001d65380] main audio output debug: inserting 6895 zeroes [0000000001d65380] main audio output warning: buffer too late (-235997 us): dropped [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 79 ms) [0000000001d65380] main audio output warning: buffer too late (-212886 us): dropped [0000000001d65380] main audio output warning: buffer too late (-189734 us): dropped [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 39 ms) [0000000001d65380] main audio output warning: buffer too late (-166575 us): dropped [0000000001d65380] main audio output warning: buffer too late (-143414 us): dropped [0000000001d65380] main audio output warning: buffer too late (-120255 us): dropped [0000000001d65380] main audio output warning: buffer too late (-97154 us): dropped [0000000001d65380] main audio output warning: buffer too late (-73993 us): dropped [0000000001d65380] main audio output debug: playback too late (57887): flushing buffers [0000000001d65380] alsa audio output error: cannot estimate delay: Input/output error [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 241 ms) [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 201 ms) [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 161 ms) [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 126 ms) [00007f4bb0048200] main video output warning: picture is too late to be displayed (missing 87 ms) [00007f4bb40069e0] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 2681 ms)

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Could not play youtube video smoothly.

Postby Rémi Denis-Courmont » 23 Apr 2023 06:33

YouTube is known to throttle external apps.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sanmool
Blank Cone
Blank Cone
Posts: 20
Joined: 02 Apr 2023 12:01

Re: Could not play youtube video smoothly.

Postby sanmool » 23 Apr 2023 22:03

I have tested those youtube link using some Android apps( VLC for Android, KMPlayer, XPlayer). Only VLC for Android shows choppy play on https://www.youtube.com/watch?v=pIgZ7gMze7A. So I guess it could be improved by adding some options or fixing bugs.

I am curious why https://www.youtube.com/watch?v=El1kgCqD7Xk plays smoothly in VLC while https://www.youtube.com/watch?v=pIgZ7gMze7A does not. Both seems are low resolution.

sanmool
Blank Cone
Blank Cone
Posts: 20
Joined: 02 Apr 2023 12:01

Re: Could not play youtube video smoothly.

Postby sanmool » 04 May 2023 00:48

In order to see whether we have to make some change on libvlc or youtube.lua, I did the following things.

When I pasted https://www.youtube.com/watch?v=pIgZ7gMze7A to KMplayer, it plays smoothly.
I extracted address https://rr2---sn-a5msenl7.googlevideo.com/videoplayback?... using youtube.lua of libvlc. Thhis address is the video file url corresponding https://www.youtube.com/watch?v=pIgZ7gMze7A. but when I pasted https://rr2---sn... to KMplayer, it also shows choppy play.

It implies that KMplayer may get a video from other than above https://rr2---sn... address.

So I guess if we makes some change on youtube.lua and extract better address, then we could play youtube smoothly as KMplayer does.

sanmool
Blank Cone
Blank Cone
Posts: 20
Joined: 02 Apr 2023 12:01

Re: Could not play youtube video smoothly.

Postby sanmool » 06 May 2023 20:49

When I parsed "https://www.youtube.com/watch?v=FAwbm3f00m4" using libvlc and youtube.lua, I got

Code: Select all

https://rr2---sn-a5meknde.googlevideo.com/videoplayback?expire=1683418268&ei=PJhWZLrENLGDsfIPmMCViA8&ip=172.89.154.184&id=o-AN0lkgVkB70M2JALZJS3CW6JwiuKX2J80PU5yiHGJ0jt&itag=22&source=youtube&requiressl=yes&mh=ez&mm=31%2C26&mn=sn-a5meknde%2Csn-q4flrnez&ms=au%2Conr&mv=m&mvi=2&pl=19&initcwndbps=2410000&vprv=1&svpuc=1&mime=video%2Fmp4&ns=s_WdCfdn9MJUYqfATCp9CNMN&cnr=14&ratebypass=yes&dur=232.153&lmt=1678053734694566&mt=1683396307&fvip=4&fexp=24007246&c=WEB&txp=5311224&n=6ieC1tX2nTX1L1u5ac6&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Cns%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgdm6plMnPvUB-h0A8XLiUlXuvlTPpBxaj3ec8n3NSuGwCIQCHgDlOAE4omJnq5DE-a7dtxY1axlJrUPOoKiZhzRDpVw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAJXsxuTRW1fiAAxv1ZytIRwTRUDD8u-EGSzM1FHfxIbdAiBsiJP-BiatmYhC7Br8if7YiPI0PktpfQmLNStkl2FytA%3D%3D
This address yields 50kb/s using wget.

When I parsed "https://www.youtube.com/watch?v=FAwbm3f00m4" using yt-dlp-master, I got

Code: Select all

https://rr1---sn-a5msen7l.googlevideo.com/videoplayback?expire=1683417434&ei=-pRWZOWdF8qVkgb9j7_wAQ&ip=172.89.154.184&id=o-AO_kWaUW_3Wb55-MMeCZQkYNRWdGaJm2r-HEx3eV4Fio&itag=22&source=youtube&requiressl=yes&mh=ez&mm=31%2C26&mn=sn-a5msen7l%2Csn-q4fl6n6z&ms=au%2Conr&mv=m&mvi=1&pl=19&initcwndbps=2400000&spc=qEK7Bysf2puLO1MBvzbPOCOadKIfqnM&vprv=1&svpuc=1&mime=video%2Fmp4&cnr=14&ratebypass=yes&dur=232.153&lmt=1678053734694566&mt=1683395355&fvip=1&fexp=24007246&c=ANDROID&txp=5311224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAIdJ8xJEmFFbw8HHGhA-NieVEWFqV__Bgc1_opHgqhhoAiBtxAylQVaZafHLZoGyN1vZPj2KrUDdEjeVNOQtqU-M3w%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgYFVdDbgF7fWMn290SiQKGcxKPRchMcrI1z-4gBzjQkoCID2tYLPMOBFxwuhlqzldi6kYFd2VoE_KOVkpiRh1iTeo
This address yeilds 5MB/s using wget.

I guess youtube.lua found slow link and could not find fast link.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests