[FFmpeg-user] How To Play YouTube Videos using FFPLAy

DopeLabs dopelabs at dubstep.fm
Mon Dec 1 00:40:11 CET 2014


what i usually end up doing is using youtube-dl to get the video url from youtube.

$ youtube-dl -g https://www.youtube.com/watch?v=holhZM1OpTc
https://r8---sn-nwj7kner.googlevideo.com/videoplayback?dur=4689.432&mt=1417390187&initcwndbps=2077500&mv=m&source=youtube&ms=au&signature=8251E2C2D0813F619782BDD5A767CCEFE1F144AC.E1956AB637C7AC0211C0AC7BAAE318116620E738&ip=50.184.214.146&requiressl=yes&mm=31&upn=YG7nlv8UQUo&id=o-AFY1_oJik-NbZym162NV-c1Y6jaVM06NRHQfTjBRSb91&expire=1417411857&key=yt5&ipbits=0&sver=3&gcr=us&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Crequiressl%2Csource%2Cupn%2Cexpire&fexp=907259%2C927622%2C931942%2C932404%2C943909%2C945908%2C947209%2C948124%2C948703%2C948802%2C952302%2C952605%2C952901%2C953912%2C957103%2C957105%2C957201%2C958608&itag=22&ratebypass=yes


use the returned url with ffmpeg/ffplay/ffprobe


$ ffprobe -i "https://r8---sn-nwj7kner.googlevideo.com/videoplayback?dur=4689.432&mt=1417390187&initcwndbps=2077500&mv=m&source=youtube&ms=au&signature=8251E2C2D0813F619782BDD5A767CCEFE1F144AC.E1956AB637C7AC0211C0AC7BAAE318116620E738&ip=50.184.214.146&requiressl=yes&mm=31&upn=YG7nlv8UQUo&id=o-AFY1_oJik-NbZym162NV-c1Y6jaVM06NRHQfTjBRSb91&expire=1417411857&key=yt5&ipbits=0&sver=3&gcr=us&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Crequiressl%2Csource%2Cupn%2Cexpire&fexp=907259%2C927622%2C931942%2C932404%2C943909%2C945908%2C947209%2C948124%2C948703%2C948802%2C952302%2C952605%2C952901%2C953912%2C957103%2C957105%2C957201%2C958608&itag=22&ratebypass=yes"
ffprobe version 2.4.3 Copyright (c) 2007-2014 the FFmpeg developers
  built on Nov 15 2014 21:12:17 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  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-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --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      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r8---sn-nwj7kner.googlevideo.com/videoplayback?dur=4689.432&mt=1417390187&initcwndbps=2077500&mv=m&source=youtube&ms=au&signature=8251E2C2D0813F619782BDD5A767CCEFE1F144AC.E1956AB637C7AC0211C0AC7BAAE318116620E738&ip=50.184.214.146&requiressl=yes&mm=31&upn=YG7nlv8UQUo&id=o-AFY1_oJik-NbZym162NV-c1Y6jaVM06NRHQfTjBRSb91&expire=1417411857&key=yt5&ipbits=0&sver=3&gcr=us&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Crequiressl%2Csource%2Cupn%2Cexpire&fexp=907259%2C927622%2C931942%2C932404%2C943909%2C945908%2C947209%2C948124%2C948703%2C948802%2C952302%2C952605%2C952901%2C953912%2C957103%2C957105%2C957201%2C958608&itag=22&ratebypass=yes':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2014-11-30 21:25:22
  Duration: 01:18:09.39, start: 0.000000, bitrate: 2915 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2721 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      creation_time   : 2014-11-30 21:26:39
      handler_name    : IsoMedia File Produced by Google, 5-11-2011 


weeeee

