goal: In my script I try to check if nvdec on my graphics card is available/functional. I don't have any source video (H.264 / H.265) to use as input at this time intentionally, so I want to generate it. It is also not necessary to use an encoder, because I do not need the output file. I'm testing the exit code of command ffmpeg ($?). I use nvidia-smi for check dec/enc load.
My attempt:
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
output of my commands:
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)
I triead add -t 5 before test.ts but nothing changed. Output ts file has zero size.
If I debug the command, I expect to add it to the end "-f null - 2>/dev/null". Output file is only for debug purposes.
Thank you.
You need to first generate the video with a H.264 encoder and then try decoding it separately afterwards.