找回密码
 立即注册
查看: 3289|回复: 2

VapourSynth脚本能不能转换成AviSynth脚本?

27

主题

98

回帖

97

VC币

至尊会员

Rank: 16Rank: 16Rank: 16Rank: 16

积分
223848
leonvent 发表于 2018-3-18 16:30:07 | 显示全部楼层 |阅读模式
这个是HDR转SDR的VapourSynth脚本,但我并不熟悉VapourSynth,能转换成AviSynth脚本吗
  1. import vapoursynth as vs
  2. core = vs.get_core()
  3. c = core.ffms2.Source(source = 'path/to/file')
  4. source_peak=1200 #set manually
  5. c=core.resize.Bilinear(clip=c, format=vs.YUV444PS, range_in_s="limited", range_s="full",chromaloc_in_s="center",dither_type="none")
  6. c=core.resize.Bilinear(clip=c, format=vs.RGBS, matrix_in_s="2020ncl", range_in_s="full",dither_type="none")
  7. c=core.resize.Bilinear(clip=c, format=vs.RGBS, transfer_in_s="st2084", transfer_s="linear",dither_type="none", nominal_luminance=source_peak)
  8. exposure_bias=source_peak/100
  9. #hable/uncharted tone mapping
  10. tm = core.std.Expr(c, expr="x {exposure_bias} * 0.15 x {exposure_bias} * * 0.05 + * 0.004 + x {exposure_bias} * 0.15 x {exposure_bias} * * 0.50 + * 0.06 + / 0.02 0.30 / - ".format(exposure_bias=exposure_bias),format=vs.RGBS)#12=1200 nits / 100 nits
  11. w = core.std.Expr(c, expr="{exposure_bias} 0.15 {exposure_bias} * 0.05 + * 0.004 + {exposure_bias} 0.15 {exposure_bias} * 0.50 + * 0.06 + / 0.02 0.30 / - ".format(exposure_bias=exposure_bias),format=vs.RGBS)#
  12. c = core.std.Expr(clips=[tm,w], expr=" x 1 y / * ",format=vs.RGBS)
  13. #c=core.fmtc.primaries(clip=c, prims="2020", primd="709")
  14. c=core.resize.Bilinear(clip=c, format=vs.RGBS, primaries_in_s="2020", primaries_s="709",dither_type="none")
  15. c=core.resize.Bilinear(clip=c, format=vs.RGBS, transfer_in_s="linear", transfer_s="709",dither_type="none")
  16. c=core.resize.Bilinear(clip=c, format=vs.YUV420P8, matrix_s="709", range_in_s="full",range_s="limited",chromaloc_in_s="center")
  17. c.set_output()
复制代码


回复

使用道具 举报

9

主题

279

回帖

4393

VC币

白金会员

Rank: 12Rank: 12Rank: 12

积分
76129
boday 发表于 2018-3-18 17:09:27 | 显示全部楼层
现在应该没有什么片子只有 hdr 不出 sdr 吧……直接去下 sdr 的不就好了?

就算是只有 hdr 的,无论是 mpv 还是 madvr 都可以直接处理 tone mapping,为什么要用 vs/avs 来做?
回复

使用道具 举报

27

主题

98

回帖

97

VC币

至尊会员

Rank: 16Rank: 16Rank: 16Rank: 16

积分
223848
leonvent  楼主| 发表于 2018-3-18 18:22:14 | 显示全部楼层
boday 发表于 2018-3-18 17:09
现在应该没有什么片子只有 hdr 不出 sdr 吧……直接去下 sdr 的不就好了?

就算是只有 hdr 的,无论是 mpv ...

有时候做字幕还是要用从UHD上截一些片段用,所以我需要avs脚本
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表