头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

KazamaSion 写了:不支持bord?
https://github.com/HomeOfVapourSynthEvo ... SFilterMod 看看特效會不會消失……
图片
头像
KazamaSion
帖子: 29
注册时间: 2016-08-22 6:36

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

Holy 写了:
KazamaSion 写了:不支持bord?
https://github.com/HomeOfVapourSynthEvo ... SFilterMod 看看特效會不會消失……
没问题了,谢谢
头像
巴洛克哥特
帖子: 10
注册时间: 2013-08-23 12:52

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

Holy 写了:改用 https://github.com/HomeOfVapourSynthEvolution/VSFilter 這個一般版的 VSFilter 看看,或者試試 http://www.vapoursynth.com/doc/plugins/ ... ml#subtext,現在已經預設自動將字幕 blend 到輸入視頻上了……雖然 libass 的 typesetting 呈現結果跟 VSFilter 不完全一致。
嗯,之前用了Subtext,会先在Aegisub里调用libass对一下效果,比较麻烦些。
再试试新的插件,谢谢Holy菊苣~
————————————————————————————————————————————————————————
貌似发现了一个bug,在1080P/720P下没问题,缩放为576P及一下分辨率再添加字幕,字幕位置会出错,如图:

图片

脚本就是最简单的,用LWLibavSource加载视频,fmtc进行缩放然后加载的字幕(换用VS内置的resize之后结果一样)。
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

巴洛克哥特 写了:貌似发现了一个bug,在1080P/720P下没问题,缩放为576P及一下分辨率再添加字幕,字幕位置会出错,如图:
No ass file, no debug.
图片
头像
巴洛克哥特
帖子: 10
注册时间: 2013-08-23 12:52

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

Holy 写了:No ass file, no debug.
我想着是格式最简单的字幕不用放样本呢= =
字幕: http://pan.baidu.com/s/1jHSss54 密码: vxdv
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

巴洛克哥特 写了:我想着是格式最简单的字幕不用放样本呢= =
字幕: http://pan.baidu.com/s/1jHSss54 密码: vxdv
在 AviSynth 內試了下位置一樣會偏移,或者在 Aegisub 內開個 1024x576 的 Dummy Video 看也是一樣,但是將 Aegisub 的 Subtitle provider 從 xy-vsfilter 改成 libass 看就沒有位置偏移問題……所以這是 VSFilter 本身的問題唄。
图片
头像
巴洛克哥特
帖子: 10
注册时间: 2013-08-23 12:52

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

Holy 写了:在 AviSynth 內試了下位置一樣會偏移,或者在 Aegisub 內開個 1024x576 的 Dummy Video 看也是一樣,但是將 Aegisub 的 Subtitle provider 從 xy-vsfilter 改成 libass 看就沒有位置偏移問題……所以這是 VSFilter 本身的問題唄。
明白了,感谢holy菊苣的解答~
头像
KazamaSion
帖子: 29
注册时间: 2016-08-22 6:36

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

Holy 写了:
KazamaSion 写了:不支持bord?
https://github.com/HomeOfVapourSynthEvo ... SFilterMod 看看特效會不會消失……

暂时不确定是不是py代码本身写的有问题,先贴上来:

注:ass_contents是一段已经实现写好的ass代码,经过测试确认没有问题

代码: 全选

	ot = tempfile.NamedTemporaryFile(mode = "w+")
	ot_ass = ot.name
	ot.seek(0)
	
	ass_contents = xxxxxxxxxxxxxxx 
	ot.writelines(ass_contents)
	mod = IsAssMod(order = order) #别管order是啥
	
	ot.seek(0)
	if mod == False:
		clip = core.xyvsf.TextSub(clip, file = ot_ass)
	else:
		clip = core.vsfm.TextSubMod(clip, file = ot_ass)
	
	tempfile.close()
如果这样塞进去执行,提示:(xyvsf也一样)

代码: 全选

vapoursynth.Error: TextSubMod: can't open C:\Users\xxxx\AppData\Local\Temp\tmpwcxywxbe
注:我已经用os.exsists确认过了,临时文件是实际存在的。

但是如果用另一种方式执行:

代码: 全选

	ot_file = "abc.ass"
	
	ass_contents = xxxxxxxxxxxxxxx 
	
	with open(ot_file, 'w+') as f:
		f.writelines(ass_contents)
	mod = IsAssMod(order = order) #别管order是啥
	
	if mod == False:
		clip = core.xyvsf.TextSub(clip, file = ot_ass)
	else:
		clip = core.vsfm.TextSubMod(clip, file = ot_ass)
	
	tempfile.close()
测试结果:能正常执行


于是不是很懂了……
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

KazamaSion 写了:

代码: 全选

vapoursynth.Error: TextSubMod: can't open C:\Users\xxxx\AppData\Local\Temp\tmpwcxywxbe
The doc of NamedTemporaryFile in https://docs.python.org/3.5/library/tempfile.html says:
Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).

So you need to create a named temporary file with delete=False and close the file first before TextSub opens the temporary file.
图片
头像
KazamaSion
帖子: 29
注册时间: 2016-08-22 6:36

Re: VSFilterMod XY-VSFilter for VapourSynth v1.1

Holy 写了:
KazamaSion 写了:

代码: 全选

vapoursynth.Error: TextSubMod: can't open C:\Users\xxxx\AppData\Local\Temp\tmpwcxywxbe
The doc of NamedTemporaryFile in https://docs.python.org/3.5/library/tempfile.html says:
Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).

So you need to create a named temporary file with delete=False and close the file first before TextSub opens the temporary file.
谢谢,问题已解决。

回到 “VapourSynth”