FFMPEG hwaccel 将 WEBM 转换为 MP4 视频失败:找不到编解码器参数
Posted
技术标签:
【中文标题】FFMPEG hwaccel 将 WEBM 转换为 MP4 视频失败:找不到编解码器参数【英文标题】:FFMPEG hwaccel convert WEBM to MP4 video failed: could not find codec parameters 【发布时间】:2020-08-01 04:24:58 【问题描述】:我使用 FFMPEG 在 Windows 10 上使用 Nvidia GPU GeoForce GTX 1660 卡将 webm 视频转换为 mp4 格式。它从一开始几个月就可以正常工作,但现在它停止工作,出现如下奇怪错误:
[h264 @ 0000013d8b5eee00] missing picture in access unit with size 431
[extract_extradata @ 0000013d8b6aef40] No start code is found.
big-buck-bunny-trailer.webm: could not find codec parameters
FFMPEG 版本和 Nvidia 驱动版本和之前一样,只是一夜之间崩溃,毫无头绪。我尝试谷歌搜索并更新到最新的 ffmpeg 版本以及 Nvidia 驱动程序版本,但它仍然没有帮助。 如果我使用 libx264 切换到 CPU 解码器(没有 hwaccel arg),它就可以正常工作。
环境 Windows 10 64bit | ffmpeg 版本 git-2020-04-15-51db0a4 (最新) |英伟达 GeForce GTX 1660, - Geoforce Game Ready 驱动程序版本:445.87 发布日期 2020 年 4 月 15 日
ffmpeg -y -vsync 0 -hwaccel cuvid -c:v h264_cuvid -i big-buck-bunny-trailer.webm -c:v h264_nvenc output.mp4
ffmpeg version git-2020-04-15-51db0a4 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 78.102 / 58. 78.102
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[h264 @ 0000013d8b5eee00] missing picture in access unit with size 431
[extract_extradata @ 0000013d8b6aef40] No start code is found.
big-buck-bunny-trailer.webm: could not find codec parameters
WARNING: defaulting hwaccel_output_format to cuda for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format cuda".
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, matroska,webm, from 'big-buck-bunny-trailer.webm':
Metadata:
encoder : http://sourceforge.net/projects/yamka
creation_time : 2010-05-20T08:21:12.000000Z
Duration: 00:00:32.48, bitrate: N/A
Stream #0:0(eng): Video: h264, none, 640x360, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn (default)
Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono (default)
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
Stream #0:1 -> #0:1 (vorbis (native) -> aac (native))
Press [q] to stop, [?] for help
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 66
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1339
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1415
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1908
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2123
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2504
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2294
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2684
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2468
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2622
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2867
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2737
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 3017
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2556
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 7811
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1880
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1722
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2309
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1215
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2080
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1775
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2247
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1782
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1945
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1529
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1807
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2015
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1568
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2159
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1861
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2397
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1627
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2364
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1821
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2282
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2068
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1699
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2129
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2268
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2197
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1981
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2169
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2888
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1600
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2958
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1518
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2738
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2319
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2421
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2841
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 1949
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2422
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2288
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2559
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2332
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2403
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2257
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2573
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2320
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2231
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2408
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2415
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2194
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2697
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2480
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2256
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2245
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2519
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2203
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2332
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2341
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2439
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2201
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2882
[NULL @ 0000013d8b5eee00] missing picture in access unit with size 2467
Too many packets buffered for output stream 0:1.
[aac @ 0000013d8b6bf5c0] Qavg: 115.929
[aac @ 0000013d8b6bf5c0] 2 frames left in the queue on closing
Conversion failed!
有人知道如何解决它,我被卡住了几天吗? 非常感谢!
【问题讨论】:
【参考方案1】:尝试:
ffmpeg -y -vsync 0 -hwaccel cuvid -c:v vp8_cuvid -i big-buck-bunny-trailer.webm -c:v h264_nvenc output.mp4
或
ffmpeg -y -vsync 0 -hwaccel cuvid -c:v vp9_cuvid -i big-buck-bunny-trailer.webm -c:v h264_nvenc output.mp4
nvidia 的 Video codec sdk 需要先指定源,这种情况下需要为 vp8 或 vp9 解码器更改 h264 解码器。
【讨论】:
【参考方案2】:我确实设法通过将 libvpx
指定为解码器来修复它
ffmpeg -y -vsync 0 -hwaccel cuvid -c:v libvpx -i big-buck-bunny-trailer.webm -c:v h264_nvenc output.mp4
这是有道理的,因为 libvpx 肯定能够解码 webm 视频。只是想知道为什么 h264_cuvid 不能再做这项工作了。
【讨论】:
您好,问题是您没有使用正确的解码器。您尝试使用 HW H264 解码器进行解码。您需要使用 VP8 或 VP9 解码器才能使其工作。vp8_cuvid
和 vp9_cuvid
是您正在寻找的。span>
以上是关于FFMPEG hwaccel 将 WEBM 转换为 MP4 视频失败:找不到编解码器参数的主要内容,如果未能解决你的问题,请参考以下文章
Ffmpeg - 从 webm 格式创建缩略图并将 webm 电影转换为 flv 电影
使用 Python 将 WEBM 文件转换为 WAV 文件 [关闭]