Tiny Core Linux

Off-Topic => Off-Topic - Tiny Core Lounge => Topic started by: vinceASPECT on January 08, 2018, 04:04:45 PM

Title: youtube-dl
Post by: vinceASPECT on January 08, 2018, 04:04:45 PM
Hello,

does anybody know the command that both shows all of the file types
available for a particular youtube movie link......and then can also show the url
of any of the listed file type option(s) that you choose....(not to actually download it)....

i can't quite get it.......i know "g" is somehow related to the url's

thx

V
Title: Re: youtube-dl
Post by: Misalf on January 08, 2018, 04:22:14 PM
Code: [Select]
youtube-dl --list-formats "$URL"
Code: [Select]
youtube-dl -g --cookies /tmp/ytcookie --format 22 "$URL"
If it doesn't work I can post the script I made to automate this. Might be a little messy though.
Title: Re: youtube-dl
Post by: vinceASPECT on January 14, 2018, 12:56:11 PM
yes thankyou...i figured out an approach

youtube-dl -f 17 -g (then the youtube movie link here)

this above just shows me the URL the file type assigned the listing number of 17 from a list of
about 19 different file types......

it's unusual becausae the list numbering has no real meaning.....so the positions that interest
me are 17 and 251

the listing just has no meaning or logical counting

eg (list below)

340--- some file type
26 -----some file type
----
---
----
---
290 ----some file type
---
---
215......mp4 360 file type
----
----
17 .......3gp 144 file type
----
-----

there are about 19 list entries in total

V
Title: Re: youtube-dl
Post by: Misalf on January 14, 2018, 03:19:36 PM
Yep. Numbers.
Maybe the attached script is useful for you in some way. ;)
Title: Re: youtube-dl
Post by: vinceASPECT on January 18, 2018, 07:17:07 AM
uh....yeah. -----i also tried to play live youtube videos in mplayer. First off i used youtube-dl with the live movie link and it listed some possible feeds. I grabbed one of the feeds  (93) and it then showed me the "DOTmu8" styled link for that feed.

Mplayer only played that video feed link for 10 secs then sputtered out  a "can't reverse seek in a stream" error.  I tried many switches like -cache etc but there was no improvement.......does anybody know how to solve that error pls?l

Played great for 10 secs....
Title: Re: youtube-dl
Post by: Misalf on February 01, 2018, 02:02:01 AM
I don't know why it stops for you after 10 seconds.
I use that script pretty much every day to stream videos via smplayer. I made it due to laziness, in a non-lazy moment, so I don't have to remember the CLI options for video quality etc.
If it doesn't error out after 10 seconds when you use that script, instead of directly running mplayer with the content URL, you might be able to reproduce what the script does by checking which options are shipped over to mplayer.
I believe the  --cookie  option is kind of important also.
Title: Re: youtube-dl
Post by: vinceASPECT on February 07, 2018, 07:01:16 AM
ahh Misalf...but are the movies you watch "live" streams from youtube?......youtube has an option called "live".

but anyhow, i have had a nightmare confirming with the BBC broadcasting corporation in the uk.......... about what types of youtube LIVE videos i am allowed to watch without a TV licence......there are some we can watch and some we can't...

V
Title: Re: youtube-dl
Post by: Misalf on February 07, 2018, 07:11:53 AM
Sorry, no idea if live streams would work. My limited bandwidth wouldn't suffice.
I usually stream short videos in very low quality for informational purposes only.
Title: Re: youtube-dl
Post by: vinceASPECT on February 08, 2018, 06:05:14 AM
well, it's nothing to do with bandwidth since the live streams are available in the same formats as any youtube "previously recorded video"  (any regular youtube video) on their site

it's the Protocol that is different. Live streams use a different protocol which mplayer doesn't quite like...infact Vlc does not like it either...

apparently only MPV can do live YT streaming. (a fork) but it's unclear if even mpv now works since youtube regularly changes it's code

I know that the only way to watch LIVE youtube videos within googles supposed remit (so to speak) is to use chrome browser and it needs to be a very recent edition....(some derivates of chrome may work....maybe Slimjet etc) but not many......FF may work..

V

Title: Re: youtube-dl
Post by: neonix on January 16, 2019, 06:14:18 AM
Is it possible to pipe youtube-dl output to mplayer? That I can watch video on-the-fly instead waiting until download end?
Title: Re: youtube-dl
Post by: mocore on January 16, 2019, 09:53:43 AM

AFAIK you can read the file as it is being written!

did you try just opening the file as it is down loading ? ... 
Title: Re: youtube-dl
Post by: neonix on January 17, 2019, 07:16:59 AM

AFAIK you can read the file as it is being written!

