Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Video stream recording (http://stream-recorder.com/forum/forumdisplay.php?f=4)
-   -  

How to dump youtube live TV stream to file using commandline?

(http://stream-recorder.com/forum/showthread.php?t=15019)

cezi1 02-15-2013 03:03 PM

Re: How to dump youtube live TV stream to file using commandline?


 
@Elgero

that's your decision, but real shame my friend
who is the author of youtube-dl?

DEAD_MAN_WALKING 02-17-2013 10:19 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by Elgero (Post 59751)
I spent several hours making this tool and it has only been downloaded 11 times in almost 3 weeks, so there isn't much interest in this tool.

You might get a few more downloads now mate...;)

Great work keep it up.

http://forum.wiziwig.eu/threads/8147...e-Live-Streams

djensen1234@gmail.com 03-15-2013 03:49 PM

Re: How to dump youtube live TV stream to file using commandline?


 
hello all

thanks so much for the rip program

however trying to rip this

http://www.youtube.com/watch?v=A0H7-eZm4Mg&pxtry=1

to no succes...

C:\>youtubedl -l -u http://www.youtube.com/watch?v=A0H7-eZm4Mg&pxtry=1

Available formats for this stream:

'pxtry' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.


in danish... saying pxtry was not recognized as an internal or external command, program or batchfile...

can somebody explain ...?

thanks :)

TubeDigger 03-15-2013 04:01 PM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by djensen1234@gmail.com (Post 60643)
however trying to rip this
http://www.youtube.com/watch?v=A0H7-eZm4Mg&pxtry=1
to no succes...

Code:

ffmpeg -i "http://www.youtube.com/api/manifest/hls_playlist/id/A0H7-eZm4Mg.1/itag/93/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/playlist_type/LIVE/cp/U0hVSFRLU19FUENONV9MRVdCOnN3MkNVSkZtaTJX/maudio/1/pmbypass/yes/sver/3/fexp/912806,902000,919512,929901,913605,906938,931202,931401,908529,930803,920201,929602,930101,930603,900824/upn/B1D7NPMwzLo/cpn/3j6T84km9gzfdL_V/ip/188.230.10.206/ipbits/8/expire/1363405106/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,playlist_type,cp,maudio,pmbypass/signature/4516D925E719FDAECAD772CF28B1DB7698C4E6C1.47CAFC076F0D04E5E5AE278DECC6D80E58AAE980/key/dg_yt0/file/index.m3u8" -c copy out.ts

Elgero 03-15-2013 04:27 PM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by djensen1234@gmail.com (Post 60643)
hello all

thanks so much for the rip program

however trying to rip this

http://www.youtube.com/watch?v=A0H7-eZm4Mg&pxtry=1

to no succes...

C:\>youtubedl -l -u http://www.youtube.com/watch?v=A0H7-eZm4Mg&pxtry=1

Available formats for this stream:

'pxtry' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.


in danish... saying pxtry was not recognized as an internal or external command, program or batchfile...

can somebody explain ...?

thanks :)

The reason why you get that error is because you can't use an ampersand (&) in the url. You must either remove "&pxtry=1" or escape the ampersand with a caret.

Code:

http://www.youtube.com/watch?v=A0H7-eZm4Mg
or

Code:

http://www.youtube.com/watch?v=A0H7-eZm4Mg^&pxtry=1

The tool was written in a very short time and doesn't support every live video on YouTube, so even after removing "&pxtry=1" or escaping the ampersand it won't work unfortunately.

djensen1234@gmail.com 03-15-2013 04:59 PM

Re: How to dump youtube live TV stream to file using commandline?


 
ok... thank you for using the time to reply...

i can confirm it wont work...

trying to go down the ffmpeg way... though starting from scratch from a new virtuel linux install

so... dont know how this is gonna end .... and i really want to get started recording.... will tell you how this ends.. :)

djensen1234@gmail.com 03-15-2013 05:12 PM

Re: How to dump youtube live TV stream to file using commandline?


 
i tried this

http://ffmpeg.zeranoe.com/builds/

and the command from tubedigger

same problem with &pxtry

and this

http://www.youtube.com/watch?v=A0H7-eZm4Mg: Invalid data found when processing input

