Quantcast Avisynth: Add Subtitles with the New Adaptive Script? - digitalFAQ.com Forums [Archives]
  #1  
06-14-2003, 06:09 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Hi guys!
I have a few movies that I need to encode with subtitles since they're french. What programs do I need to extract the subtitles and what filter is needed for adding them to the new script (for AviSynth 2.5*)? An exact walkthrough would be apreciated. Sorry if I have have missed any post describing this issue, but I have looked .
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
06-14-2003, 08:49 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Hi audioslave,

You need Vobsub to extract the subtitles from your DVD. Then, you must add a line to your script AFTER the adaptive filters, so that the subs don't get blurred. Check the Vobsub docs regarding the use of the program.

-kwag
Reply With Quote
  #3  
06-15-2003, 08:52 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks kwag,
I figured it out after experimenting a few minutes. I put the VobSub line absolutely last in the script and it works like a charm! I only resized the subs to 75%, both horizontal and vertical, (image scaling) and changed the alignment (origin) to X=85 and Y=73 to get it correct . I find that these things are easiest to change directly in the *.idx file...
Reply With Quote
  #4  
06-15-2003, 11:32 AM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
Where did you get VobSub for 2.5x audioslave? And could you please post the script you used? Thank you!
__________________
j3llyG0053
Reply With Quote
  #5  
06-16-2003, 01:35 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
I have trouble with getting the subtitles in sync with the sound. They (the subs) seem to appear before someone actually say something . I have tried to change the "Time offset: 0" to "Time offset: 500" but nothing happens. The subtitles still appear on the exact same frame as they did before I changed the offset. What am I doing wrong ? Is there another way of delaying subtitles? I'm using VobSub to create the subs and, of course, the "VobSub()" command in the script. Please help me with this!

-audioslave
Reply With Quote
  #6  
06-16-2003, 03:11 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Jellygoose,

Here's the script I used:

Quote:
## DLL Section ##
#
LoadPlugin("C:\Program\AviSynth 2.5\plugins\MPEG2Dec3.dll")
LoadPlugin("C:\Program\AviSynth 2.5\plugins\Decomb.dll")
LoadPlugin("C:\Program\AviSynth 2.5\plugins\Undot.dll")
LoadPlugin("C:\Program\AviSynth 2.5\plugins\ASharp.dll")
LoadPlugin("C:\Program\AviSynth 2.5\plugins\STMedianFilter.dll")
#
####

## Defined Variables and Constants ##
#
MaxTreshold = 1.50
scd_trigger = 30 # Scene change trigger value.
nf = 0 # Current frame.
#
####

## Main section and static filters ###
#
MPEG2Source("D:\DVD Rips\Red Dragon\Red Dragon.d2v")
#
FieldDeinterlace()
#Telecide()
#Decimate()
#
Undot()
Limiter()
ASharp(2, 4)
BicubicResize(480, 430, 0, 0.6, 0, 1, 720, 574)
STMedianFilter(8, 32, 0, 0)
MergeChroma(blur(MaxTreshold))
MergeLuma(blur(0.2))
#
#

## Dynamic Linear Adaptive Filtering and Scene Change Detection ##
#
# ( Portions from AviSynth's manual ) - This will apply temporalsoften to
# very static scenes, and apply variable blur on moving scenes.
# We also assign a variable - and this is why a line break is inserted:

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2.5 ? ASharp( -(fmin((nf/30), 1)), 0 ) : \
TemporalSoften(2, 7, 7, 3, 2) ")

#
# Scene change detection ( kwag ) - If a scene change is detected, we
# blur heavily. This affects the scene before and the one after the
# scene change, thus providing a softer transition for the encoder instead
# of a sharp "spike".
# If it's not a scene change, then we just blur dynamically, depending on
# the action.

ScriptClip("nf > scd_trigger ? ASharp( -2,0) : ASharp(0,0) ")

#
#
#

LetterBox(56, 56, 4, 4) # Depends on situation. Use MovieStacker!
AddBorders(0, 73, 0, 73) # Depends on situation. Use MovieStacker!
Limiter()

#
#
## Functions ###

function fmin(float f1, float f2) {
return (f1<f2) ? f1 : f2
}

#
####
VobSub("D:\DVD Rips\Red Dragon\vts_01_0")
It's the same as the "Optimal Script" from June 14 - apart from the "VobSub()" line... One advantage of putting "VobSub()" last in the script is that you can put the subs on the widescrren borders of the movie !

I don't remember where I got VobSub for AviSynth 2.5x (terribly sorry !), but maybe there's a way for me to post it somewhere in this forum? I still have the original *.zip file... Perhaps I could mail it to you?

-audioslave
Reply With Quote
  #7  
06-17-2003, 12:39 AM
Boulder Boulder is offline
Free Member
 
Join Date: Sep 2002
Location: Lahti, Finland
Posts: 1,652
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by audioslave
One advantage of putting "VobSub()" last in the script is that you can put the subs on the widescrren borders of the movie !
Actually you don't want to put them on the borders. The pure black borders compress extremely well, but if you put subs there, it will ruin the compression. Lots of sharp edges which will need lots of bits
Reply With Quote
  #8  
06-17-2003, 02:48 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@Boulder

Yes, that's probably true, but if I put the subs on the actual movie area they will cover too much of the movie. That's only my opinion though...
I encoded "Red Dragon" with and without subs (with my previous posted "Letterbox()" parameters) and the CQ only changed ~0,2 units! Higher CQ value on the version without subs. That's quite acceptable don't you think?
Anyway, now I'm using the script from June 16. The one with "GripCrop()" instead of "Letterbox()"...
__________________
AudioSlave
Reply With Quote
  #9  
