使用 ffplay 播放视频时出现问题

问题描述 投票:0回答:2

大家。我在使用 ffplay 播放video 时遇到问题。使用以下命令

ffplay -i input.avi

但是出现了以下错误。

ffplay version N-87353-g183fd30 Copyright (c) 2003-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 76.100 / 55. 76.100
  libavcodec     57.106.101 / 57.106.101
  libavformat    57. 82.101 / 57. 82.101
  libavdevice    57.  8.101 / 57.  8.101
  libavfilter     6.105.100 /  6.105.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[avi @ 00000000024bd9e0] Could not find codec parameters for stream 0 (Video: none (HEVC / 0x43564548), none, 1920x1080, 1697 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, avi, from 'c:\problem.avi':
  Duration: 00:00:25.00, start: 0.000000, bitrate: 1701 kb/s
    Stream #0:0: Video: none (HEVC / 0x43564548), none, 1920x1080, 1697 kb/s, 30.92 fps, 30.92 tbr, 30.92 tbn, 30.92 tbc
No codec could be found with id 0
Failed to open file 'c:\problem.avi' or configure filtergraph

通过 VLC、Media Player Classic 可以毫无问题地播放该视频。 在尝试查找有关视频文件的更多信息后,我使用了 ffprobe 命令

ffprobe -v 0  c:\problem.avi -print_format json -show_format -show_streams

{
    "streams": [
        {
            "index": 0,
            "codec_type": "video",
            "codec_tag_string": "HEVC",
            "codec_tag": "0x43564548",
            "width": 1920,
            "height": 1080,
            "has_b_frames": 0,
            "sample_aspect_ratio": "0:1",
            "display_aspect_ratio": "0:1",
            "level": -99,
            "r_frame_rate": "773/25",
            "avg_frame_rate": "773/25",
            "time_base": "25/773",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 773,
            "duration": "25.000000",
            "bit_rate": "1697304",
            "nb_frames": "773",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ],
    "format": {
        "filename": "c:\\bin\\Virtual\\problem\\problem.avi",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "avi",
        "format_long_name": "AVI (Audio Video Interleaved)",
        "start_time": "0.000000",
        "duration": "25.000000",
        "size": "5318210",
        "bit_rate": "1701827",
        "probe_score": 100
    }
}

这个视频文件可能有什么问题?

video ffmpeg avi libav
2个回答
0
投票

ffmpeg 中可能存在支持 HEVC 和/或 AVI 容器的错误。 很多时候最好在ffmpeg论坛讨论此类问题。 开发人员的意见可以有很大帮助!或者您可能有一些旧版本的 ffmpeg 二进制文件。

这是最新 ffmpeg 二进制文件的输出。 我可以看到初始流信息、编解码器级别、颜色、像素格式存在差异。 这个文件在我的设置中运行良好。

PS C:\temp> ffmpeg.exe -version
ffmpeg version git-2020-06-28-4cfcfb3 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200621

PS C:\temp> ffprobe.exe -v 0 C:\temp\problem.avi -print_format json -show_format -show_streams
{
    "streams": [
        {
            "index": 0,
            "codec_name": "hevc",
            "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
            "profile": "Main",
            "codec_type": "video",
            "codec_time_base": "25/773",
            "codec_tag_string": "HEVC",
            "codec_tag": "0x43564548",
            "width": 1920,
            "height": 1080,
            "coded_width": 1920,
            "coded_height": 1080,
            "closed_captions": 0,
            "has_b_frames": 0,
            "pix_fmt": "yuv420p",
            "level": 123,
            "color_range": "tv",
            "chroma_location": "left",
            "refs": 1,
            "r_frame_rate": "31/1",
            "avg_frame_rate": "773/25",
            "time_base": "25/773",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 773,
            "duration": "25.000000",
            "bit_rate": "1697304",
            "nb_frames": "773",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ],
    "format": {
        "filename": "C:\\temp\\problem.avi",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "avi",
        "format_long_name": "AVI (Audio Video Interleaved)",
        "start_time": "0.000000",
        "duration": "25.000000",
        "size": "5318210",
        "bit_rate": "1701827",
        "probe_score": 100
    }
}

0
投票

您可以通过显式设置 HEVC 解码器来播放此视频:

ffmpeg -codec:v hevc -i input.avi

原因可能是 AVI 容器实际上无法包含 HEVC 数据。幸运的是,可以通过运行

ffprobe input.avi
并检查流来知道其中的内容。

© www.soinside.com 2019 - 2024. All rights reserved.