Background:
I was converting some old MPG2 videos in to h.264 and noticed that it was excruciatingly slow process. I used HandBrakeCLI using the "Universal" profile on a Linux (Kubuntu 14.04LTS).
It took around 13 minutes to convert an hours worth of video on a Core i7-3610QM CPU @ 2.30GHz machine with plenty of RAM. Note that the FSB and RAM on this machine runs at 1600Mhz. I wanted to find out what bottleneck was. The three areas I had a look at was Memory, Processor and Storage.
The second problem was that the machine was getting very hot while processing with all 4 cores and the 4 hyperthreaded cores were utilised 80%+.
This article gives the results of this investigation.
Investigation:
Test 1:
HDD
5400RPM disk (sdb - root)
Cores
Default: 8 Cores (4 real + 4 Hyperthreaded)
Original File size
288MB MP2
6min 18 sec
Final file size
131MB h.264
Time taken
1m14.190s
1m14.500s
1m13.587s
Avg temperature (C)
51- 95
56 - 98
50 -91
~80% on all CPUs
Test 2:
HDD
ramdisk
Cores
Default: 8 Cores (4 real + 4 Hyperthreaded)
Original File size
288MB MP2
6min 18 sec
Final file size
131MB h.264
Time taken
1m13.793s
1m13.526s
1m13.537s
Avg temperature (C)
56 - 100
57 - 99
61 - 102
~80% on all CPUs
Test 3:
HDD
ramdisk
Cores
Default: 4 Cores
Original File size
288MB MP2
6min 18 sec
Final file size
131MB h.264
Time taken
1m45.909s
1m45.348s
1m45.609s
Avg temperature (C)
58 - 89
59 - 89
61 - 91
4x~80%, 4x~40%
Test 4:
HDD
ramdisk
Cores
Default: 3 Cores
Original File size
288MB MP2
6min 18 sec
Final file size
131MB h.264
Time taken
2m11.425s
2m6.620s
Avg temperature (C)
59 - 87
60 - 87
3 x ~80%, 5 x 40%
Test 5:
HDD
ramdisk
Cores
Default: 5 Cores
Original File size
288MB MP2
6min 18 sec
Final file size
131MB h.264
Time taken
1m28.516s
1m29.118s
Avg temperature (C)
59 - 95
61 - 96
5 x ~80%, 3 x 40%
Conclusion
As the results shows encoding with h.264 is processor bound. Amount of RAM or Hard drive performance really doesn't impact anything. However note that I said "processor bound"; which includes the speed of CPU, FSB, NorthBridge architecture (including motherboard), Cache and RAM speed.
As far as the secondary problem of CPU load/heat is concerned I found the best compromise was to use the maximum number of real processors for encoding (i.e.: only use 4, as there are only 4 real cores in my setup). Adding the 4 extra hyperthreaded cores gives about a 40% improvement in performance but the CPU runs red hot.
------------------------------
Further testing : What Handbrake options are best
Test A:
Handbrake Profile :
"Normal"
HDD
5400RPM disk
Cores
Default: 4 Cores (4 threads on Handbrake)
Original File size
1.4GB MP2
44min 12sec
Final file size
427.5MB h.264
Time taken
5m40.160s
5m45.726s
Avg temperature (C)
51-89
~73% on all CPUs
Quality (Playing using Kodi on Rpi)
55% - Fuzzy [ Fastest for given quality ]
Test B:
Handbrake Profile :
"Universal"
HDD
5400RPM disk
Cores
Default: 4 Cores (4 threads on Handbrake)
Original File size
1.4GB MP2
44min 12sec
Final file size
643.3MB h.264
Time taken
12m58.187s
12m35.263s
Avg temperature (C)
51-75
~70% on all CPUs
Quality (Playing using Kodi on Rpi)
65% - Some times edges trailing [ Best option for my TV recordings ]
Test C:
Handbrake Profile :
"H.264 MKV 1080p30"
HDD
5400RPM disk
Cores
Default: 4 Cores (4 threads on Handbrake)
Original File size
1.4GB MP2
44min 12sec
Final file size
302.7MB h.264
Time taken
16m54.927s
17m10.900s
Avg temperature (C)
51-91
~75% on all CPUs
Quality (Playing using Kodi on Rpi)
60% - Some times edges jurky
Test D:
Handbrake Profile :
"Very Fast 1080p30"
HDD
5400RPM disk
Cores
Default: 4 Cores (4 threads on Handbrake)
Original File size
1.4GB MP2
44min 12sec
Final file size
216.2MB h.264
Time taken
6m58.768s
Avg temperature (C)
65-92
~85% on all CPUs
Quality (Playing using Kodi on Rpi)
45% - Very fuzzy
Test E:
Handbrake Profile :
"Fast 1080p30"
HDD
5400RPM disk
Cores
Default: 4 Cores (4 threads on Handbrake)
Original File size
1.4GB MP2
44min 12sec
Final file size
319MB h.264
Time taken
15m4.535s
Avg temperature (C)
51-86
~80% on all CPUs
Quality (Playing using Kodi on Rpi)
51% - Fuzzy
Test F:
Handbrake Profile :
"HQ 1080p30"
HDD
5400RPM disk
Cores
Default: 4 Cores (4 threads on Handbrake)
Original File size
1.4GB MP2
44min 12sec
Final file size
475MB h.264
Time taken
31m10.414s
Avg temperature (C)
51-85
~65% on all CPUs
Quality (Playing using Kodi on Rpi)
65% - Fuzzier than Super HQ [For output size and processing time highly recommended]
Test G:
Handbrake Profile :
"Super HQ 1080p30"
HDD
5400RPM disk
Cores
Default: 4 Cores (4 threads on Handbrake)
Original File size
1.4GB MP2
44min 12sec
Final file size
558.2MB h.264
Time taken
92m51.622s
Avg temperature (C)
70-90
~55% on all CPUs
Quality (Playing using Kodi on Rpi)
80% - Good picture quality [ Close to source resolution ]
No comments:
Post a Comment