ffmpeg可以使用cuda硬件加速的方法 解码编码mp4。
所以在想可不可以也加速抽离图片
第二个需求是把视频抽离成单张图片,用的是这个方法
ffmpeg -i 1.mp4 -f image2 q:v 2 -an -r 10 -s 320*180 D:\cut\%4d.jpg
在ffmpeg里面文档看到的方法是有专门的剥离器叫“Demuxers”
在N卡的发布手册里面也看到有jpeg图片格式解码编码的支持。
请问我上面代码怎么改进?
Libraries
The scientific and utility libraries listed below are available in the lib/ directory (DLLs on Windows are in bin/), and their interfaces are available in the include/ directory.
cublas (BLAS)
cublas_device (BLAS Kernel Interface)
cuda_occupancy (Kernel Occupancy Calculation [header file implementation])
cudadevrt (CUDA Device Runtime)
cudart (CUDA Runtime)
cufft (Fast Fourier Transform [FFT])
cupti (CUDA Profiling Tools Interface)
curand (Random Number Generation)
cusolver (Dense and Sparse Direct Linear Solvers and Eigen Solvers)
cusparse (Sparse Matrix)
libcu++ (CUDA Standard C++ Library)
nvJPEG (JPEG encoding/decoding)
npp (NVIDIA Performance Primitives [image and signal processing])
nvblas ("Drop-in" BLAS)
nvcuvid (CUDA Video Decoder [Windows, Linux])
nvgraph (CUDA nvGRAPH [accelerated graph analytics])
nvml (NVIDIA Management Library)
nvrtc (CUDA Runtime Compilation)
nvtx (NVIDIA Tools Extension)
thrust (Parallel Algorithm Library [header file implementation])
也测试过了如下代码都失败了
ffmpeg -hwaccel cuvid -c:v h264_cuvid -i 1.ts -c:v h264_nvenc -vframes 54000 image%5d.jpg
ffmpeg -hwaccel cuvid -c:v h264_cuvid -i 1.ts -c:v h264_nvenc -vframes 54000 image%5d.jpg
ffmpeg -hwaccel cuvid -c:v h264_cuvid -i 1.mp4 -c:v h264_nvenc -f image2 -r 1 image%5d.jpg
ffmpeg -hwaccel cuvid -i 1.mp4 -f image2 -r 5 image%5d.jpg