> On Nov 30, 2014, at 3:27 PM, Moritz Barsnick <barsnick at gmx.net> wrote:
> 
> On Sun, Nov 30, 2014 at 20:20:59 +0100, Clément Bœsch wrote:
>> Note: I'm curious about the outcome of this nowadays since libquvi seems
>> discontinued. We might want to check if youtube-dl provides a maintained
>> alternative.
> 
> Ah, indeed, it seems there hasn't been any visible work on quvi in the
> last 12 months.
> 
> What's more, ffmpeg only supports the libquvi-0.4 API (0.9 is the
> upstream branch that was last maintained), as you, Clément, already
> pointed out a few months ago:
> 
> https://ffmpeg.org/pipermail/ffmpeg-user/2014-June/022140.html
> 
> Just the for fun of it, I rebuilt ffmpeg against libquvi-0.4.1 on my
> ancient system. I wanted to see whether the old libquvi still manages
> to parse YouTube or Vimeo correctly, as I have my doubts, due to it
> being a moving target. Result: libquvi can't parse Vimeo, and YouTube
> unfortunately segfaults.
> 
> I use the excellently maintained youtube-dl script as a replacement,
> but it means you need intermediate storage. A bridge to ffmpeg would be
> nice...
> 
> Moritz
> 
> P.S.: The quvi 0.4.1 command line tool still presents me a useful video
> URL for most videos. Use
> $ quvi https://www.youtube.com/watch?v=PjIV2OFoSXs
> ("Melissa Horn - Jag saknar dig mindre och mindre" BTW)
> then grep the URL out of the "url : " line, and pass that to ffmpeg:
> 
> barsnick at sunshine:/usr/new/tools/video/ffmpeg > ./ffmpeg-build/ffmpeg_g -i "http://r5---sn-4g57kn7d.googlevideo.com/videoplayback?nh=IgpwcjAzLmZyYTAzKgkxMjcuMC4wLjE&ipbits=0&fexp=900147%2C907259%2C927622%2C932404%2C943909%2C947209%2C948124%2C952302%2C952605%2C952901%2C953912%2C957103%2C957105%2C957201&initcwndbps=1187500&upn=L1Hv0AJzrnE&id=o-AGwgxsR3hRn_2N7Ix492ET3fteWQNnc4hEHwqWudkiL8&expire=1417410911&mm=31&signature=5C8005558FA27B8678DBC1660D8BE3D8D3B69676.3AE8B68FB4E5C81DE1A85DAA8323542B8EABED4C&ms=au&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Cnh%2Csource%2Cupn%2Cexpire&source=youtube&sver=3&mv=m&dur=296.658&itag=22&key=yt5&ip=217.224.70.136&mt=1417389249"
> ffmpeg version 2.4.git Copyright (c) 2000-2014 the FFmpeg developers
>  built on Nov 30 2014 23:33:18 with icc (ICC) 14.0.3 20140422
>  configuration: --prefix=/usr/new/tools/video/install/ffmpeg/20141130 --enable-gpl --enable-version3 --enable-nonfree --disable-shared --enable-libxcb --enable-gnutls --enable-libcdio --enable-libfreetype --enable-libx264 --enable-libmp3lame --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libass --enable-libv4l2 --enable-libvidstab --enable-libfdk-aac --enable-libsmbclient --enable-libquvi --cc=icc --cxx=icpc --extra-ldflags='-L/usr/new/tools/video/install/x264/current/lib -L/usr/new/tools/video/install/fdk-aac/current/lib' --extra-cflags='-I/usr/new/tools/video/install/x264/current/include -I/usr/new/tools/video/install/fdk-aac/current/include'
>  libavutil      54. 15.100 / 54. 15.100
>  libavcodec     56. 13.100 / 56. 13.100
>  libavformat    56. 15.101 / 56. 15.101
>  libavdevice    56.  3.100 / 56.  3.100
>  libavfilter     5.  2.103 /  5.  2.103
>  libswscale      3.  1.101 /  3.  1.101
>  libswresample   1.  1.100 /  1.  1.100
>  libpostproc    53.  3.100 / 53.  3.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://r5---sn-4g57kn7d.googlevideo.com/videoplayback?nh=IgpwcjAzLmZyYTAzKgkxMjcuMC4wLjE&ipbits=0&fexp=900147%2C907259%2C927622%2C932404%2C943909%2C947209%2C948124%2C952302%2C952605%2C952901%2C953912%2C957103%2C957105%2C957201&initcwndbps=1187500&upn=L1Hv0AJzrnE&id=o-AGwgxsR3hRn_2N7Ix492ET3fteWQNnc4hEHwqWudkiL8&expire=1417410911&mm=31&signature=5C8005558FA27B8678DBC1660D8BE3D8D3B69676.3AE8B68FB4E5C81DE1A85DAA8323542B8EABED4C&ms=au&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Cnh%2Csource%2Cupn%2Cexpire&source=youtube&sver=3&mv=m&dur=296.658&itag=22&key=yt5&ip=217.224.70.136&mt=1417389249':
>  Metadata:
>    major_brand     : mp42
>    minor_version   : 0
>    compatible_brands: isommp42
>    creation_time   : 2014-03-07 09:58:01
>  Duration: 00:04:56.61, start: 0.000000, bitrate: 1659 kb/s
>    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1465 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
>    Metadata:
>      handler_name    : VideoHandler
>    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default)
>    Metadata:
>      creation_time   : 2014-03-07 09:58:02
>      handler_name    : IsoMedia File Produced by Google, 5-11-2011
> At least one output file must be specified
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list