ffmpeg download
Official website download page:
The hyperlink login is visible. It is recommended to download the compiled version and download the page:
The hyperlink login is visible. I generally prefer to download the latest version (named after the date) and of course there is a stable version (named after the version number).
CUDA download
CUDA is a driver that allows the GPU to perform related operations, because we develop applications that do not directly control the GPU, but operate through the driver.
The hyperlink login is visible. Here I choose the version as shown below: Of course, you can also click the link below to go directly to the settings when I downloaded.
The hyperlink login is visible.
After downloading, remember to install it, so I won't introduce it, after all, they are all developing software.
command
Query commands Check whether the downloaded ffmpeg supports cuda, if it doesn't (I downloaded it), then download it again or compile it yourself.
Test commands
Convert the 0.mp4 in the current directory to 00.mp4
Convert the 0.mp4 in the current directory to 00.mp4 and specify the output frame rate of 15 (-r 15) and the bitrate of 500k (-b 500k).
-hwaccel cuvid: Specifies the use of cuvid hardware acceleration
-c:v h264_cuvid: Video decoding using h264_cuvid
-c:v h264_nvenc: Video encoding with h264_nvenc
-vf scale_npp=1280:-1: Specify the width and height of the output video, note that this is different from the -vf scale=x:x used for soft decoding
Multiple graphics card commands
GPU transcoding efficiency test On a server with two Intel-E5-2630v3 CPUs and two Nvidia Tesla M4 graphics cards, the h264 video transcoding test was performed as follows:
Average GPU transcoding time: 8s Average CPU transcoding time: 25s
When transcoding in parallel, the efficiency of CPU soft conversion is improved, and all 32 cores are occupied when the three transcoding tasks are parallel
Average GPU transcoding time: 8s Average CPU transcoding time: 18s
It is not difficult to see that the transcoding speed of the GPU does not increase when parallel, which shows that a GPU can only perform one transcoding task at the same time. So, if multiple graphics cards are inserted on the server, will ffmpeg use multiple GPUs for parallel transcoding? Unfortunately, the answer is no. ffmpeg does not have the ability to automatically assign transcoding tasks to different GPUs, but after some investigation, it was found that the GPU used for the transcoding task can be specified by the -hwaccel_device parameter! Submit transcoding tasks to different GPUs
Graphics 0
Graphics card1
Illustrate:
-hwaccel_device N: Specify a GPU to perform a transcoding task, N is a number
|