Hi all, <div><br></div><div>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&#39;s not the point. I don&#39;t debate here if I&#39;ll be capable to make the difference between a 1920x1080 movie or a 1280x720 one, but I&#39;ll try to see what could be the best encoding option to move down the non HD records to 1280x720.</div>

<div>The purpose is not to give a solution to transcode in Mythtv, but results of encoding parameters.<br><br></div><div>So I did few tests and here is the feedback, in case you wish to play around too. Sorry it&#39;s a little bit be long.</div>
<div>Test information:</div><div>- Encoding done with ffmpeg last version from git</div>
<div>- A 1:45 minutes capture HDPVR from the non-HD chanel. The movie is the beginning of &quot;Journey to the center of the earth&quot;, because there are dark, fire, run and regular scenes.</div><div>- Size of the captured file 122Mb</div>

<div>- Each time I&#39;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.<br></div><div><br></div><div>You can refer to <a href="http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping" target="_blank">http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping</a> to review some of the key parameters (not fully up to date though).</div>

<div><br></div><div>1) Step 1: 2 &quot;extreme&quot; benchmark</div><div>Benchmark 1 = use &quot;hq&quot; profile from ffmpeg preset</div><div>Time = 2:55</div><div>Size = 4.3 Mb</div><div>Quality = Awful</div><div>Very fast, very high compression, but definitely not an acceptable quality.<br>
<br></div><div>Benchmark 2 = almost &quot;placebo&quot; preset (removed: Partitions=+partp4x4, rc_lookahead=60, changed me-method=umh instead of tesa. Forced crf=17)</div>
<div>Time = 27:06</div><div>Size = 48.7 Mb</div><div>Quality = Ok<br>Become the reference file<br></div><div><br></div><div><br></div><div>2) Steps 2: change one by one some parameters to assess the impact. This starting from the &quot;placebo&quot; equivalent.</div>

<div>I will focus only on few parameters: subq (subme), crf, Me_range, bf (b_frame), Refs</div><div><br></div><div>Test 1: Reduce subq to 9 (level 10 being quite recent)</div><div>Time = 23.33</div><div>Size = 52 Mb</div>

<div>We can see the immediate impact of subq on time (-13.6%). We&#39;ll come back to it later.</div><div><br></div><div>Test 2: it is said around, that refs should be set at 6 except for cartoons. Let&#39;s see the impact. refs=6<br>
</div>
<div>Time = 15.25</div><div>Size = 51.9 Mb<br></div><div>Quality = Visually the same</div><div>A direct 34.5 % decrease in term of time.</div><div><br></div><div>Test 3: With b_strategy set to 2, b_frame should be ranging between 3 to 5 according to the &quot;manual&quot;. Test with bf=5</div>

<div>Time = 12.46</div><div>Size = 52.1 Mb<br></div><div>Quality = no significant change</div><div>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.</div>

<div><br></div><div>Test 4: Changing subq which is supposed to strongly impact encoding time. With Bf= 5 and refs=6, let&#39;s set subq=7</div><div>Time = 9:32 (11:12 for subq=8, improvement of 12.3%)</div><div>Size = 51.7 Mb<br>
</div><div>Quality = no change.</div><div>It&#39;s a 25.3 % improvement in term of encoding time</div>
<div><br></div><div>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<br>Time = 9:05 (9:21 for me_range=20)<br>Size = 51.7 Mb<br>Quality = Well it seems the quality is less good. A little bit more blur here and there.<br>
It&#39;s a 4.7 % improvement on the time. Does it worth it ? I&#39;ll have to rework on that. For now I switch back to me_range=24<br><br>Test 6: The encoding rate cfr. For crf=19<br>Time = 8:20 (9:20 for crf=18, 7:43 for crf=20)<br>
Size = 38.1 Mb (44.3 for crf=19, 32.9 for crf=20)<br>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.<br>Compared to test 4, it&#39;s 12.6 % improvement for the time, 26.3 % in term of size.<br>
<br>Test 7: Back to refs, which I&#39;ve not pushed up to the recommended down limit of 4. Refs=4 <br>Time = 7:07 (7:45 for refs=5)<br>Size = 38.1 <br>Quality = Marginal changes to no change versus the test 6<br>Another 14.6 % time improvement with very limited quality decrease.<br>
<br>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.<br>
<br>Here is the command line<br>ffmpeg -i /media/Files/earth.mkv -acodec copy -async 1 -copyts -s hd720 -vcodec libx264 -vpre home -threads 0 /media/Files/test25.mkv<br><br>Here are the &quot;placebo&quot; like preset and the final one.<br>
coder=1<br>crf=17<br>flags=+loop<br>cmp=+chroma<br>partitions=+parti8x8+parti4x4+partp8x8+partb8x8<br>me_method=umh<br>subq=10<br>me_range=24<br>g=250<br>keyint_min=25<br>sc_threshold=40<br>i_qfactor=0.71<br>b_strategy=2<br>
qcomp=0.7<br>qmin=10<br>qmax=51<br>qdiff=4<br>bf=16<br>refs=16<br>directpred=3<br>trellis=2<br>flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip<br>wpredp=2<br>deblockalpha=0<br>deblockbeta=0<br><br>coder=1<br>crf=19<br>
flags=+loop<br>cmp=+chroma<br>partitions=+parti8x8+parti4x4+partp8x8+partb8x8<br>me_method=umh<br>subq=7<br>me_range=24<br>g=250<br>keyint_min=25<br>sc_threshold=40<br>i_qfactor=0.71<br>b_strategy=2<br>qcomp=0.7<br>qmin=10<br>
qmax=51<br>qdiff=4<br>bf=5<br>refs=4<br>directpred=3<br>trellis=2<br>flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip<br>wpredp=2<br>deblockalpha=0<br>deblockbeta=0<br><br><br><br></div>