06-17-2003, 03:54 AM
sh0dan sh0dan is offline
Free Member
 
Join Date: Mar 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
In general: Subs in movies should be avoided - but for VCD/SVCD there is no other way (that I know of).

When encoding subs: Try to put them in in a black area, as it will take up considerably less space here. The reason for this is motion estimation, which is suffering, when static text is placed on a moving background. Static text on a static background take up some space, but much less than compared to text on movie.

When encoding in general: Try to avoid black borders. Even a few pixels will compress worse than a border to border picture. Again this a because of motion estimation.
__________________
Regards, sh0dan // VoxPod
Reply With Quote
  #10  
06-17-2003, 09:20 AM
Boulder Boulder is offline
Free Member
 
Join Date: Sep 2002
Location: Lahti, Finland
Posts: 1,652
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sh0dan
When encoding subs: Try to put them in in a black area, as it will take up considerably less space here. The reason for this is motion estimation, which is suffering, when static text is placed on a moving background. Static text on a static background take up some space, but much less than compared to text on movie.
This is true, and I stand corrected. However, in my tests, the difference was very small, 18592857 bytes (subs on film area) vs. 18533161 bytes (subs on borders).

Quote:
When encoding in general: Try to avoid black borders. Even a few pixels will compress worse than a border to border picture. Again this a because of motion estimation.
This is not entirely true. Overscan blocks do increase compression. I did a small test on a clip from Monty Python's The Meaning of Life. Here's the script I used:

Code:
MPEG2Source("e:\temp\dvd-rip\python.d2v",idct=5)
Crop(10,82,-10,-86)

SimpleResize(480,416)
AddBorders(0,80,0,80)

#SimpleResize(464,416)
#AddBorders(8,80,8,80)

#SimpleResize(448,384)
#AddBorders(16,96,16,96)

#SimpleResize(432,384)
#AddBorders(24,96,24,96)
I tried different sizes of overscan blocks, from zero to 24 pixels. I resized the clip to get the AR error less than 2% in every case.

The results:

0 pixels: 19 979 667 bytes
8 pixels: 19 809 823 bytes
16 pixels: 18 646 548 bytes
24 pixels: 18 418 530 bytes

Here we can see that even 8-pixel borders increase the compression. When the borders fill one complete macroblock (16 pixels), the compression is quite big, as would be expected. My TV crops about 24 pixels off the sides and about 20 at the top and bottom at resolutions 480x576 and higher so I use 3 overscan blocks. At smaller resolutions, 2 overscan blocks do the trick.
Reply With Quote
  #11  
06-17-2003, 09:59 AM
sh0dan sh0dan is offline
Free Member
 
Join Date: Mar 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
@Boulder: Right! I was talking about clips with different sizes - but didn't make that clear in my post.

My point is just, that borders aren't free, if the picture size remains constant. Best compression is always achieved by compressing the smallest possible picture, without borders. If you crop off the borders from the letterboxed picture you are compressing, I'm sure you'll get smaller files.

So the borders are far from "free" - however the easier compression is quite likely to outweigh the wrong motion estimation, when parts of the picture gets cropped by the borders.
__________________
Regards, sh0dan // VoxPod
Reply With Quote
  #12  
06-17-2003, 10:21 AM
Boulder Boulder is offline
Free Member
 
Join Date: Sep 2002
Location: Lahti, Finland
Posts: 1,652
Thanks: 0
Thanked 0 Times in 0 Posts
I should have thought about that too, looks like we're both in the right

Your suggestion is what MPEG-4 people have to keep in mind, right? Give DivX/XviD small borders and it will kill the quality whereas in VCD/SVCD/XVCD/KVCD encoding the borders are your friends when used correctly.
Reply With Quote
  #13  
06-18-2003, 10:50 AM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sh0dan
In general: Subs in movies should be avoided - but for VCD/SVCD there is no other way (that I know of).

When encoding subs: Try to put them in in a black area, as it will take up considerably less space here. The reason for this is motion estimation, which is suffering, when static text is placed on a moving background. Static text on a static background take up some space, but much less than compared to text on movie.

When encoding in general: Try to avoid black borders. Even a few pixels will compress worse than a border to border picture. Again this a because of motion estimation.
Thanks for the tips

What about Vobsub's fade in/out feature for subs? Does it make it compress worse?
Reply With Quote
  #14  
06-18-2003, 12:26 PM
sh0dan sh0dan is offline
Free Member
 
Join Date: Mar 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Fading will in most cases make it harder to compress.
__________________
Regards, sh0dan // VoxPod
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: MaskTools based adaptive script? marcellus Avisynth Scripting 3 04-21-2004 01:00 PM
FACAR et dvd2svcd + adaptive script? WaSaBi Conversion et d'Encodage de Vidéo (Français) 0 11-02-2003 01:28 PM
KVCD: Where is the Motion Adaptive Script? kwag Video Encoding and Conversion 0 08-13-2003 02:22 PM
Avisynth: Optimal script now fully adaptive kwag Avisynth Scripting 117 07-04-2003 06:10 AM
Avisynth: AVS 2.5x Script, Motion Adaptive Filtering problems? Bchteam Avisynth Scripting 15 05-31-2003 12:38 PM

Thread Tools



 
All times are GMT -5. The time now is 11:06 PM  —  vBulletin © Jelsoft Enterprises Ltd