0

目标:在我的脚本中,我尝试检查我的显卡上的 nvdec 是否可用/功能正常。我此时没有任何源视频(H.264 / H.265)可用作输入,所以我想生成它。也不需要使用编码器,因为我不需要输出文件。我正在测试命令 ffmpeg ($?) 的退出代码。我使用 nvidia-smi 来检查 dec/enc 负载。

我的尝试:

ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -f lavfi -i testsrc="duration=5:size=1920x1080:rate=25" -c:v copy test.ts

我的命令的输出:

Input #0, lavfi, from 'testsrc=duration=5:size=1920x1080:rate=25':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, rgb24, 1920x1080 [SAR 1:1 DAR 16:9], 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
No information about the input framerate is available. Falling back to a default value of 25fps for output stream #0:0. Use the -r option if you want a different framerate.
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf58.65.101
    Stream #0:0: Video: wrapped_avframe, rgb24, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc58.119.100 wrapped_avframe
frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

我在 test.ts 之前尝试添加 -t 5 但没有任何改变。输出 ts 文件大小为零。

如果我调试命令,我希望将它添加到末尾“-f null - 2>/dev/null”。输出文件仅用于调试目的。

谢谢你。

4

1 回答 1

1

您需要先使用 H.264 编码器生成视频,然后再尝试单独解码。

ffmpeg -y -f lavfi -i "testsrc2=duration=5:size=1920x1080:rate=25" -c:v h264 test.ts

ffmpeg  -c:v h264_cuvid -i test.ts -f null -
于 2021-01-31T05:44:58.850 回答