magichandz 03-16-2013 09:21 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by TubeDigger (Post 60644)
Code:

ffmpeg -i "http://www.youtube.com/api/manifest/hls_playlist/id/A0H7-eZm4Mg.1/itag/93/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/playlist_type/LIVE/cp/U0hVSFRLU19FUENONV9MRVdCOnN3MkNVSkZtaTJX/maudio/1/pmbypass/yes/sver/3/fexp/912806,902000,919512,929901,913605,906938,931202,931401,908529,930803,920201,929602,930101,930603,900824/upn/B1D7NPMwzLo/cpn/3j6T84km9gzfdL_V/ip/188.230.10.206/ipbits/8/expire/1363405106/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,playlist_type,cp,maudio,pmbypass/signature/4516D925E719FDAECAD772CF28B1DB7698C4E6C1.47CAFC076F0D04E5E5AE278DECC6D80E58AAE980/key/dg_yt0/file/index.m3u8" -c copy out.ts

i'm trying to record that stream too. the ffmpeg method definitely works but i ran into a problem where it stops downloading the stream after about 2 or 3 hours. the stream is about 10 hours long. is there any way to make sure it gets the whole thing?

magichandz 03-17-2013 12:09 AM

Re: How to dump youtube live TV stream to file using commandline?


 
i just discovered a bigger problem with this stream
http://www.youtube.com/watch?v=A0H7-eZm4Mg&hd=1

the ffmpeg method only captures the video but no audio. not sure why.

EDIT: looks like i was using the wrong m3u8 file. i used the one from the page source not the network monitor.

chap 03-17-2013 12:37 AM

Re: How to dump youtube live TV stream to file using commandline?


 
try
Code:

ffmpeg -i "bla,bla,bla" -c copy -absf aac_adtstoasc t.mp4

southz 03-21-2013 09:39 AM

Re: How to dump youtube live TV stream to file using commandline?


 
this seems to be a nice Tool. Due to law restrictions in Germany I have to use a proxy for Live Broadcasts. This Proxy uses authentication with username/pw. Using this toll throws "Error downloading webpage: 407 - Proxy Authentication Required". I haven't found any possible way to authenticate in cmd

magichandz 03-21-2013 07:24 PM

Re: How to dump youtube live TV stream to file using commandline?


 
occasionally i get this message using ffmpeg
"skipping 11 segments ahead, expired from playlists"

do anyone know how to get the right m3u8 file so i get all segments in the final video?

magichandz 03-22-2013 09:37 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by southz (Post 60822)
this seems to be a nice Tool. Due to law restrictions in Germany I have to use a proxy for Live Broadcasts. This Proxy uses authentication with username/pw. Using this toll throws "Error downloading webpage: 407 - Proxy Authentication Required". I haven't found any possible way to authenticate in cmd

have you tried "user : pass @ proxyaddress" ?

magichandz 03-22-2013 09:39 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by chap (Post 60683)
try
Code:

ffmpeg -i "bla,bla,bla" -c copy -absf aac_adtstoasc t.mp4

this works for changing containers from ts to mp4 after the fact but capturing on the fly i get mixed results.

southz 03-22-2013 09:24 PM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by magichandz (Post 60856)
have you tried "user : pass @ proxyaddress" ?

yeah.. win won't do this... im tryin this on my debian machine right now.. youtube-dl aborts with ERROR: no conn or url_encoded_fmt_stream_map information found in video info

Quote:

Originally Posted by shell
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/bin/youtube-dl/__main__.py", line 17, in <module>
youtube_dl.main()
File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 514, in main
_real_main()
File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 498, in _real_main
retcode = fd.download(all_urls)
File "/usr/bin/youtube-dl/youtube_dl/FileDownloader.py", line 508, in download
videos = ie.extract(url)
File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 93, in extract
return self._real_extract(url)
File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 560, in _real_extract
self._downloader.trouble(u'ERROR: no conn or url_encoded_fmt_stream_map information found in video info')
File "/usr/bin/youtube-dl/youtube_dl/FileDownloader.py", line 230, in trouble
tb_data = traceback.format_list(traceback.extract_stack())

and this shell script does much other weird stuff:

Quote:

