Ffmpeg 如何处理flowplayer使用的.ts文件?
jove.com似乎在使用Flowplay 以上面的URL为例,它将使用这样的.ts文件(通过Google Chrome devtools) 但我不知道如何使.ts文件在本地可见 我试过这样的东西。但我总是犯错误Ffmpeg 如何处理flowplayer使用的.ts文件?,ffmpeg,flowplayer,mpeg2-ts,Ffmpeg,Flowplayer,Mpeg2 Ts,jove.com似乎在使用Flowplay 以上面的URL为例,它将使用这样的.ts文件(通过Google Chrome devtools) 但我不知道如何使.ts文件在本地可见 我试过这样的东西。但我总是犯错误 $ 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 w
$ 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,因此在密钥存在的情况下可以对其进行解密
HLS视频流
简单的方法是使用FFmpeg(它会自动解密)打开HLS视频流并剪切所需的片段:
ffmpeg -ss 32 -i https://cloudflare2.jove.com/CDNSource/hls/59612/59612_.m3u8 -t 17 -c copy output.mp4
:跳到32s-ss32
:将持续时间设置为17s-t17
:执行流复制(无质量损失)-c copy
59612.key
时,您会看到很多乱七八糟的信息:aæª~ aý÷OŽOø
您必须将其转换为十六进制二进制表示形式。这可以通过hextump
完成
curl -s https://cloudflare2.jove.com/CDNSource/hls/59612/59612.key | hexdump -e '16/1 "%02x"
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 0000000000000000000000003c
: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
openssl\
aes-128-cbc\
-在这种情况下,命令应该起作用。很可能这些文件有数字版权管理。如何解码?因为视频可以在浏览器中看到,所以必须有一种方法来解码它?首先检查它是否是DRMed。然后获取密钥。然后解密。然后解码。你能显示要使用的确切命令吗?不。那不太可能,因为缺少信息。这个分类看起来像HLS片段。意思是有一个清单。没有舱单我什么也做不了。
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