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)

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 06:45 AM.