Originally Posted by youtube.sh
decode ()
{
read $1 < <(sed 's % \\\\x g' <<< ${!2} | xargs printf)
}
usage ()
{
echo usage: $0 [ITAG] URL;
exit
}
warn ()
{
printf '\e[36m%s\e[m\n' "$*"
}
printf: fehlender Operand
„printf --help“ gibt weitere Informationen.
/home/southz/youtube.sh: Zeile 65: [: 18: Einstelliger (unärer) Operator erwartet.
/home/southz/youtube.sh: Zeile 83: [: =: Einstelliger (unärer) Operator erwartet.
--2013-03-23 04:21:29-- http://&signature=/
Auflösen des Hostnamen »XXXXXXXXX (XXXXXXXXXX)«... XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX
Verbindungsaufbau zu XXXXXXXXXX (XXXXXXXXXX)|XXXXXXXXXX|:80... verbunden.
Proxy-Anforderung gesendet, warte auf Antwort... 502 Proxy Error
2013-03-23 04:21:32 FEHLER 502: Proxy Error.


doitamd 06-19-2013 10:44 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Hi Elgero,

I just ran into your tool few hours ago and found it very useful.
May I ask you to add one option - your current release exits right away if the live stream is not yet active. Is it possible to add something like 'wait until program starts' command line option, preferably with interval? e.g. "c:\>youtubedl -w 60 -u http://blah.", which means, try to download a program from blah, if the program is not active, wait 60 seconds and retry.
I need this option because I don't want to get stuck in front of my PC to start recording. How's this sound like?


BR

doitamd


Quote:

Originally Posted by Elgero (Post 59172)
Here's a new version.

https://rapidshare.com/files/18912184/YouTubeDL.zip

- Highest quality stream will be downloaded when format argument is omitted.
- Full url must be specified.
- Stream can be redirected to stdout and played with VLC.

I haven't done anything about the live stream getting stuck (yet). I have no idea what youtube-dl does and I'm not going to dig through the source code of youtube-dl or experiment for hours trying to find that out. If somebody can tell me how youtube-dl does it, then I might be able to fix it.

Code:

-u <url>      YouTube url (e.g. http://www.youtube.com/watch?v=HcwTxRuq-uk).
 -l            Lists the available formats for this video.
 -f <number>    Video format to download (see -l).
                Highest quality available will be downloaded when omitted.
 -o <filepath>  FLV output path, if the filepath is - print stream to stdout.
                Video will be downloaded to the same folder as executable and
                YouTube page title will be used as filename when omitted.

Example #1 - List available formats:
  youtubedl -l -u http://www.youtube.com/watch?v=HcwTxRuq-uk

Example #2 - Download to current folder with page title as file name:
  youtubedl -f 34 -u http://www.youtube.com/watch?v=HcwTxRuq-uk

Example #3 - Dowload with path specified:
  youtubedl -f 34 -u http://www.youtube.com/watch?v=HcwTxRuq-uk -o "C:\a.flv"

Example #4 - Print stream to stdout and play in VLC:
  youtubedl -f 34 -u http://www.youtube.com/watch?v=HcwTxRuq-uk -o - | "C:\Program Files\VideoLAN\VLC\vlc.exe" -



Elgero 06-19-2013 08:40 PM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by doitamd (Post 62586)
Hi Elgero,

I just ran into your tool few hours ago and found it very useful.
May I ask you to add one option - your current release exits right away if the live stream is not yet active. Is it possible to add something like 'wait until program starts' command line option, preferably with interval? e.g. "c:\>youtubedl -w 60 -u http://blah.", which means, try to download a program from blah, if the program is not active, wait 60 seconds and retry.
I need this option because I don't want to get stuck in front of my PC to start recording. How's this sound like?


BR

doitamd

Sorry, but I can't add any new options, because I don't have the source code and the compiled executable anymore. There wasn't much interest in the tool, so I deleted everything.

Spinnaker2001 06-22-2013 12:19 PM

Re: How to dump youtube live TV stream to file using commandline?


 
I'm surprised nobody has mentioned the youtube-dl CLI tool. I personally use it on Ubuntu Linux but it also is supported by Windows and OSX, here is a link to their site: http://rg3.github.io/youtube-dl/

Its insanely simply to use, here is a usage example:
In this example, I will use this YouTube video: http://www.youtube.com/watch?v=bV9L5Ht9LgY

Note: For me this downloaded the video's 1080p resolution with h.264/aac codecs (iTag 37 which Ill explain later).

The filename of the video was that of the URL's video, simply bV9L5Ht9LgY.mp4 if you want to download the video with the video's title as the file name simply use this command:

Code:

youtube-dl http://www.youtube.com/watch?v=bV9L5Ht9LgY -o %\(stitle\)s\.%\(ext\)s
The filename that was downloaded was: Download_Youtube_Playlist_with_Youtube-dl.mp4

If you want to specify the resolution or codec type for the video you can easily do so by using the iTag value that YouTube uses. To view a list of the video's iTag values (without downloading the video) use the -F flag in the command:
Code:

youtube-dl -F http://www.youtube.com/watch?v=bV9L5Ht9LgY -o %\(stitle\)s\.%\(ext\)s
The result will look as such:
Code:

[youtube] Setting language
[youtube] bV9L5Ht9LgY: Downloading video webpage
[youtube] bV9L5Ht9LgY: Downloading video info webpage
[youtube] bV9L5Ht9LgY: Extracting video information
Available formats:
37        :        mp4        [1080x1920]
46        :        webm        [1080x1920]
22        :        mp4        [720x1280]
45        :        webm        [720x1280]
35        :        flv        [480x854]
34        :        flv        [360x640]
18        :        mp4        [360x640]
43        :        webm        [360x640]
5        :        flv        [240x400]
17        :        mp4        [144x176]

Since I'm a geek for mp4 I'm going to go with the the 37 iTag value and use the video's title as its' file name:
Code:

youtube-dl -f 37 http://www.youtube.com/watch?v=bV9L5Ht9LgY -o %\(stitle\)s\.%\(ext\)s
If your curious, all of YouTube's iTag values are listed here: http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs

Lastly, this awesome tool is not limited to just YouTube. It also works on a list of other sites like Vimeo, DailyMotion, DepositFiles, CollegeHumor, etc etc. A list of all sites this works with is available here: http://rg3.github.io/youtube-dl/documentation.html#d4

magichandz 09-27-2013 06:20 PM

Re: How to dump youtube live TV stream to file using commandline?


 
trying to download live stream
http://www.youtube.com/watch?v=Bht5_9sUg3k&hd=1

seems youtube has changed the url format. ffmpeg method not working like before. getting a 403 error.

Code:

ffmpeg -i "http://www.youtube.com/api/manifest/hls_playlist/id/Bht5_9sUg3k.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/hls_chunk_host/www.youtube.com/gir/yes/dg_shard/Bht5_9sUg3k.1_95/cp/U0hXRVNQT19NSkNON19LSlNEOk9MNkh6Z0xWUDZz/pmbypass/yes/playlist_type/DVR/maudio/1/upn/AtW_LbeiVCA/sver/3/fexp/926400,906946,932242,916807,916625,929305,924606,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,929933,929935,929937,929939,939602,939604,937102,906842,913428,912715,919811,932309,913563,919373,930803,908536,908538,938701,931924,940501,936308,909549,900816,912711,934507,907231,936312,906001/cpn/RKjJU5hq-RpziBMV/ip/174.109.39.220/ipbits/8/expire/1380351380/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,cp,pmbypass,playlist_type,maudio/signature/18FFB16ACCD670DD64CC90D58AEFC0EB61CD5750.1E71A2A68A0EE0A09E64B21F2522D00860DCC20B/key/dg_yt0/file/index.m3u8?start_seq=967" -c copy stream3.ts
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on May 20 2013 05:39:32 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      52. 18.100 / 52. 18.100
  libavcodec    54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter    3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample  0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[http @ 0x102013a00] HTTP error 403 Forbidden
[hls,applehttp @ 0x10202a000] Error when loading first segment 'http://www.youtube.com/videoplayback/id/Bht5_9sUg3k.1/itag/95/source/yt_live_broadcast/sq/967/file/seg.ts?ratebypass=yes&cmbypass=yes&newshard=yes&hls_chunk_host=www.youtube.com&gir=yes&dg_shard=Bht5_9sUg3k.1_95&cp=U0hXRVNQT19NSkNON19LSlNEOk9MNkh6Z0xWUDZz&pmbypass=yes&playlist_type=DVR&maudio=1&upn=AtW_LbeiVCA&sver=3&fexp=926400,906946,932242,916807,916625,929305,924606,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,929933,929935,929937,929939,939602,939604,937102,906842,913428,912715,919811,932309,913563,919373,930803,908536,908538,938701,931924,940501,936308,909549,900816,912711,934507,907231,936312,906001&cpn=RKjJU5hq-RpziBMV&ip=174.109.39.220&ipbits=8&expire=1380351380&sparams=ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,cp,pmbypass,playlist_type,maudio&signature=18FFB16ACCD670DD64CC90D58AEFC0EB61CD5750.1E71A2A68A0EE0A09E64Bhttp://www.youtube.com/api/manifest/hls_playlist/id/Bht5_9sUg3k.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/hls_chunk_host/www.youtube.com/gir/yes/dg_shard/Bht5_9sUg3k.1_95/cp/U0hXRVNQT19NSkNON19LSlNEOk9MNkh6Z0xWUDZz/pmbypass/yes/playlist_type/DVR/maudio/1/upn/AtW_LbeiVCA/sver/3/fexp/926400,906946,932242,916807,916625,929305,924606,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,929933,929935,929937,929939,939602,939604,937102,906842,913428,912715,919811,932309,913563,919373,930803,908536,908538,938701,931924,940501,936308,909549,900816,912711,934507,907231,936312,906001/cpn/RKjJU5hq-RpziBMV/ip/174.109.39.220/ipbits/8/expire/1380351380/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,cp,pmbypass,playlist_type,maudio/signature/18FFB16ACCD670DD64CC90D58AEFC0EB61CD5750.1E71A2A68A0EE0A09E64B21F2522D00860DCC20B/key/dg_yt0/fil


chap 09-27-2013 11:10 PM

Re: How to dump youtube live TV stream to file using commandline?


 
use latest ffmpeg

fix
http://trac.ffmpeg.org/ticket/2976

REACH 09-29-2013 03:08 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Thanks

magichandz 09-30-2013 12:23 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by chap (Post 63467)

updated to latest ffmpeg. still getting 403 error.
http://www.youtube.com/watch?v=8sdLAHzZVMc&hd=1

tried using chrome network monitor to get m3u8 and get this

Code:

$ ffmpeg -i "http://www.youtube.com/api/manifest/hls_playlist/id/8sdLAHzZVMc.1/itag/95/source/yt_liyes/live/1/cmbypass/yes/newshard/yes/hls_chunk_host/www.youtube.com/gir/yes/dg_shard/8sdLAHzZVMc.1_95/playlist_type/DVR/cp/U0hXRVVPVV9LU0NON19NSVlGOkVCdE1XU0VHT0hK/pmbypass/yes/maudio/1/fexp/901482,938610,900376,916611,929305,939104,924606,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,906945,929933,929935,929937,929939,939602,939604,937102,906842,913428,920605,912715,919811,932309,913563,919373,930803,908536,938701,931924,940501,936308,909549,935006,900816,912711,900378,934507,907231,936312,906001/upn/NrvSS41mV1o/sver/3/cpn/88jOG8SdQIl5HPFH/ip/{my-ip}/ipbits/8/expire/1380547569/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,playlist_type,cp,pmbypass,maudio/signature/3B48DEFBA1CB95A7DEE2E1FB81A60AB9CB642012.8A6432A4E596019E09AA24BF7D74CBA1EDBD3E25/key/dg_yt0/file/index.m3u8?start_seq=5384" -c copy stream.ts
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 25 2013 06:03:35 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      52. 38.100 / 52. 38.100
  libavcodec    55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter    3. 79.101 /  3. 79.101
  libavresample  1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample  0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[http @ 0x7fdbb2830200] HTTP error 403 Forbidden
[hls,applehttp @ 0x7fdbb2813000] Error when loading first segment 'http://www.youtube.com/videoplayback/id/8sdLAHzZVMc.1/itag/95/source/yt_live_broadcast/sq/5384/file/seg.ts?ratebypass=yes&cmbypass=yes&newshard=yes&hls_chunk_host=www.youtube.com&gir=yes&dg_shard=8sdLAHzZVMc.1_95&playlist_type=DVR&cp=U0hXRVVPVV9LU0NON19NSVlGOkVCdE1XU0VHT0hK&pmbypass=yes&maudio=1&fexp=901482,938610,900376,916611,929305,939104,924606,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,906945,929933,929935,929937,929939,939602,939604,937102,906842,913428,920605,912715,919811,932309,913563,919373,930803,908536,938701,931924,940501,936308,909549,935006,900816,912711,900378,934507,907231,936312,906001&upn=NrvSS41mV1o&sver=3&cpn=88jOG8SdQIl5HPFH&ip={my-ip}&ipbits=8&expire=1380547569&sparams=ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,playlist_type,cp,pmbypass,maudio&signature=3B48DEFBA1CB95A7DEE2E1FB81A60AB9CB642012http://www.youtube.com/api/manifest/hls_playlist/id/8sdLAHzZVMc.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/hls_chunk_host/www.youtube.com/gir/yes/dg_shard/8sdLAHzZVMc.1_95/playlist_type/DVR/cp/U0hXRVVPVV9LU0NON19NSVlGOkVCdE1XU0VHT0hK/pmbypass/yes/maudio/1/fexp/901482,938610,900376,916611,929305,939104,924606,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,906945,929933,929935,929937,929939,939602,939604,937102,906842,913428,920605,912715,919811,932309,913563,919373,930803,908536,938701,931924,940501,936308,909549,935006,900816,912711,900378,934507,907231,936312,906001/upn/NrvSS41mV1o/sver/3/cpn/88jOG8SdQIl5HPFH/ip/{my-ip}/ipbits/8/expire/1380547569/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,playlist_type,cp,pmbypass,maudio/signature/3B48DEFBA1CB95A7DEE2E1FB81A60AB9CB642012.8A6432A4E596019E09AA24BF7D74CBA1ED


lesor 09-30-2013 02:31 AM

Re: How to dump youtube live TV stream to file using commandline?


 
See this video

magichandz 10-06-2013 02:15 PM

Re: How to dump youtube live TV stream to file using commandline?


 
Quote:

Originally Posted by lesor (Post 63489)

thanks a lot for this lesor. i tried opening the m3u8 file and picking the right url but i still get a 403 error. the problem must be my version of ffmpeg.

i updated mine via mac ports. not sure which version it gave me. probably the latest stable release 2.0.1. might have to try N-56704-g3e0c78b

http://www.youtube.com/watch?v=NUhD8EJApAs

Code:

ffmpeg -i "http://www.youtube.com/api/manifest/hls_playlist/id/NUhD8EJApAs.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/hls_chunk_host/www.youtube.com/gir/yes/dg_shard/NUhD8EJApAs.1_95/maudio/1/playlist_type/DVR/pmbypass/yes/cp/U0hXRlFMTl9JS0NON19JRlJHOjJJMWtINjJmcXVC/sver/3/upn/36S79ghugfs/fexp/926404,919813,910207,923500,924606,924616,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,906945,929933,929935,929937,929939,939602,939604,912909,937102,906842,913428,920605,912715,919811,939908,935704,932309,913563,919373,930803,908538,932211,934003,934004,931924,938608,940501,936308,939201,900816,912711,916304,900391,934507,907231,936312,906001/cpn/tDrvnVYNynJg2eWd/ip/{my-ip}/ipbits/8/expire/1381110641/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,maudio,playlist_type,pmbypass,cp/signature/7A1ABD0771F989C664A07354F48EAD17F17AF8DF.792C1864CCB5BDFBD85DE96833D09B12EAB0122C/key/dg_yt0/file/index.m3u8" -c copy out.ts
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 25 2013 06:03:35 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      52. 38.100 / 52. 38.100
  libavcodec    55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter    3. 79.101 /  3. 79.101
  libavresample  1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample  0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[http @ 0x7f93941e3c00] HTTP error 403 Forbidden
[hls,applehttp @ 0x7f9394013000] Error when loading first segment 'http://www.youtube.com/videoplayback/id/NUhD8EJApAs.1/itag/95/source/yt_live_broadcast/sq/0/file/seg.ts?ratebypass=yes&cmbypass=yes&newshard=yes&hls_chunk_host=www.youtube.com&gir=yes&dg_shard=NUhD8EJApAs.1_95&maudio=1&playlist_type=DVR&pmbypass=yes&cp=U0hXRlFMTl9JS0NON19JRlJHOjJJMWtINjJmcXVC&sver=3&upn=36S79ghugfs&fexp=926404,919813,910207,923500,924606,924616,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,906945,929933,929935,929937,929939,939602,939604,912909,937102,906842,913428,920605,912715,919811,939908,935704,932309,913563,919373,930803,908538,932211,934003,934004,931924,938608,940501,936308,939201,900816,912711,916304,900391,934507,907231,936312,906001&cpn=tDrvnVYNynJg2eWd&ip={my-ip}&ipbits=8&expire=1381110641&sparams=ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,maudio,playlist_type,pmbypass,cp&signature=7A1ABD07http://www.youtube.com/api/manifest/hls_playlist/id/NUhD8EJApAs.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/hls_chunk_host/www.youtube.com/gir/yes/dg_shard/NUhD8EJApAs.1_95/maudio/1/playlist_type/DVR/pmbypass/yes/cp/U0hXRlFMTl9JS0NON19JRlJHOjJJMWtINjJmcXVC/sver/3/upn/36S79ghugfs/fexp/926404,919813,910207,923500,924606,924616,916914,929117,929121,929906,929907,929922,929923,929127,929129,929131,929930,936403,925724,925726,936310,925720,925722,925718,936401,925714,929917,906945,929933,929935,929937,929939,939602,939604,912909,937102,906842,913428,920605,912715,919811,939908,935704,932309,913563,919373,930803,908538,932211,934003,934004,931924,938608,940501,936308,939201,900816,912711,916304,900391,934507,907231,936312,906001/cpn/tDrvnVYNynJg2eWd/ip/{my-ip}/ipbits/8/expire/1381110641/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cmbypass,newshard,hls_chunk_host,gir,dg_shard,maudio,playlist_type,pmbypass,cp/signature/7A1ABD0771F989C664A07354F48EAD17F17AF8DF


magichandz 03-28-2014 06:00 PM

Re: How to dump youtube live TV stream to file using commandline?


 
i'm recording again this year.
http://www.youtube.com/watch?v=MF0UNmHzu5Y&hd=1

after about an hour the stream disconnects. anyone have any ideas why? i restart it with the same m3u8 file and it starts downloading again. since it does that i don't think the m3u8 is the problem. i get it straight out of the page source not using developer tools or firebug.

is there some script i could write to tell ffmpeg to execute the command again if the stream disconnects?

Quote:

ffmpeg -i "http://www.youtube.com/api/manifest/hls_playlist/id/MF0UNmHzu5Y.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/gir/yes/dg_shard/MF0UNmHzu5Y.1_95/hls_chunk_host/www.youtube.com/maudio/1/pmbypass/yes/playlist_type/LIVE/gcr/us/fexp/906373,931946,938647,914089,937417,913434,936910,9 36913,934022/sver/3/upn/ijUA-7cc8gI/ip/{my-ip}/ipbits/0/expire/1396073058/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cm bypass,newshard,gir,dg_shard,hls_chunk_host,maudio ,pmbypass,playlist_type,gcr/signature/14C8FBE4DEB9D29DB85FC0AE6A552445526A13B8.8F86EAC08 60F4D4591799128175A839A572793DB/key/dg_yt0/file/index.m3u8" -c copy ultra02.ts
ffmpeg version 2.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 25 2014 08:36:03 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-vda --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
[hls,applehttp @ 0x7fd0d5000600] Estimating duration from bitrate, this may be inaccurate
Input #0, hls,applehttp, from 'http://www.youtube.com/api/manifest/hls_playlist/id/MF0UNmHzu5Y.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/gir/yes/dg_shard/MF0UNmHzu5Y.1_95/hls_chunk_host/www.youtube.com/maudio/1/pmbypass/yes/playlist_type/LIVE/gcr/us/fexp/906373,931946,938647,914089,937417,913434,936910,9 36913,934022/sver/3/upn/ijUA-7cc8gI/ip/{my-ip}/ipbits/0/expire/1396073058/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cm bypass,newshard,gir,dg_shard,hls_chunk_host,maudio ,pmbypass,playlist_type,gcr/signature/14C8FBE4DEB9D29DB85FC0AE6A552445526A13B8.8F86EAC08 60F4D4591799128175A839A572793DB/key/dg_yt0/file/index.m3u8':
Duration: 00:00:00.12, start: 1815.000000, bitrate: 233 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 256 kb/s
Output #0, mpegts, to 'ultra02.ts':
Metadata:
encoder : Lavf55.33.100
Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 90k tbn, 25 tbc
Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, 256 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[tcp @ 0x7fd0d3e05760] Failed to resolve hostname www.youtube.com: nodename nor servname provided, or not known
[tcp @ 0x7fd0d3c00f20] Failed to resolve hostname www.youtube.com: nodename nor servname provided, or not known

frame=49250 fps= 25 q=-1.0 Lsize= 644339kB time=00:32:50.01 bitrate=2679.4kbits/s
video:528667kB audio:61563kB subtitle:0 data:0 global headers:0kB muxing overhead 9.167596%

$ ffmpeg -i "http://www.youtube.com/api/manifest/hls_playlist/id/MF0UNmHzu5Y.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/gir/yes/dg_shard/MF0UNmHzu5Y.1_95/hls_chunk_host/www.youtube.com/maudio/1/pmbypass/yes/playlist_type/LIVE/gcr/us/fexp/906373,931946,938647,914089,937417,913434,936910,9 36913,934022/sver/3/upn/ijUA-7cc8gI/ip/{my-ip}/ipbits/0/expire/1396073058/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cm bypass,newshard,gir,dg_shard,hls_chunk_host,maudio ,pmbypass,playlist_type,gcr/signature/14C8FBE4DEB9D29DB85FC0AE6A552445526A13B8.8F86EAC08 60F4D4591799128175A839A572793DB/key/dg_yt0/file/index.m3u8" -c copy ultra03.ts
ffmpeg version 2.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 25 2014 08:36:03 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-vda --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
[hls,applehttp @ 0x7f900381b400] Estimating duration from bitrate, this may be inaccurate
Input #0, hls,applehttp, from 'http://www.youtube.com/api/manifest/hls_playlist/id/MF0UNmHzu5Y.1/itag/95/source/yt_live_broadcast/ratebypass/yes/live/1/cmbypass/yes/newshard/yes/gir/yes/dg_shard/MF0UNmHzu5Y.1_95/hls_chunk_host/www.youtube.com/maudio/1/pmbypass/yes/playlist_type/LIVE/gcr/us/fexp/906373,931946,938647,914089,937417,913434,936910,9 36913,934022/sver/3/upn/ijUA-7cc8gI/ip/{my-ip}/ipbits/0/expire/1396073058/sparams/ip,ipbits,expire,id,itag,source,ratebypass,live,cm bypass,newshard,gir,dg_shard,hls_chunk_host,maudio ,pmbypass,playlist_type,gcr/signature/14C8FBE4DEB9D29DB85FC0AE6A552445526A13B8.8F86EAC08 60F4D4591799128175A839A572793DB/key/dg_yt0/file/index.m3u8':
Duration: 00:00:00.13, start: 4120.000000, bitrate: 225 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 251 kb/s
Output #0, mpegts, to 'ultra03.ts':
Metadata:
encoder : Lavf55.33.100
Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 90k tbn, 25 tbc
Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, 251 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=20179 fps= 25 q=-1.0 size= 264446kB time=00:13:27.16 bitrate=2683.9kbits/s

sebastian 06-21-2014 04:11 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Got a short question. Am using this command to dump livestreams, e.g. https://www.youtube.com/watch?v=L4n4O_mGBh0
Code:

ffmpeg -i “http://streamlocation.m3u8″ -c copy c:\FileName.ts
That works, but is there a way to tell ffmpeg to start downloading from first segment? The youtube livestream itself is seekable.

Best
Sebastian

sebastian 06-22-2014 04:14 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Hmm, there should be some "start with segment #0" switch or something like that in ffmpeg, but I can't find it...


All times are GMT -6. The time now is 07:04 AM.