我有 HLS 的网址:
它包含段的链接:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6,
https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007927d1e7a824e88d90e17fc925d914a006873ed08c7ecb7107e7a72b810e66a2cf/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c37bc9a36794c836b2cc1c80b4c82aff3e/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/96902c1c0db5b15f08a07d5264361f76
#EXTINF:6,
https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007927d1e7a824e88d90e17fc925d914a0066544f42d5295cd71e2423a54702ca79a/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c3fa2a9b2a1346c4d1e2dc5c86583c6eca67d125b9be8ecfee724eea988e5948be/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/8e029c34700e193599b52db66deeb735
...
#EXTINF:6,
https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007923834b9bbcad67c4f65be31cff40707486e081644f595435073518177e606a22/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c3ddcf230599d82c80aa1c0d846a87eccbd425fffb2434464a4aea5eecb13bf477/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/63ae374ce1012f9b702a082f691edfd8
#EXTINF:2.24,
https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007923834b9bbcad67c4f65be31cff407074bce293bef2086d37ff74c808d35023d5/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c3514fc67bd369ecc7b2b8d0fa501094d2da0625e9796bde32b6f9a9cb5d278ec3/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/ae04e0aa6d021a973852ee444489eec0
#EXT-X-ENDLIST
我可以下载任何片段并使用 Android 中的 ExoPlayer 进行播放,但无法使用 ffmpeg 将其转换为 mp3 或 mp4。 例如这个命令:
ffmpeg -i /Users/user1/Downloads/response0.png /Users/user1/Downloads/response0.mp3
返回这个:
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.100 / 61. 19.100
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
Input #0, png_pipe, from '/Users/user1/Downloads/response0.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, ya8(pc, gbr/unknown/unknown), 1x1, 25 fps, 25 tbr, 25 tbn
Output #0, mp3, to '/Users/user1/Downloads/response0.mp3':
[out#0/mp3 @ 0x7fe879206b00] Output file does not contain any stream
Error opening output file /Users/user1/Downloads/response0.mp3.
Error opening output files: Invalid argument
(response0.png是从hls下载的第一个片段)
我认为“Stream #0:0: Video: png ...”意味着这个文件是png格式的,并且它没有音轨。但它有音轨,因为我可以播放它。
可能片段采用某种非标准格式,但如何找出它是什么格式?
PS1
response0.png 链接: https://i.sstatic.net/pajvO7fg.png 或者 https://drive.google.com/file/d/1i-LERY8keyVZgS8mX9mCoMWd3To4Fk2T/view?usp=sharing
PS2
这个命令:
file /Users/user1/Downloads/response0.png
返回这个:
/Users/user1/Downloads/response0.png: PNG image data, 1 x 1, 8-bit gray+alpha, non-interlaced
PS3
这个命令:
xxd /Users/user1/Downloads/response0.png | head -4
返回这个:
/Users/user1/Downloads/response0.png: PNG image data, 1 x 1, 8-bit gray+alpha, non-interlaced
user1@MBP-Maxim-2 temp % xxd /Users/user1/Downloads/response0.png | head -4
00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 .PNG........IHDR
00000010: 0000 0001 0000 0001 0804 0000 00b5 1c0c ................
00000020: 0200 0000 0b49 4441 5478 da63 64f8 0f00 .....IDATx.cd...
00000030: 0105 0101 2718 e366 0000 0000 4945 4e44 ....'..f....IEND
PS4
带有视频的网页: https://ww2.movie123.club/watch/tci7-pulp-fiction-1994-movie-online-free-123movies.html
原因是hls的片段不是png文件,但它们像png文件一样有标题(前8个字节)。 我刚刚删除了前 8 个字节,它就可以工作了。 来源:https://github.com/xbmc/inputstream.ffmpegdirect/issues/100?ysclid=m5feoz1irw450917629#issuecomment-828988158
唯一的问题是: