opening HTTP stream with LIBVLC

This forum is about all development around libVLC.
avi_tal
Blank Cone
Blank Cone
Posts: 19
Joined: 10 Oct 2012 17:49

opening HTTP stream with LIBVLC

Postby avi_tal » 02 Jun 2013 13:58

Hi Guys/Gals,

I am trying to open the following link with LIBVLC version 2.0.5: http://www.youtube.com/watch?v=xwtdhWltSIg
LIBVLC will not open this link (no error is displayed). Waited for more then 5 minutes.

VLC Player opens this link with no issues.
LIBVLC opens other links with no issues.

Your help is greately appriciated.

Thanks,

A.T.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: opening HTTP stream with LIBVLC

Postby sherington » 02 Jun 2013 15:08

When playing YouTube, or other things like internet radio stations, you will find that playing the URL will cause sub-item(s) to be created and added to the media instance. You can access these sub-items when the you receive the "finished" media player event from libvlc. This is analagous to parsing a playlist I suppose.

You can then inspect the sub-items to find the "real" streaming MRL, which you then play. Usually you simply want the first sub-item.

You can see what is going on if you add an event callback for the "subitem added" event.

Note that a recent change to YouTube actually caused a change in how this works - what I have seen from vlc logs is that it fails to locate the streaming URL by it's primary method, and falls back to a secondary method. In practical terms this means when you play the sub-item and it finishes, you get yet another sub-item - when you play this new sub-item, your YouTube video will start.

avi_tal
Blank Cone
Blank Cone
Posts: 19
Joined: 10 Oct 2012 17:49

Re: opening HTTP stream with LIBVLC

Postby avi_tal » 03 Jun 2013 13:40

Dear Sherington,

Thanks allot for your reply.

When I try to call: m_list = libvlc_media_subitems(media); m_list is allways NULL.

Do you have an idea why?

Thanks,

A.T.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: opening HTTP stream with LIBVLC

Postby sherington » 03 Jun 2013 18:02

Did you call libvlc_media_subitems *after* you received the "finished" event from the media player?

I know this works, I have a test-case specifically for it, here's a fragment of the vlc log on a test I just ran:

Code: Select all

[0x7fe568119148] main input debug: Creating an input for 'http://www.youtube.com/watch?v=FcMRkyoHKeA' [0x7fe568119148] main input debug: `http://www.youtube.com/watch?v=FcMRkyoHKeA' successfully opened [0x7fe55c00dd88] lua demux warning: Couldn't extract video URL, falling back to alternate youtube API <--- This used to work... [0x7fe55c00dd88] lua demux debug: old path: http://www.youtube.com/watch?v=FcMRkyoHKeA [0x7fe55c00dd88] lua demux debug: Path: http://www.youtube.com/get_video_info?video_id=FcMRkyoHKeA&el=detailpage [0x7fe55c00dd88] lua demux debug: Name: Watch Dogs - Game Demo Video [UK] [0x7fe55c00dd88] lua demux debug: Description: A glimpse at the future with the first game demo video of Watch Dogs. [0x7fe55c00dd88] lua demux debug: ArtURL: http://i3.ytimg.com/vi/FcMRkyoHKeA/maxresdefault.jpg?feature=og [0x7fe55c00dd88] lua demux debug: meta-URL: http://www.youtube.com/watch?v=FcMRkyoHKeA [0x7fe55c00dd88] main demux debug: removing module "lua" [0x7fe55c003ca8] main access debug: removing module "access_http" subItems=[http://www.youtube.com/get_video_info?video_id=FcMRkyoHKeA&el=detailpage] <--- First sub-item [0x7fe564002348] main input debug: Creating an input for 'http://www.youtube.com/get_video_info?video_id=FcMRkyoHKeA&el=detailpage' [0x7fe564002348] main input debug: `http://www.youtube.com/get_video_info?video_id=FcMRkyoHKeA&el=detailpage' successfully opened [0x7fe55c031778] lua demux debug: old path: http://www.youtube.com/get_video_info?video_id=FcMRkyoHKeA&el=detailpage [0x7fe55c031778] lua demux debug: Path: http://r2---sn-cn3tc-ajts.c.youtube.com/videoplayback?ipbits=8 [snip] [0x7fe55c031778] lua demux debug: Title: Watch Dogs - Game Demo Video [UK] [0x7fe55c031778] lua demux debug: Artist: ubisoft [0x7fe55c031778] lua demux debug: ArtURL: http://i3.ytimg.com/vi/FcMRkyoHKeA/default.jpg [0x7fe55c031778] lua demux debug: meta-URL: http://www.youtube.com/get_video_info?video_id=FcMRkyoHKeA&el=detailpage subItems=[http://r2---sn-cn3tc-ajts.c.youtube.com/videoplayback?ipbits=8 [snip] <--- NOTE!!! This is the MRL you really want [0x7fe564002d78] main input debug: Creating an input for 'http://r2---sn-cn3tc-ajts.c.youtube.com/videoplayback?ipbits=8 [snip] [0x7fe564002d78] main input debug: using timeshift granularity of 50 MiB, in path '/tmp' [0x7fe564002d78] main input debug: `http://r2---sn-cn3tc-ajts.c.youtube.com/videoplayback?ipbits=8 [snip]
The final streaming MRL is the first sub-item of the first sub-item of the media you played.

