Log in

View Full Version : Help, How do I cut Subtitles AlignedSplice() Trim() for Audio/Video


xekon
18th October 2011, 10:22
My Avisynth script is working perfectly to encode my audio and video using frame to frame.

But how should I handle my subtitles? I do not want HardSubs. I want to keep the subtitles seperate in their own file.

I am not sure how I can cut subtitles based on a range of frames.

here is my .avs script:


A = NicAC3Source("E:\AviSynth\job.ac3")
V = FFVideoSource("E:\AviSynth\job.mkv")
AudioDub(V, A)
AlignedSplice(Trim(2832, 16463), Trim(16632, 31295))
AutoCrop(0,2,2,0,0,0,0,30,5,0,0,0)


and my batch file:
E:\AviSynth\eac3to\eac3to E:\yyh\BDMV\STREAM\00039.m2ts 2: job.mkv 3: job.ac3
E:\AviSynth\Wavi bd.avs - | neroAacEnc.exe -ignorelength -q 0.5 -if - -of "job.m4a"
E:\AviSynth\x264 --preset veryslow --crf 22.0 --ref 5 --bframes 16 --no-fast-pskip --psy-rd 0.0:0 --aq-strength 0.2 --output "jobz.mkv" "E:\AviSynth\bd.avs"
E:\AviSynth\mkvtoolnix\mkvmerge.exe -o E:\AviSynth\finished.mkv --engage keep_bitstream_ar_info --compression 1:none -d 1 -A -S -T --no-global-tags --no-chapters E:\AviSynth\jobz.mkv --aac-is-sbr 1:1 --compression 1:none -a 1 -D -S -T --no-global-tags --no-chapters E:\AviSynth\job.m4a

EDIT: The subtitles from the Bluray are .sup format which I opened with BDSup2Sub and exported as .sub+.idx I then opened that with SubResync and converted it to SRT.

So Now I have a text SRT subtitle file.

I was thinking, Couldn't I take the number of frames that are trimmed from the opening and divide that by the FPS to get the time offset, and then just remove all subtitles prior to the trimmed section of video, and then just offset all the remaining subs?

I am actually thinking of writing a small utility that takes a frame range and adjusts srt files accordingly, but I would like to make sure that such a thing does not already exist, so far I have found nothing.

The only problem is, if you divide the number of frames by the FPS, you get a decimal number seconds.remainder, which would need to be converted to the timestamp type format that I see in .srt files, I could convert the seconds into h:m:s. and then just round the remainder to 3 decimal places, and that would give me h:m:s,ms correct?


1
00:00:20,787 --> 00:00:28,319
In a crowded city, as I
bump shoulders, I'm all alone

2
00:00:28,395 --> 00:00:34,925
On an endless prairie, as the
wind whistles by, I'm all alone

3
00:00:35,002 --> 00:00:42,408
Which one is it that makes me
want to cry more, I wonder

4
00:00:42,509 --> 00:00:49,745
Marking it with twin circles,
I feel a bit more grown-up!