![正确的 ffmpeg 命令以获取详细的播放列表信息](https://linux22.com/image/1624453/%E6%AD%A3%E7%A1%AE%E7%9A%84%20ffmpeg%20%E5%91%BD%E4%BB%A4%E4%BB%A5%E8%8E%B7%E5%8F%96%E8%AF%A6%E7%BB%86%E7%9A%84%E6%92%AD%E6%94%BE%E5%88%97%E8%A1%A8%E4%BF%A1%E6%81%AF.png)
我有一个播放列表 [ playlist.m3u8
],其中有多个流 [ https://stream1.m3u8
, https://stream2.m3u8
],我想获取此播放列表中每个流的更多详细信息。
我尝试运行:
ffmpeg -fflags -loglevel info -re -i playlist.m3u8 -vcodec copy -acodec copy
- 接收错误:
Trailing options were found on the commandline. playlist.m3u8: Invalid data found when processing input
我该如何写出正确的命令?
- 我需要获得如下输出:
Duration: N/A, start: 1672.026833, bitrate: N/A Program 0 Metadata: variant_bitrate : 701000 Stream #0:0: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 701000 comment : Multiple languages Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 854x480 [SAR 1280:1281 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Metadata: variant_bitrate : 701000 Stream #0:2(sk): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp (default) Metadata: variant_bitrate : 701000 comment : Slovak Program 1 Metadata: variant_bitrate : 2001000 Stream #0:3: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 2001000 comment : Multiple languages Stream #0:4: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 1024x576 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Metadata: variant_bitrate : 2001000 Stream #0:5(sk): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp (default) Metadata: variant_bitrate : 2001000 comment : Slovak Program 2 Metadata: variant_bitrate : 3001000 Stream #0:6: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 3001000 comment : Multiple languages Stream #0:7: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Metadata: variant_bitrate : 3001000 Stream #0:8(sk): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp (default) Metadata: variant_bitrate : 3001000 comment : Slovak Program 3 Metadata: variant_bitrate : 6001000 Stream #0:9: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 6001000 comment : Multiple languages Stream #0:10: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Metadata: variant_bitrate : 6001000 Stream #0:11(sk): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp (default) Metadata: variant_bitrate : 6001000 comment : Slovak
答案1
只要运行ffmpeg -i playlist.m3u8
就可以得到读数。
答案2
这是我得到的:
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609 configuration: --prefix=/home/juraj/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/juraj/ffmpeg_build/include --extra-ldflags=-L/home/juraj/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/juraj/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-vaapi --enable-nonfree libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 playlist.m3u8: No such file or directory
我确信该文件和目录存在。我也从正确的目录运行此脚本。我甚至尝试了此文件夹中的其他 Python 脚本,除了这个 ffmpeg 命令之外,一切都很顺利。