大家。使用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
}
}
这个视频文件有什么问题?
答案 0 :(得分:0)
您可以通过显式设置HEVC解码器来播放此视频:
ffmpleg -codec:v hevc -i input.avi
原因很可能是AVI容器实际上不能包含HEVC数据。幸运的是,可以通过运行“ ffprobe input.avi”并检查流来了解其中的内容。
答案 1 :(得分:0)
在ffmpeg中可能存在一个错误,以支持HEVC和/或AVI容器。 很多时候最好在ffmpeg forums中讨论此类问题。 开发人员的意见可以提供很多帮助!也许您使用的是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
}
}