tommygr
Blank Cone
Blank Cone
Posts: 16
Joined: 08 Mar 2012 20:45

Re: opening HTTP stream with LIBVLC

Postby tommygr » 12 Dec 2013 23:31

Im having this same issue. This whole thing is very frustrating because VLC Player is doing it just fine.

My Path is this:
path => http://www.youtube.com/watch?v=XztPtK7yAUk

If I use the VLC Player this video opens just great.
if I go through LibVLC its not working. Using 2.1.2.

Tried these from the api:

m_pVlcMedia = libvlc_media_new_path (m_pVlcInst, path);

m_pVlcMedia = libvlc_media_new_location(m_pVlcInst, path);


after the clip starts to load I get the libvlc_MediaPlayerEndReached event which is what I expected.

Set my own End of media reached flag.

Just so I dont deadlock I call the libvlc_media_subitems() on another thread and all I get is NULL every time. I even tried the clip you used.

I just want to know the "Best Practice Method" for YouTube videos. I've seen a number of threads and everyone seems to be trying it differently. Some are using the standard libvlc_media_new_path and other are using libvlc_media_list_player_new.

I really dont want to rewrite my player for a list Player but if I have to then I might consider it.

I just want to get something working... This shouldn't be this hard.

tommygr
Blank Cone
Blank Cone
Posts: 16
Joined: 08 Mar 2012 20:45

Re: opening HTTP stream with LIBVLC

Postby tommygr » 13 Dec 2013 02:23

When I try using libvlc_media_new_location(inst, path);

i get this in the debugger output:

