ffmpeg - 如何处理flowplayer使用的.ts文件?

标签 ffmpeg flowplayer mpeg2-ts

Flowplay似乎被jove.com使用

https://www.jove.com/video/59612/3d-kinematic-gait-analysis-for-preclinical-studies-in-rodents

以上面的 URL 为例,它会使用这样的 .ts 文件(通过 Google Chrome devtools)

https://cloudflare2.jove.com/CDNSource/hls/59612/59612_3.ts

但我不确定如何使 .ts 文件在本地可见。

https://askubuntu.com/questions/3645/how-do-i-convert-ts-files-into-something-useful

我尝试过这样的事情。但我总是出错。

$ ffmpeg -i 50191_1.ts -c:v libx264 -crf 0 -c:a copy output.mp4
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
50191_1.ts: Invalid data found when processing input

有人知道如何转换 .ts 文件吗?

编辑:我得到了这样的东西。
$ cat 59612_.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:17
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=AES-128,URI="https://cloudflare2.jove.com/CDNSource/hls/59612/59612.key"
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_0.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_1.ts
#EXTINF:6.606600,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_2.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_3.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_4.ts
#EXTINF:10.877533,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_5.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_6.ts
#EXTINF:7.907900,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_7.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_8.ts
#EXTINF:10.910900,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_9.ts
#EXTINF:9.676333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_10.ts
#EXTINF:8.375033,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_11.ts
#EXTINF:12.645967,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_12.ts
#EXTINF:13.146467,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_13.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_14.ts
#EXTINF:6.840167,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_15.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_16.ts
#EXTINF:10.877533,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_17.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_18.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_19.ts
#EXTINF:6.706700,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_20.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_21.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_22.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_23.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_24.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_25.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_26.ts
#EXTINF:16.649967,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_27.ts
#EXTINF:8.308300,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_28.ts
#EXTINF:8.308300,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_29.ts
#EXTINF:5.672333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_30.ts
#EXTINF:10.677333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_31.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_32.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_33.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_34.ts
#EXTINF:7.507500,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_35.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_36.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_37.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_38.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_39.ts
#EXTINF:7.273933,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_40.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_41.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_42.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_43.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_44.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_45.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_46.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_47.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_48.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_49.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_50.ts
#EXTINF:16.683333,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_51.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_52.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_53.ts
#EXTINF:13.079733,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_54.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_55.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_56.ts
#EXTINF:13.113100,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_57.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_58.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_59.ts
#EXTINF:8.341667,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_60.ts
#EXTINF:6.573233,
https://cloudflare2.jove.com/CDNSource/hls/59612/59612_61.ts
#EXT-X-ENDLIST

最佳答案

#EXT-X-KEY:METHOD=AES-128,URI="https://cloudflare2.jove.com/CDNSource/hls/59612/59612.key"



此 HLS 视频流已加密。 AES-128 不是 DRM,因此可以使用存在的 key 对其进行解密。

HLS 视频流

简单的方法是使用 FFmpeg(它会自动解密)打开 HLS 视频流并剪切所需的片段:
ffmpeg -ss 32 -i https://cloudflare2.jove.com/CDNSource/hls/59612/59612_.m3u8 -t 17 -c copy output.mp4
  • -ss 32 : 跳到 32 秒。
  • -t 17 :将持续时间设置为 17 秒。
  • -c copy :执行流复制(不损失质量)。

  • 个别分割市场

    这需要您自己解密该段。

    当您下载解密 key 59612.key ,你会看到很多乱码:Aæª~ý÷øŽ©ýÛO®ø .
    您必须将其转换为十六进制二进制表示。这可以通过 hexdump 来完成...
    curl -s https://cloudflare2.jove.com/CDNSource/hls/59612/59612.key | hexdump -e '16/1 "%02x"
    41e61c18aa7efdf7f88ea9fddb4faef8
    

    ...或使用我最喜欢的工具之一, xidel :
    xidel -s https://cloudflare2.jove.com/CDNSource/hls/59612/59612.key -e 'x:string-to-hexBinary($raw)'
    41E61C18AA7EFDF7F88EA9FDDB4FAEF8
    

    接下来,您可以使用 ffmpeg 解密第 60 段(例如) :
    ffmpeg \
    -key 41E61C18AA7EFDF7F88EA9FDDB4FAEF8 \
    -iv 0000000000000000000000000000003C \
    -i crypto:https://cloudflare2.jove.com/CDNSource/hls/59612/59612_60.ts \
    -c copy \
    output.mp4
    
  • -iv 0000000000000000000000000000003C : 60 (十进制)= 3C (十六进制)。

  • ...或与 openssl :
    openssl \
    aes-128-cbc \
    -in <(curl -s https://cloudflare2.jove.com/CDNSource/hls/59612/59612_60.ts) \
    -out 59612_60-decrypted.ts \
    -d -iv 60 -K 41E61C18AA7EFDF7F88EA9FDDB4FAEF8
    

    关于ffmpeg - 如何处理flowplayer使用的.ts文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57399496/

    相关文章:

    html - 将测验嵌入到 html5 视频中 - 丰富的可自定义播放器中的提示点

    apache - Flowplayer 从 apache 流式传输 mp4

    javascript - Flowplayer 实例的 $f 未定义

    video - 截断 H.264 数据的安全位置?

    ffmpeg - 用于在内存中将 MP4 转换为 MPEG-2 TS 的 Java 库?

    ios - Mplayer 支持 SMB

    c++ - ffmpeg滤镜图像处理

    python - 最后一个子进程调用在 FFMPEG 的串联代码中不起作用。我应该如何解决这个问题?

    video - 手动编码为 MPEG-TS

    ffmpeg - 使用 ffmpeg 创建缩放垫效果,但不是黑色背景而是图像背景?