Join 2 videos and subs with Avisynth Problem!

This forum is for questions and discussion of all the aspects of handling your footage. If you have questions about capturing/ripping footage, AviSynth, or compression/encoding/converting, look here.

Join 2 videos and subs with Avisynth Problem!

Postby lithio » Tue Jan 11, 2011 6:38 pm

I have a problem to join 2 or more videos with avisynth, being cut by Trim. And then add subtitles.

I do not know how to add subs. ass for example, to video variable.

Script:

Code: Select all

LoadPlugin("C:\Program Files\megui\tools\avisynth_plugin\VSFilter.dll")

v1 = DirectShowSource ("D:\t1.mp4", audio=false,fps=23.976,convertfps=true).ConvertToYV12().Trim(0, 561).LanczosResize(848,480)

v2 = DirectShowSource ("D:\t2.mp4", audio=false,fps=23.976,convertfps=true).ConvertToYV12().LanczosResize(848,480)


final = video1 + video2

TextSub("D:\subs.ass", 1)

return final



This script gives me the video without subtitles, but well cut. I don't know how import subs into video variable.

HELP..... and thanks!
lithio
 
Joined: 11 Jan 2011

Re: Join 2 videos and subs with Avisynth Problem!

Postby LantisEscudo » Thu Jan 13, 2011 2:00 pm

You've set final to be the joined videos without the subs, so when you "return final" you're throwing out the TextSub line. Either change the TextSub line to
Code: Select all
final = TextSub("D:\subs.ass", 1)
or change your return line to
Code: Select all
return last
User avatar
LantisEscudo
 
Joined: 08 Mar 2001
Location: Vermont

Re: Join 2 videos and subs with Avisynth Problem!

Postby Phantasmagoriat » Thu Jan 13, 2011 6:02 pm

I don't think that will work, since textsub() is never actually applied to a clip at any point.

You could do any of the following:
Code: Select all
final = v1 + v2
return final.TextSub("D:\subs.ass")

or
Code: Select all
final = v1 + v2
final.TextSub("D:\subs.ass")

or
Code: Select all
final = v1 + v2
final
TextSub("D:\subs.ass")

or simply
Code: Select all
v1 + v2
TextSub("D:\subs.ass")


Other things you may want to consider:
  • Don't use DirectShowSource(), use ffvideosource() since it is frame-accurate.
  • Don't use LanczosResize(). Spline36Resize() does a better job.
  • Don't ever convert the colorspace unless you have a reason. Take out ConvertToYV12().
  • ++ (synonymous to AlignedSplice) is generally better than + (synonymous to UnalignedSplice)
  • if you put VSFilter.dll in your AviSynth Plugins directory, it will autoload, and you can omit the LoadPlugin() line
  • video1 and video2 were never actually declared in the above script (only v1 and v2)
  • Why are you inputting a value of 1 as an argument for TextSub()?

I would probably go with something like this:
Code: Select all
source1 = ffvideosource("D:\t1.mp4")
source2 = ffvideosource("D:\t2.mp4")
v1 = source1.Spline36Resize(848,480).Trim(0, 561)
v2 = source2.Spline36Resize(848,480)

v1++v2
TextSub("D:\subs.ass")
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Galactic Escape"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."
User avatar
Phantasmagoriat
 
Joined: 06 Feb 2006
Status: ☁SteamPunked≈☂

Re: Join 2 videos and subs with Avisynth Problem!

Postby Mister Hatt » Fri Jan 14, 2011 4:23 am

Assuming your video is VFR (if it isn't, then you're loading it completely wrong), the subtitles won't match up to your audio. Also hardsubbing text is evil and chews through bitrate.

In the event it is VFR, you will either be forced to softsub and mux timecodes, or apply timecode adjustments to the subtitle file.

Unaligned splice is better here, it is faster and you don't need alignment due to no audio. Do NOT autoload VSFilter as you likely have several versions of it on your system and you will want to specify exactly which you are using, and not rely on DLL conflicts of pre-loaded data. Furthermore, your footage is already YV12, and you don't need to re-convert it. This doesn't however do anything unless you want it to be slightly slower; it is not destructive at all unlike Phantasmagoriat seems to be implying.

I really recommend softsubbing it regardless, so TextSub isn't required. Your subs might have also been designed for another subtitle renderer altogether for all I know, so that is yet another reason not to use an arbitrary version of VSFilter. There are must faster renderers as well, so it might be worth using one of those if you insist on hardsubbing.
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you


Return to Footage Help

Who is online

Users browsing this forum: No registered users and 1 guest