'LibVlcSB.exe': Loaded 'C:\Windows\System32\profapi.dll'
main libvlc debug: opening config file (C:\Users\VLCDev\AppData\Roaming\vlc\vlcrc)
main libvlc debug: translation test: code is "C"
main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 FPU
'LibVlcSB.exe': Loaded 'C:\Windows\System32\cryptbase.dll'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\clbcatq.dll'
Warning: no message line prompt for ID 0x8008.
Warning: no message line prompt for ID 0x800E.
main input debug: Creating an input for 'http://www.youtube.com/watch?v=FcMRkyoHKeA'
main input debug: using timeshift granularity of 50 MiB, in path 'C:\Users\VLCDev\AppData\Local\Temp'
main input debug: `http://www.youtube.com/watch?v=FcMRkyoHKeA' gives access `http' demux `' path `www.youtube.com/watch?v=FcMRkyoHKeA'
main input debug: creating demux: access='http' demux='' location='www.youtube.com/watch?v=FcMRkyoHKeA' file='\\www.youtube.com\watch?v=FcMRkyoHKeA'
main demux debug: looking for access_demux module matching "http": 12 candidates
main demux debug: no access_demux modules matched
main input debug: creating access 'http' location='www.youtube.com/watch?v=FcMRkyoHKeA', path='\\www.youtube.com\watch?v=FcMRkyoHKeA'
main access debug: looking for access module matching "http": 20 candidates
'LibVlcSB.exe': Loaded '\plugins\access\libaccess_http_plugin.dll', Binary was not built with debug information.
access_http access debug: querying proxy for http://www.youtube.com/watch?v=FcMRkyoHKeA
access_http access debug: no proxy
access_http access debug: http: server='www.youtube.com' port=80 file='/watch?v=FcMRkyoHKeA'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\mswsock.dll'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\WSHTCPIP.DLL'
main access debug: net: connecting to www.youtube.com port 80
'LibVlcSB.exe': Loaded 'C:\Windows\System32\wship6.dll'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\dnsapi.dll'
'LibVlcSB.exe': Loaded 'C:\Program Files\Bonjour\mdnsNSP.dll'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\IPHLPAPI.DLL'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\winnsi.dll'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\rasadhlp.dll'
'LibVlcSB.exe': Loaded 'C:\Windows\System32\FWPUCLNT.DLL'
main access debug: connection succeeded (socket = 604)
access_http access debug: protocol 'HTTP' answer code 200
access_http access debug: Server: gwiseguy/2.0
access_http access debug: Accepting Cookie: YSC=9E8EkQpkUNc; path=/; domain=.youtube.com; httponly
access_http access debug: Accepting Cookie: VISITOR_INFO1_LIVE=J5asWncR0zw; path=/; domain=.youtube.com; expires=Wed, 13-Aug-2014 12:55:08 GMT
access_http access debug: Content-Type: text/html; charset=utf-8
access_http access debug: Connection: close
main access debug: using access module "access_http"
main stream debug: Using stream method for AStream*
main stream debug: starting pre-buffering
main stream debug: received first data after 0 ms
main stream debug: pre-buffering done 1024 bytes in 0s - 1000000 KiB/s
main stream debug: looking for stream_filter module matching "any": 6 candidates
'LibVlcSB.exe': Loaded '\plugins\stream_filter\libsmooth_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\stream_filter\libhttplive_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\stream_filter\libdash_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\access\libzip_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\access\libstream_filter_rar_plugin.dll', Binary was not built with debug information.
main stream debug: no stream_filter modules matched
main stream debug: looking for stream_filter module matching "record": 6 candidates
'LibVlcSB.exe': Loaded '\plugins\stream_filter\librecord_plugin.dll', Binary was not built with debug information.
main stream debug: using stream_filter module "record"
main input debug: creating demux: access='http' demux='' location='www.youtube.com/watch?v=FcMRkyoHKeA' file='\\www.youtube.com\watch?v=FcMRkyoHKeA'
main demux debug: looking for demux module matching "any": 63 candidates
'LibVlcSB.exe': Loaded '\plugins\demux\libmp4_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libavi_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libasf_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libflacsys_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libes_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libmpc_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libtta_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libnuv_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libwav_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libsid_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\services_discovery\libsap_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libogg_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libmkv_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libdirac_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\access\liblive555_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libsmf_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libplaylist_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libpva_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libxa_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libaiff_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libvoc_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libau_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libgme_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\librawvid_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libimage_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libnsv_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libmod_plugin.dll', Binary was not built with debug information.
mod demux debug: MOD validation failed (ext=com\watch?v=FcMRkyoHKeA)
'LibVlcSB.exe': Loaded '\plugins\demux\libts_plugin.dll', Binary was not built with debug information.
ts demux debug: TS module discarded (lost sync)
'LibVlcSB.exe': Loaded '\plugins\demux\libps_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libty_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libmpgv_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libmjpeg_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\librawdv_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libnsc_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\demux\libdemux_cdg_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\codec\libavcodec_plugin.dll', Binary was not built with debug information.
avcodec demux debug: trying url: \\www.youtube.com\watch?v=FcMRkyoHKeA
avcodec demux debug: couldn't guess format
'LibVlcSB.exe': Loaded '\plugins\lua\liblua_plugin.dll', Binary was not built with debug information.
lua demux debug: Trying Lua scripts in C:\Users\VLCDev\AppData\Roaming\vlc\lua\playlist
lua demux debug: Trying Lua scripts in \lua\playlist
ps demux warning: this does not look like an MPEG PS stream, continuing anyway
main demux debug: using demux module "ps"
main demux meta debug: looking for meta reader module matching "any": 2 candidates
'LibVlcSB.exe': Loaded '\plugins\meta_engine\libtaglib_plugin.dll', Binary was not built with debug information.
lua demux meta debug: Trying Lua scripts in C:\Users\VLCDev\AppData\Roaming\vlc\lua\meta\reader
lua demux meta debug: Trying Lua scripts in \lua\meta\reader
main demux meta debug: no meta reader modules matched
main input debug: `http://www.youtube.com/watch?v=FcMRkyoHKeA' successfully opened
ps demux warning: garbage at input, trying to resync...
main input debug: EOF reached
main demux debug: removing module "ps"
main stream debug: removing module "record"
main access debug: removing module "access_http"
The thread 'handle_input_state_event' (0x1068) has exited with code 0 (0x0).


