Score:0

Cannot convert webm to mp4 with ffmpeg + CUDA: InitializeEncoder failed: invalid param (8): Invalid Level

tr flag

Here is the video: https://1drv.ms/u/s!Ao-GP3hGG9a9gvUpL_ZfCTAUrVCXSQ?e=PjLxKU, recorded by the built-in screencast tool of Ubuntu 22.04. The ffmpeg was installed via apt, and here is the output:

$ ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda -c:v vp8_cuvid -i test.webm -an -c:v h264_nvenc test.mp4
ffmpeg version 4.4.2 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.4.0 (conda-forge gcc 10.4.0-16)
  configuration: --prefix=/home/conda/feedstock_root/build_artifacts/ffmpeg_1660921500438/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac --cc=/home/conda/feedstock_root/build_artifacts/ffmpeg_1660921500438/_build_env/bin/x86_64-conda-linux-gnu-cc --cxx=/home/conda/feedstock_root/build_artifacts/ffmpeg_1660921500438/_build_env/bin/x86_64-conda-linux-gnu-c++ --nm=/home/conda/feedstock_root/build_artifacts/ffmpeg_1660921500438/_build_env/bin/x86_64-conda-linux-gnu-nm --ar=/home/conda/feedstock_root/build_artifacts/ffmpeg_1660921500438/_build_env/bin/x86_64-conda-linux-gnu-ar --disable-doc --disable-openssl --enable-avresample --enable-demuxer=dash --enable-hardcoded-tables --enable-libfreetype --enable-libfontconfig --enable-libopenh264 --enable-gnutls --enable-libmp3lame --enable-libvpx --enable-pthreads --enable-vaapi --enable-gpl --enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 --enable-libxml2 --enable-pic --enable-shared --disable-static --enable-version3 --enable-zlib --pkg-config=/home/conda/feedstock_root/build_artifacts/ffmpeg_1660921500438/_build_env/bin/pkg-config
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, matroska,webm, from 'test.webm':
  Metadata:
    encoder         : GStreamer matroskamux version 1.20.3
    creation_time   : 2022-10-19T20:04:20.108316Z
  Duration: 00:00:10.21, start: 0.000000, bitrate: 10824 kb/s
  Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 3840x2400, SAR 1:1 DAR 8:5, 1k tbr, 1k tbn, 1k tbc (default)
    Metadata:
      title           : Video
Stream mapping:
  Stream #0:0 -> #0:0 (vp8 (vp8_cuvid) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
[vp8_cuvid @ 0x55d4f912cf40] ignoring invalid SAR: 0/0
[h264_nvenc @ 0x55d4f912bf80] InitializeEncoder failed: invalid param (8): Invalid Level.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

I am working with CUDA 11.7:

$ nvidia-smi
Wed Oct 19 23:38:52 2022       
+---------------------------------------------+
| NVIDIA-SMI 515.65.01    Driver Version: 515.65.01    CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   53C    P0     9W /  N/A |      4MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+---------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      3373      G   /usr/lib/xorg/Xorg                  4MiB |
+---------------------------------------------+

And there is no problem if converting with CPU only, i.e., ffmpeg -y -i test.webm -an test.mp4.

andrew.46 avatar
in flag
Can you add `-profile:v high -level 5.2 ` to your *output* video options and see if this resolves the issue?? So: `-c:v h264_nvenc -profile:v high -level 5.2 test.mp4`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.