[mythtv-users] HD-PVR re-encoding from 1080 to 720p - feedback

Tom Runner tomj.runner at gmail.com
Sat Mar 5 09:59:47 UTC 2011


Hi all,

My STB being set to 1080, it generates big files for all movies, while I
just have one HD chanel. I should most probably set it to 720p, but that's
not the point. I don't debate here if I'll be capable to make the difference
between a 1920x1080 movie or a 1280x720 one, but I'll try to see what could
be the best encoding option to move down the non HD records to 1280x720.
The purpose is not to give a solution to transcode in Mythtv, but results of
encoding parameters.

So I did few tests and here is the feedback, in case you wish to play around
too. Sorry it's a little bit be long.
Test information:
- Encoding done with ffmpeg last version from git
- A 1:45 minutes capture HDPVR from the non-HD chanel. The movie is the
beginning of "Journey to the center of the earth", because there are dark,
fire, run and regular scenes.
- Size of the captured file 122Mb
- Each time I'll give a time to encode and file size, plus some qualitative
comments, based on a frame by frame (in Avidemux) visual comparison. So very
highly subjective.

You can refer to
http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping to review
some of the key parameters (not fully up to date though).

1) Step 1: 2 "extreme" benchmark
Benchmark 1 = use "hq" profile from ffmpeg preset
Time = 2:55
Size = 4.3 Mb
Quality = Awful
Very fast, very high compression, but definitely not an acceptable quality.

Benchmark 2 = almost "placebo" preset (removed:
Partitions=+partp4x4, rc_lookahead=60, changed me-method=umh instead of
tesa. Forced crf=17)
Time = 27:06
Size = 48.7 Mb
Quality = Ok
Become the reference file


2) Steps 2: change one by one some parameters to assess the impact. This
starting from the "placebo" equivalent.
I will focus only on few parameters: subq (subme), crf, Me_range, bf
(b_frame), Refs

Test 1: Reduce subq to 9 (level 10 being quite recent)
Time = 23.33
Size = 52 Mb
We can see the immediate impact of subq on time (-13.6%). We'll come back to
it later.

Test 2: it is said around, that refs should be set at 6 except for cartoons.
Let's see the impact. refs=6
Time = 15.25
Size = 51.9 Mb
Quality = Visually the same
A direct 34.5 % decrease in term of time.

Test 3: With b_strategy set to 2, b_frame should be ranging between 3 to 5
according to the "manual". Test with bf=5
Time = 12.46
Size = 52.1 Mb
Quality = no significant change
An additional 17.2 % encoding time reduction, with no visible impact.
Decreasing more b_frame does not bring much improvement on the time. I do
not investigate further.

Test 4: Changing subq which is supposed to strongly impact encoding time.
With Bf= 5 and refs=6, let's set subq=7
Time = 9:32 (11:12 for subq=8, improvement of 12.3%)
Size = 51.7 Mb
Quality = no change.
It's a 25.3 % improvement in term of encoding time

Test 5: Now I play with me_range, which because of me_method=umh was set to
24. I decrease it to Me_range=16
Time = 9:05 (9:21 for me_range=20)
Size = 51.7 Mb
Quality = Well it seems the quality is less good. A little bit more blur
here and there.
It's a 4.7 % improvement on the time. Does it worth it ? I'll have to rework
on that. For now I switch back to me_range=24

Test 6: The encoding rate cfr. For crf=19
Time = 8:20 (9:20 for crf=18, 7:43 for crf=20)
Size = 38.1 Mb (44.3 for crf=19, 32.9 for crf=20)
Quality = A slight decrease on a frame by frame review. Should not be that
visible. On the contrary, crf=20, brings a larger decrease of quality.
Compared to test 4, it's 12.6 % improvement for the time, 26.3 % in term of
size.

Test 7: Back to refs, which I've not pushed up to the recommended down limit
of 4. Refs=4
Time = 7:07 (7:45 for refs=5)
Size = 38.1
Quality = Marginal changes to no change versus the test 6
Another 14.6 % time improvement with very limited quality decrease.

I stop here for now, no doubt it can be fine tuned or there is a better
method to assess the quality (without having to put 2 TV screens close to
each other). If someone has one in mind, feel free, all the test videos are
done now.

Here is the command line
ffmpeg -i /media/Files/earth.mkv -acodec copy -async 1 -copyts -s hd720
-vcodec libx264 -vpre home -threads 0 /media/Files/test25.mkv

Here are the "placebo" like preset and the final one.
coder=1
crf=17
flags=+loop
cmp=+chroma
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
me_method=umh
subq=10
me_range=24
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=2
qcomp=0.7
qmin=10
qmax=51
qdiff=4
bf=16
refs=16
directpred=3
trellis=2
flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
wpredp=2
deblockalpha=0
deblockbeta=0

coder=1
crf=19
flags=+loop
cmp=+chroma
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
me_method=umh
subq=7
me_range=24
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=2
qcomp=0.7
qmin=10
qmax=51
qdiff=4
bf=5
refs=4
directpred=3
trellis=2
flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
wpredp=2
deblockalpha=0
deblockbeta=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20110305/ea828cab/attachment.html 


More information about the mythtv-users mailing list