did you try just opening the file as it is down loading ? ...
This is possible but not comfortable with very big and long videos.
Title: Re: youtube-dl
Post by: curaga on January 17, 2019, 09:50:01 AM
I think you can get youtube-dl to just print the video url, which you can then access with mplayer.
Title: Re: youtube-dl
Post by: Pats on January 17, 2019, 12:40:33 PM
I was thinking  , youtube-dl is to download a video for watching thru a video player ! :)

1) If the only purpose of OP is to view streaming videos,then this may be helpful ( prvsly read from net , not used ):
Quote
... Livestreamer is a Command Line Interface that pipes video streams from various services into a video player, such as VLC, Mplayer. The main purpose of Livestreamer is to allow the user to avoid buggy and CPU heavy flash plugins but still be able to enjoy various streamed content. 

Code: [Select]
livestreamer twitch.tv/day9tv
2) Some intersting links :

http://freesoftwaremagazine.com/articles/youtube_and_gnu_linux_download_and_convert_videos_easy_way

https://www.linuxlinks.com/youtube-dl-download-video-audio-files-streaming-sites
Title: Re: youtube-dl
Post by: vinceASPECT on January 20, 2019, 08:22:41 AM
Hi
Neonix.....i assume you did read the start of this whole thread....?

The answer to your later question is as Curaga stated to you.....youtube-dl will give you just the "viewable" URL address to any video......from any youtube video link you give youtube-dl

You then just paste that address into any media player and it will Stream and play the video. It's not downloading it.....as such.

so

a) .............$youtube-dl (Some youtube video link) -F       

.......that command above typed into your command prompt will show you all the LINKS for the particular youtube video link you gave it.

Then, for example below

b) ..............$youtube-dl -f 17 -g (same youtube video link)   

.....That command above in (b) will give you the URL of a particular FILE FORMAT (option 17) of the youtube video link you gave to youtube-dl.......it's an option you chose (17) from your listings results after executing command a) above

Then

c) ...............You take that LONG URL LINK result from (b) and copy and paste it into the OPEN URL option of any media player like mplayer and the video will STREAM and play. It isn't really downloading the video file, it;s streaming it.

-------------------------------------------------------
This stuff above is not true for ALL youtube videos. As the thread mentions, it's harder to playback LIVE youtube videos in media players.....but standard stuff works ok

thx

Vin

Title: Re: youtube-dl
Post by: neonix on January 23, 2019, 04:29:34 AM
Thank you everyone for help.
Because mplayer doesn't support https protocol I have to create this simply script that sends url to wget and then to mplayer.

usage: yt https://www.youtube.com/watch?v=2OnAOaTnMT8
Code: [Select]
#!/bin/sh
tce-load -iw ca-certificates
tce-load -iw wget
tce-load -iw python
rm /home/tc/1.txt
youtube-dl -f 18 -g "$1" > /home/tc/1.txt
url=`cat /home/tc/1.txt`
wget --no-check-certificate $url -O - | mplayer -
If you want to watch youtube live streams with m3u8 protocol (HTTP Live Streaming) you have to use vlc3 because only it supports https.  MPlayer 1.3 support m3u8 but without https.
Title: Re: youtube-dl
Post by: vinceASPECT on January 23, 2019, 11:43:33 AM
Hello

Neonix.i have got absolutely no idea what your talking about .....the post i made (reply 14) prior to your last reply 15 ... that 14 reply works perfectly with mplayer youtube videos in both win32 and Linux. 

Your comments in 15 about mplayer not doing https protocols are.....total garbage.
Your script may or may not work but i DO know that wget does indeed have issues with https.


The mplayer command to play a stream from my earlier instructional post 14 .......can be as follows below

$mplayer -vo directx -zoom -really-quiet -aspect 16:9 "Large Video Link as described in my earlier  instructional post 14"

examples below........

$mplayer -vo directx -zoom -really-quiet -aspect 16:9 "https://r3---sn-aigs6n7y.googlevideo.com/videoplayback?ip=86.187.171.246&key=yt6&lmt=1493499359128513&dur=523.749&expire=1548293772&id=o-AO_ZBCOw6eiwRAFa88BNByMOWHcWFMB16DPXKdVi63rF&source=youtube&initcwndbps=812500&fvip=3&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&clen=16246435&ipbits=0&signature=BDF56C5D22751CC2B824F26F6A9C8EFF0B8C9372.2B3E1AF7FA1BC86AEFA207AB0019410D201C1F46&itag=18&pl=16&mime=video%2Fmp4&c=WEB&mm=31%2C29&mn=sn-aigs6n7y%2Csn-aigl6ney&gir=yes&ratebypass=yes&requiressl=yes&mt=1548272095&mv=m&ei=LMJIXMeEDIOuVc3yhsgE&ms=au%2Crdu"

