A
A
Arseniy Volkov2021-03-19 19:43:52
fmpeg
Arseniy Volkov, 2021-03-19 19:43:52

What "iron" components affect the conversion speed in ffmpeg?

Hello!
We are going to do mass processing of video from mp4 to x264 to HLS format in order to replace the unprotected HTML5 player on the video platform. Now we are thinking about technology in order to process the accumulated material relatively quickly. . I'll attach the conversion code at the very bottom.
Question: What is more important for video conversion video card or processor? There seems to be a lot of algorithms now that allow you to convert on the GPU and, according to tests on the Internet, they give a significant increase. It is very interesting how things are in real use. Tk now there is a choice to rent a server without a GPU, but with a powerful set of CPUs, or vice versa, look for a computer with a good video card. Is it possible to save on RAM and SSD speed, or do they also play a significant role?

The code :
ffmpeg -v quiet -stats -xerror -i test/video-1920-1080.mp4 \
-c:v h264 -profile:v main -level 4.0 \
-filter:v:0 "scale=-2:'min(720 ,ih)'" \
-filter:v:1 "scale=-2:'min(1080,ih)'" \
-b:v:0 3000k \
-b:v:1 6000k \
-c:a copy \
-force_key_frames "expr:gte(t,n_forced*2)" \
-map 0:0 -map 0:1 -map 0:0 -map 0:1 -f hls \
-var_stream_map "v:0,a:0 v :1,a:1" \
-master_pl_name index.m3u8 \
-hls_time 10 -hls_playlist_type vod \
-hls_segment_filename test/video/%v_%04d.ts test/video/%v.m3u8

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
deadmoroz2, 2021-03-23
@diger499

Good to you too!

We are going to do mass processing of video from mp4 to x264 to HLS format in order to replace the unprotected HTML5 player on the video platform.

You can approach the task a little differently, namely, to encode not into HLS cut into segments, this will limit your broadcasting only to this format, but to MP4, and directly distribute to clients based on a third-party module for nginx - Kaltura nginx-vod. The voiced extension supports broadcasting in all common formats from MP4 files, making segmentation for the same HLS on the fly.
In our rather large CDN, we went exactly this way, which we never regretted.
What is more important for video conversion video card or processor? Because It seems that now there are many algorithms that allow you to convert on the GPU, and according to tests on the Internet, they give a significant increase. It is very interesting how things are in real use. Now there is a choice to rent a server without a GPU, but with a powerful set of CPUs, or vice versa, look for a computer with a good video card.

If the choice fell on ffmpeg, then the choice in it is limited to software transcoding on the CPU or hardware-accelerated Intel QuickSync and Nvidia NVENC.
The slowest thing is to do all the processing on the CPU, this will include decoding, deinterlacing (if necessary), scaling and encoding, the last one is the most resource-intensive. A few years ago, we evaluated performance on different CPUs: server single Intel Xeon E3 v3/v4/v5/v6, paired Intel Xeon E5 v2/v3, as well as desktop Intel Core i7-3930K and AMD FX-6300. It turned out that the multi-core Xeon E5 processors did not give a multiple increase in the encoding speed, because. decoding is essentially single-threaded, respectively, one high-frequency core is better for it. This is true for a single ffmpeg process, but no one forbids running the required amount in parallel.
Intel QuickSync uses an integrated Intel HD video processor, and these are mostly fresh desktop models or relatively rare Xeon E3 models with an index ending in 5. Allows you to take out all the processing on the GPU. Gives acceleration of coding in several times. Not the most universal solution, besides with a bunch of inconveniences and limitations in the server segment.
Nvidia NVENC requires a dedicated GPU (GTX, Quadro, Tesla) in the system, the number of video cards is limited only by the availability of free PCIe slots, space for their installation and power supply, if required. It also allows you to move all processing to the GPU. Acceleration was obtained from 8 to 20 times relative to software Xeon E3, depending on the number of output resolutions. Economically, it is also justified, because. a pair of GPUs will cost significantly less than a pair of mid-top E5 processors. For my part, I would recommend looking in this direction.
We ourselves started with a software CPU, but as soon as the first Nvidia GPU support appeared in ffmpeg, everything was smoothly transferred to hardware encoding on the GPU. The presence of already purchased 1U servers on the base E3 played into the hands of this decision, in which it turned out to be enough to install the single-slot most budget Quadro for 10-20% of the price of a new such server and get at least a 5-fold increase in transcoding performance while simultaneously unloading the main CPU almost to zero .
Is it possible to save on RAM and SSD speed, or do they also play a significant role?

From experience, even for a couple of dozens of ffmpeg running in parallel with your profile, a large amount of RAM is not required. You should think about SSD only when you need to randomly read from the HDD at speeds over 400-500Mbps, while the write is perfectly cached. HDD, of course, should not be SMR.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question