下载m3u8视频

分两种情况

同时支持m3u8和mp4文件

某些视频同时支持m3u8和mp4视频文件,将m3u8改成mp4后直接:

wget -c http://www.xxx.com/xxxx.mp4

只有m3u8视频列表

可以用ffmpeg下载合并成mp4文件

ffmpeg -i "m3u8列表url" -c copy "存储视频名字.mp4"

其中-i表示输入,-c copy表示和源视频采用相同的音视频编码

样例:

➜  ~ ffmpeg -i "http://vod.mudu.tv/media-join-slice/9592hz24y6zqcqm54qncz3osv.m3u8" -c copy "深度学习服务器配置.mp4"
ffmpeg version 3.3.4-2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.2.0-8ubuntu2)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/162.ts' for reading
Input #0, hls,applehttp, from 'http://vod.mudu.tv/media-join-slice/9592hz24y6zqcqm54qncz3osv.m3u8':
  Duration: 01:13:36.83, start: 1972.540522, bitrate: 0 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 852x480, 30 tbr, 90k tbn, 60 tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Output #0, mp4, to '深度学习服务器配置.mp4':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p, 852x480, q=2-31, 30 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/163.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/164.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/165.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/166.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/167.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/168.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/169.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/170.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/171.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/172.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/173.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/174.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/175.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/176.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/177.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/178.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/179.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/180.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/181.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/182.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/183.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/184.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/185.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/186.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/187.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/188.ts' for reading
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/189.ts' for reading
......
[hls,applehttp @ 0x5594afe3b880] Opening 'http://vod.mudu.tv/watch/2018-07-25/g3ov35/429.ts' for reading
frame=132505 fps=669 q=-1.0 Lsize= 1434228kB time=01:13:36.82 bitrate=2660.1kbits/s speed=22.3x    
video:1348706kB audio:80736kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.334827%

你可能感兴趣的:(下载m3u8视频)