OR SAY......

$mplayer -vo sdl -zoom -really-quiet -aspect 16:9 "https://r3---sn-aigs6n7y.googlevideo.com/videoplayback?ip=86.187.171.246&key=yt6&lmt=1493499359128513&dur=523.749&expire=1548293772&id=o-AO_ZBCOw6eiwRAFa88BNByMOWHcWFMB16DPXKdVi63rF&source=youtube&initcwndbps=812500&fvip=3&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&clen=16246435&ipbits=0&signature=BDF56C5D22751CC2B824F26F6A9C8EFF0B8C9372.2B3E1AF7FA1BC86AEFA207AB0019410D201C1F46&itag=18&pl=16&mime=video%2Fmp4&c=WEB&mm=31%2C29&mn=sn-aigs6n7y%2Csn-aigl6ney&gir=yes&ratebypass=yes&requiressl=yes&mt=1548272095&mv=m&ei=LMJIXMeEDIOuVc3yhsgE&ms=au%2Crdu"

and you press "F" to flip between full screen or not.


These methods above play the youtube video in any quality on any media player on any platform.

This post here (16) is nothing concerning live youtube streams just regular youtube videos.

thx

Vin
Title: Re: youtube-dl
Post by: vinceASPECT on January 23, 2019, 03:24:16 PM
Yes

if anybody is interested also......i figured a way to play LIVE youtube video streams in mplayer.

You need the very latest youtube-dl version and you give it the live youtube link and it will list live stream URL otions as a result. So as below......

a) ...............$youtube-dl (live youtube video link here) -F  [enter]

b) then use a command with any of the options (93) from the results of a) above to get the true link as below

...................$youtube-dl -f 93 -g (the same live youtube video link here) [enter]

c) part b) above gives you a new URL ending in DOTm3u8.........then just past that URL into mplayer as below here in d)

d)...............$mplayer -vo gl -zoom -aspect 16:9 -cache 4096 -xy 184 -noborder -really-quiet -ontop "THE LONG VIDEO M3U8 URL LINK HERE"   [enter]

The live youtube video will play in mplayer.

---------------------------------------------------------

You can choose what XY size of video screen you want.......and if your PC is good you can flip between fullscreen by pressing "F"............otherwise you can start again from scratch and put the -fs switch into your mplayer arguments list to get instant fullscreen  (it should work)

These DOTm3u8 video links should also open in VLC and Kodi etc.  Kodi requires that you paste the link into a text file and save as say Video.m3u. Then in kodi you navigate to that FILE and open it.....it will stream the live video.

example below



...............$mplayer -vo gl -zoom -aspect 16:9 -cache 4096 -xy 184 -noborder -really-quiet -ontop "https://manifest.googlevideo.com/api/manifest/hls_playlist/id/R6vzE0yBfKk.0/itag/93/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D134/hls_chunk_host/r5---sn-aigzrn7l.googlevideo.com/ei/UedIXL-SMJKOVPn9tcAI/playlist_type/DVR/gcr/gb/initcwndbps/5830/mm/32/mn/sn-aigzrn7l/ms/lv/mv/m/pl/16/dover/11/keepalive/yes/manifest_duration/30/playlist_duration/30/mt/1548281550/disable_polymer/true/ip/86.187.170.30/ipbits/0/expire/1548303281/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,ei,playlist_type,gcr,initcwndbps,mm,mn,ms,mv,pl/signature/89E65150D22CE6CE45F3284B7B74C311BA6C6CF8.2EC0DCAC4B9F3F4E14B1B2E3E98F2876E9130D10/key/dg_yt0/playlist/index.m3u8"

Thx

Vin




Title: Re: youtube-dl
Post by: neonix on January 23, 2019, 08:47:58 PM
Hello

Neonix.i have got absolutely no idea what your talking about .....the post i made (reply 14) prior to your last reply 15 ... that 14 reply works perfectly with mplayer youtube videos in both win32 and Linux. 

Your comments in 15 about mplayer not doing https protocols are.....total garbage.
Your script may or may not work but i DO know that wget does indeed have issues with https.
Hi Vin
I assume you are a Windows user. But in Linux (TC8) when I use https url with Mplayer 1.3 I got
Code: [Select]
https protocol not found, recompile FFmpeg with openssl, gnutls,
or securetransport enabled.
Is there a way to compile latest Mplayer with https support?
Title: Re: youtube-dl
Post by: Juanito on January 23, 2019, 09:08:59 PM
which mplayer extension are you using?
Title: Re: youtube-dl
Post by: Juanito on January 24, 2019, 12:49:35 AM
mplayer updated to 1.3.0 as mplayer-cli and mplayer (gtk2) added

