Performance for multiple transcoding in one command vs multiple commands

For the developers that use FFmpeg in their software.
Post Reply
gegupta
Posts: 2
Joined: Mon Mar 19, 2018 9:35 pm

Performance for multiple transcoding in one command vs multiple commands

Post by gegupta » Mon Mar 19, 2018 10:06 pm

I have transcode video into 4 target bitrates. I was doing some preliminary analysis on whether to use one command vs multiple for achieving this. What latency or CPU benefits i may get.I ran all tests like 20 times to take an average

I found the cpuUsage for running all transcodings in one command was more normalized and lesser than used for single transcoding at a time. Is it expected behaviour? or I am doing something wrong? I could see similar behaviour with various machines with different number of cores.

Test info
Cores : I tried 12/32/64 core machines to see if the results differ
File size 120MB. repeated with several similar video sizes.
Other file info :
Video : Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 4096x2160 [SAR 1:1 DAR 256:135], 96573 kb/s, 25 fps, 25 tbr, 50k tbn, 50 tbc (default)
Audio : Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)

Commands:
All In One Command:

Code: Select all

ffmpeg -y -i $FILE -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -an -b:v 400k -maxrate 700k -bufsize 700k -vf "scale=426:240" outputfile240.mp4 -an -b:v 800k -maxrate 1400k -bufsize 1400k -vf "scale=640:360" outputfile360.mp4 -an -b:v 1200k -maxrate 2100k -bufsize 2100k -vf "scale=640:480" outputfile480.mp4 -an  -b:v 2400k -maxrate 4200k -bufsize 4200k -vf "scale=1280x720" outputfile720.mp4
done
All in 4 different commands :

Code: Select all

ffmpeg -y -i $FILE -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 400k -maxrate 700k -bufsize 700k -vf "scale=426:240" $SUBSTR/outputfile240.mp4
 
ffmpeg -y -i $FILE -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 800k -maxrate 1400k -bufsize 1400k -vf "scale=640:360" $SUBSTR/outputfile360.mp4
 
ffmpeg -y -i $FILE -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 1200k -maxrate 2100k -bufsize 2100k -vf "scale=640:480" $SUBSTR/outputfile480.mp4
 
ffmpeg -y -i $FILE -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 2400k -maxrate 4200k -bufsize 4200k -vf "scale=1280x720" $SUBSTR/outputfile720.mp4
Results:
12 cores :
All one by one
all_oneByOne_1_12.PNG
all_oneByOne_1_12.PNG (28.95 KiB) Viewed 530 times
All In One command
all_oneCommand_1_12.PNG
all_oneCommand_1_12.PNG (28.67 KiB) Viewed 530 times
32 cores :
All one by one
all_oneByOne_1_32.PNG
all_oneByOne_1_32.PNG (34.02 KiB) Viewed 530 times
All In One command

gegupta
Posts: 2
Joined: Mon Mar 19, 2018 9:35 pm

Re: Performance for multiple transcoding in one command vs multiple commands

Post by gegupta » Tue Mar 20, 2018 6:54 pm

Missed the All one by one command for 32 core
all_oneByOne_1_32.PNG
all_oneByOne_1_32.PNG (34.02 KiB) Viewed 522 times

Post Reply
'