我使用透视滤镜在视频上放了一张照片。
示例https://yadi.sk/i/MXtWUArJ3TyWBm
如何提高质量?
代码
ffmpeg -y -i bg.mp4 -loop 1 -i image.jpg -filter_complex "[1]drawtext=fontfile=PF.ttf:text=Test: fontcolor=white:fontsize=150:x=(w-text_w)/2:y=(h-text_h)/2:alpha=1[txt];[txt]format=rgba,pad=iw+4:ih+4:2:2:white@0,perspective=enable='eq(n,0)':x0=494.928:y0=209.322:x1=946.974:y1=223.928:x2=466.575:y2=515.535:x3=913.465:y3=564.508:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,1)':x0=492.97:y0=209.34:x1=946.723:y1=223.275:x2=464.979:y2=516.19:x3=914.211:y3=563.625:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,2)':x0=491.079:y0=209.336:x1=946.611:y1=222.44:x2=463.872:y2=517.063:x3=915.323:y3=562.806:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,3)':x0=489.485:y0=209.641:x1=946.927:y1=221.562:x2=463.444:y2=518.187:x3=917.129:y3=561.776:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,4)':x0=488.11:y0=210.139:x1=947.318:y1=220.795:x2=463.353:y2=519.447:x3=919.386:y3=560.902:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,5)':x0=486.944:y0=210.591:x1=948.048:y1=219.901:x2=463.424:y2=520.868:x3=921.62:y3=559.961:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,6)':x0=485.949:y0=211.241:x1=948.931:y1=219.289:x2=463.725:y2=522.28:x3=924.003:y3=559.139:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,7)':x0=484.966:y0=211.809:x1=949.696:y1=218.828:x2=464.036:y2=523.807:x3=926.451:y3=558.422:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,8)':x0=484.154:y0=212.491:x1=950.715:y1=218.643:x2=464.476:y2=525.458:x3=928.879:y3=558.026:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,9)':x0=483.478:y0=213.159:x1=951.889:y1=218.627:x2=464.986:y2=526.948:x3=931.192:y3=557.65:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,10)':x0=482.931:y0=213.894:x1=952.765:y1=218.773:x2=465.38:y2=528.531:x3=933.623:y3=557.31:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,11)':x0=482.236:y0=214.325:x1=953.627:y1=218.692:x2=465.659:y2=529.823:x3=935.771:y3=556.807:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,12)':x0=481.557:y0=214.712:x1=954.293:y1=218.545:x2=465.915:y2=531.067:x3=937.621:y3=556.196:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,13)':x0=480.524:y0=214.949:x1=954.537:y1=218.358:x2=465.958:y2=532.204:x3=939.177:y3=555.434:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,14)':x0=479.39:y0=214.982:x1=954.715:y1=217.96:x2=465.792:y2=533.019:x3=940.467:y3=554.715:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,15)':x0=478.214:y0=214.901:x1=954.724:y1=217.568:x2=465.374:y2=533.843:x3=941.367:y3=553.849:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,16)':x0=476.725:y0=214.761:x1=954.269:y1=217.646:x2=464.356:y2=534.599:x3=941.491:y3=553.492:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,17)':x0=475.334:y0=214.58:x1=953.56:y1=217.797:x2=463.221:y2=535.186:x3=941.48:y3=553.23:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,18)':x0=473.903:y0=214.167:x1=952.701:y1=218.158:x2=461.715:y2=535.296:x3=940.785:y3=552.962:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,19)':x0=472.495:y0=213.096:x1=951.832:y1=218.516:x2=460.065:y2=534.789:x3=939.837:y3=552.757:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,20)':x0=471.281:y0=211.607:x1=950.935:y1=218.945:x2=458.138:y2=533.884:x3=938.614:y3=552.495:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,21)':x0=469.713:y0=209.613:x1=949.795:y1=219.433:x2=455.859:y2=532.596:x3=936.618:y3=552.357:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,22)':x0=468.369:y0=207.397:x1=948.667:y1=219.849:x2=453.532:y2=531.159:x3=934.257:y3=552.38:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,23)':x0=466.699:y0=205.104:x1=947.26:y1=220.454:x2=451:y2=529.693:x3=931.619:y3=552.292:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,24)':x0=465.14:y0=202.656:x1=945.657:y1=220.984:x2=448.541:y2=528.1:x3=928.819:y3=552.119:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,25)':x0=463.654:y0=200.211:x1=943.684:y1=221.754:x2=445.881:y2=526.374:x3=925.948:y3=551.82:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,26)':x0=462.27:y0=198.113:x1=941.55:y1=222.567:x2=443.463:y2=524.768:x3=922.871:y3=551.705:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,27)':x0=460.862:y0=195.791:x1=939.386:y1=223.475:x2=441.08:y2=523.19:x3=919.645:y3=551.548:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,28)':x0=459.766:y0=193.607:x1=937.438:y1=224.545:x2=438.891:y2=521.673:x3=916.406:y3=551.701:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,29)':x0=458.882:y0=191.27:x1=935.409:y1=225.862:x2=436.825:y2=520.193:x3=913.095:y3=552.098:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,30)':x0=458.365:y0=189.02:x1=933.821:y1=227.087:x2=434.821:y2=518.642:x3=909.654:y3=552.564:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,31)':x0=458.29:y0=186.899:x1=932.551:y1=228.709:x2=433.302:y2=517.208:x3=906.326:y3=553.304:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,32)':x0=458.534:y0=184.934:x1=930.92:y1=230.425:x2=431.853:y2=516.033:x3=903.419:y3=554.001:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,33)':x0=458.973:y0=183.577:x1=929.578:y1=232.315:x2=431.13:y2=515.161:x3=900.86:y3=554.747:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,34)':x0=459.577:y0=182.54:x1=928.307:y1=233.674:x2=430.997:y2=514.572:x3=898.767:y3=555.186:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,35)':x0=460.128:y0=181.739:x1=927.047:y1=234.729:x2=431.09:y2=514.372:x3=897.07:y3=555.338:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,36)':x0=460.374:y0=181.922:x1=925.621:y1=235.331:x2=431.847:y2=515.292:x3=895.692:y3=555.167:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,37)':x0=460.753:y0=182.276:x1=924.459:y1=235.765:x2=432.684:y2=516.469:x3=894.378:y3=554.91:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,38)':x0=461.243:y0=183.165:x1=923.532:y1=235.814:x2=434.423:y2=518.171:x3=893.91:y3=554.282:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,39)':x0=462.261:y0=184.321:x1=922.722:y1=235.728:x2=436.987:y2=519.999:x3=894.108:y3=553.774:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,40)':x0=463.496:y0=185.537:x1=921.991:y1=235.75:x2=439.757:y2=521.98:x3=894.772:y3=553.112:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,41)':x0=465.548:y0=187.001:x1=921.493:y1=236.09:x2=443.323:y2=523.869:x3=895.942:y3=552.546:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,42)':x0=467.664:y0=188.186:x1=921.479:y1=236.337:x2=447.079:y2=525.676:x3=897.284:y3=552.21:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,43)':x0=470.423:y0=189.241:x1=921.748:y1=236.699:x2=451.338:y2=527.352:x3=898.81:y3=551.862:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,44)':x0=473.639:y0=190.325:x1=922.383:y1=237.261:x2=455.379:y2=529.192:x3=900.266:y3=551.685:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,45)':x0=477.198:y0=191.58:x1=923.242:y1=237.755:x2=459.701:y2=531.055:x3=902.031:y3=551.569:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,46)':x0=480.253:y0=193.004:x1=923.946:y1=238.03:x2=463.948:y2=533.023:x3=903.631:y3=551.247:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,47)':x0=483.194:y0=194.515:x1=924.427:y1=238.145:x2=468.08:y2=535.374:x3=905.248:y3=550.784:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,48)':x0=485.61:y0=196.362:x1=924.407:y1=237.946:x2=472.316:y2=537.937:x3=906.965:y3=550.089:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,49)':x0=487.797:y0=198.385:x1=924.227:y1=237.506:x2=476.379:y2=540.47:x3=908.458:y3=549.279:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,50)':x0=489.67:y0=200.238:x1=923.762:y1=237.106:x2=480.302:y2=542.749:x3=909.865:y3=548.399:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,51)':x0=491.551:y0=201.666:x1=923.505:y1=236.35:x2=483.796:y2=544.49:x3=910.801:y3=547.21:interpolation=0:sense=1:eval=0,perspective=enable='eq(n,52)':x0=493.366:y0=202.541:x1=923.243:y1=235.724:x2=486.788:y2=545.948:x3=911.598:y3=546.166:interpolation=0:sense=1:eval=0[p];[p]scale=w=1280:h=-1[temp];[0][temp]overlay=-2:-2:shortest=1 [v]" -map "[v]" preview.mp4
答案 0 :(得分:0)
提高视频分辨率(大小)以进行转换,应该是2到4倍就足够了-通常,您需要增加过采样视频(简单地将pointresize更改为4倍就足够了,当然建议使用更好的升频器),然后应用透视变换然后降级输出视频按因子4
无论何时需要亚像素精度,我都会执行这种方法,这对文本,alpha通道和精细运动都很有用。