..seems to work with youtube-dl https links
Title: Re: youtube-dl
Post by: vinceASPECT on January 24, 2019, 03:51:36 AM
Yes Neonix, i sincerely appologise and it's as Juanito stated.......i am talking from the standpoint of win x64 mplayer. 

It's strange since it all works fine on win x64.  mplayer.

 I always assumed things like mplayer were actually ahead of the game in Linux OS'a....not several versions behind other OS's. So i simply stated it worked in Linux because i assumed it would.

It seems Juanito has now upgraded the TCL mplayer with the required https support so that all of my earlier posts (14,16 etc) should now work ok on TCL mplayer.

I hope it works for sure. Since mplayer is so lightweight for dealing with youtube and lots of other media.
Neonix, i am sure your script can be modded slightly since TCL mplayer has now been upgraded.

I also messed around with different feed quality's when doing LIVE youtube links. VLC certainly does play them back without issue.....and mplayer does. I don't know if TCL's vlc version would do it but i tend to just stay with mplayer anyhow.

thx

Vin

Title: Re: youtube-dl
Post by: neonix on January 26, 2019, 05:11:56 AM
mplayer updated to 1.3.0 as mplayer-cli and mplayer (gtk2) added

..seems to work with youtube-dl https links
I tested it in TC 9 x86 and TC 10 x86 and still get the same error:
Code: [Select]
https protocol not found, recompile FFmpeg with openssl, gnutls,
or securetransport enabled.
Did you install gnutls-dev before compilation?
Title: Re: youtube-dl
Post by: Juanito on January 26, 2019, 05:27:17 AM
Since it worked for me, could you supply an https link that doesn’t work?
Title: Re: youtube-dl
Post by: neonix on January 26, 2019, 07:57:10 PM
Since it worked for me, could you supply an https link that doesn’t work?
Tested in TC9 x86 with mplayer-cli.tcz

https://trtcanlitv-lh.akamaihd.net/i/TRTWORLD_1@321783/master.m3u8
https://dwstream4-lh.akamaihd.net/i/dwstream4_live@131329/master.m3u8

More links here:
https://github.com/notanewbie/LegalStream/blob/master/packages/news/world.m3u8
Title: Re: youtube-dl
Post by: Juanito on January 26, 2019, 09:18:47 PM
I see the error now - I also see this:
Code: [Select]
libavformat version 57.83.100 (external)
Mismatching header version 57.25.100

..perhaps there is a problem with using the system ffmpeg rather than mplayer's internal version.

I'll take a look.
Title: Re: youtube-dl
Post by: Juanito on January 27, 2019, 03:27:45 AM
Ah - here was the problem:
Code: [Select]
[--enable-openssl is incompatible with the gpl and --enable-nonfree is not specified]
gnutls(3.6) used instead and ffmpeg3 re-posted
Title: Re: youtube-dl
Post by: neonix on January 27, 2019, 07:14:12 AM
Thank you Juanito for help. Now https links works and Tinycore has up to date software.

I would like to also add some comments.
1) mplayer-cli dependencies have 100 MB. Mplayer with internal ffmpeg would have only 16 MB or even less using upx.
2) I found that "due to conflicting MPlayer and OpenSSL licenses the
resulting binary may be non-distributable"
3) mplayer.tcz.info shows version 1.1.1 instead 1.3.0
4) mplayer volume control don't work in my computer. PCM value is changing but sound is still at the same level.
5) m3u8 protocol streams signal in packets, and it creates freezes. As I read it was ffmpeg fault not mplayer, but I think in latest mplayer snapshot, it was fixed (with internal ffmpeg).
http://lists.mplayerhq.hu/pipermail/mplayer-users/2013-September/086606.html
6) What is also interesting some servers may be not compatible with gnutls. This means that mplayer may not work with all https links.
Title: Re: youtube-dl
Post by: Juanito on January 27, 2019, 09:40:49 PM
mplayer-cli dependencies have 100 MB. Mplayer with internal ffmpeg would have only 16 MB or even less using upx.
If you'd like to take over the maintenance of mplayer-cli with a view to reducing the total size of the extension including recursive deps, but maintaining functionality, please go ahead.

Quote
I found that "due to conflicting MPlayer and OpenSSL licenses the
resulting binary may be non-distributable"
Neither mplayer nor ffmpeg have openssl as a dep

Quote
mplayer.tcz.info shows version 1.1.1 instead 1.3.0
Fixed - thanks

Quote
mplayer volume control don't work in my computer. PCM value is changing but sound is still at the same level
The mplayer volume control works for me with both alsa and pulseaudio