If I try to use libvlc_media_new_path (inst, path)

I get this:

main input debug: Creating an input for 'http://www.youtube.com/watch?v=FcMRkyoHKeA'
main input debug: using timeshift granularity of 50 MiB, in path 'C:\Users\VLCDev\AppData\Local\Temp'
main input debug: `file:///d:/Source/svn/trunk/LibVlcSB/http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFcMRkyoHKeA' gives access `file' demux `' path `/d:/Source/svn/trunk/LibVlcSB/http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFcMRkyoHKeA'
main input debug: creating demux: access='file' demux='' location='/d:/Source/svn/trunk/LibVlcSB/http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFcMRkyoHKeA' file='d:\Source\svn\trunk\LibVlcSB\http:\\www.youtube.com\watch?v=FcMRkyoHKeA'
main demux debug: looking for access_demux module matching "file": 12 candidates
'LibVlcSB.exe': Loaded '\plugins\access\liblibbluray_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\access\libaccess_bd_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\access\libdvdnav_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded 'C:\Windows\System32\shfolder.dll'
'LibVlcSB.exe': Unloaded 'C:\Windows\System32\shfolder.dll'
dvdnav demux warning: cannot open DVD (d:\Source\svn\trunk\LibVlcSB\http:\\www.youtube.com\watch?v=FcMRkyoHKeA)
main demux debug: no access_demux modules matched
main input debug: creating access 'file' location='/d:/Source/svn/trunk/LibVlcSB/http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFcMRkyoHKeA', path='d:\Source\svn\trunk\LibVlcSB\http:\\www.youtube.com\watch?v=FcMRkyoHKeA'
main access debug: looking for access module matching "file": 20 candidates
'LibVlcSB.exe': Loaded '\plugins\access\libaccess_vdr_plugin.dll', Binary was not built with debug information.
'LibVlcSB.exe': Loaded '\plugins\access\libfilesystem_plugin.dll', Binary was not built with debug information.
filesystem access debug: opening file `d:\Source\svn\trunk\LibVlcSB\http:\\www.youtube.com\watch?v=FcMRkyoHKeA'
filesystem access error: cannot open file d:\Source\svn\trunk\LibVlcSB\http:\\www.youtube.com\watch?v=FcMRkyoHKeA (Invalid argument)
main access error: File reading failed
main access error: VLC could not open the file "d:\Source\svn\trunk\LibVlcSB\http:\\www.youtube.com\watch?v=FcMRkyoHKeA" (Bad file descriptor).
main access debug: no access modules matched
main input error: open of `file:///d:/Source/svn/trunk/LibVlcSB/http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFcMRkyoHKeA' failed
main input error: Your input can't be opened
main input error: VLC is unable to open the MRL 'file:///d:/Source/svn/trunk/LibVlcSB/http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFcMRkyoHKeA'. Check the log for details.
The thread 'handle_input_state_event' (0xd4c) has exited with code 0 (0x0).


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 8 guests