简体   繁体   English

从网页下载 m3u8 视频

[英]Download m3u8 video from a webpage

I want to download a video from a webpage.我想从网页下载视频。 I found the m3u8 file and got the link, using them in FFmpeg, finally got something wrong.我找到了m3u8文件并得到了链接,在FFmpeg中使用它们,终于出错了。

Here is the capture of the beginning of the m3u8 file.这是 m3u8 文件开头的捕获。

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:13
#EXTINF:10.080000,
https://ddcdn.jd.com/ddimg/jfs/t1/203028/24/17499/1876858/61a85ec0Ef32e255f/289bf6dd94343ed0.bmp
#EXTINF:10.000000,
https://ddcdn.jd.com/ddimg/jfs/t1/140366/35/22093/1147042/61a85ec0E850c8c8e/30b8a5e3032486ea.bmp
#EXTINF:10.000000,
https://ddcdn.jd.com/ddimg/jfs/t1/213475/10/6333/1554250/61a85ec0Ecc4703c3/39107a4d803fc188.bmp
#EXTINF:8.040000,
https://ddcdn.jd.com/ddimg/jfs/t1/205672/5/17259/1669682/61a85ec0Eff60ae58/fca014f8ef9bdcdc.bmp
#EXTINF:10.000000,
https://ddcdn.jd.com/ddimg/jfs/t1/217728/38/6334/1906374/61a85ec0Eeaf23ef5/d9ec645ad064f527.bmp

Here is what I input and output in the cmd.这是我在 cmd 中输入的内容和 output。

Input

ffmpeg -i "https://hls.kmzhiqing.com/hls/m3u8/1452590c00595055de5750d1595519554f525372617d0d4061.m3u8" 1.mp4
Output

ffmpeg version N-100036-g3de3d2f5e2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3-win32 (GCC) 20200320
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-opencl --enable-libvmaf --enable-vulkan --enable-libvorbis --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.113.100 / 58.113.100
  libavformat    58. 64.100 / 58. 64.100
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7. 90.100 /  7. 90.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[hls @ 000001d87d857740] Skip ('#EXT-X-VERSION:3')
[hls @ 000001d87d857740] Skip ('#EXT-X-ALLOW-CACHE:YES')
[hls @ 000001d87d857740] Opening 'https://ddcdn.jd.com/ddimg/jfs/t1/203028/24/17499/1876858/61a85ec0Ef32e255f/289bf6dd94343ed0.bmp' for reading
[hls @ 000001d87d857740] Opening 'https://ddcdn.jd.com/ddimg/jfs/t1/140366/35/22093/1147042/61a85ec0E850c8c8e/30b8a5e3032486ea.bmp' for reading
[hls @ 000001d87d857740] Could not find codec parameters for stream 0 (Video: bmp, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, hls, from 'https://hls.kmzhiqing.com/hls/m3u8/1452590c00595055de5750d1595519554f525372617d0d4061.m3u8':
  Duration: 00:24:24.60, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: bmp, none, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      variant_bitrate : 0
Output #0, mp4, to '1.mp4':
Output file #0 does not contain any stream

I found that the the link in the m3u8 file is a bmp file instead of mp4.我发现m3u8文件中的链接是bmp文件而不是mp4。

Does it matter????有关系吗???? Can anyone tell me how to download the mp4 video file?谁能告诉我如何下载 mp4 视频文件?

Thank you for reading this!谢谢您阅读此篇!

Here try this:在这里试试这个:

-$ ffmpeg -i <http://url/.m3u8> -c copy -bsf:a aac_adtstoasc video_name.mp4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM