PDA

View Full Version : VFR, (AviSynth) TextSub placed/processed after decimation...


Mizuho
15th March 2008, 15:20
I'm a novice "fansubber" and I'm having troubles hardsubbing karaoke subtitles after 'TDecimating' a hybrid clip. I've created an ".ass" file with AegiSub, and video encoding is all processed in AviSynth.
I've gathered the tfm and stats files, encoded a 2-pass video with TDecimation mode=5, but do I have to put the TextSub *before* telecide+decimation for the subtitles to sync? If I put the TextSub line prior telecide+decimation, the result of the subtitles is rather ugly but that's the way to make them sync AFAIK. Is there a way to put the subs after TIVTC+TDec and cropping and resizing, but retain video/subtitle synchronisation?

Thanks.

manono
15th March 2008, 15:36
Hi-
Is there a way to put the subs after TIVTC+TDec and cropping and resizing, but retain video/subtitle synchronisation?
Since an IVTC doesn't change the length of the video, if putting the subs before the IVTC works, so will putting them after the IVTC. Nothing special has to be done.

Mizuho
15th March 2008, 18:26
No. I had to place the subtitles before the telecide and decimation because that's the state where the video still has it's original number of frames (9419) and length (5:14), but the moment I move the line to after the decimation, the number of frames and length change to 9050 and 5:10, respectively. Hence the subtitles are no longer synchronised with the then decimated video. Remember that we're dealing with VFR decimation here.

manono
16th March 2008, 03:46
Sorry, I had to look up what Mode=5 was as I've never used it before. It looks like the TDecimate line is where the VFR kicks in, so can you put the subs in between the TFM and the TDecimate lines?

And are you sure this thing is really a hybrid, rather than a mix of hard and soft telecine? There's really some true 29.97fps stuff, either interlaced or progressive?

Mizuho
16th March 2008, 11:22
That's the thing you see, if I put the subtitles are placed before all of the postprocessing, cropping and resizing, they get all mushy and unclean. That's why all subbers put the sub line at the very end of the AVS script because only then will the subs not be tampered with all the filters and hence retain their original resolution/sharpness.
It's definitely hybrid. I've run it through MeGUI, and it's a mixture of film and interlaced video (mostly interlaced) and TDecimate gives me an output of 19.37% film and 80.63% video from its VFRstats analysis.

manono
16th March 2008, 12:11
OK, how about making it progressive first (with TFM), and then doing the cropping, resizing, and adding in of the subs, before then sticking in the TDecimate line.
I've run it through MeGUI, and it's a mixture of film and interlaced video (mostly interlaced) and TDecimate gives me an output of 19.37% film and 80.63% video from its VFRstats analysis.
I trust automatic analysis about as far as I can throw it. Have you actually looked at the frames to see what you have? Hard telecine also qualifies as interlaced video and can be IVTC'd normally. If you don't know or understand what I'm talking about, can you upload somewhere a small sample of one of these video sections for me or anyone else to have a look? And if you're not interested in doing that, then maybe the AviSynth Forum, which is infested with anime fans, can help you with your subtitling problem.

DigitalDeviant
16th March 2008, 14:09
Why don't you make a quick encode of the decimated output without subs, time the subs to that, then encode the final video with properly timed subtitles?

Mizuho
17th March 2008, 17:56
Why don't you make a quick encode of the decimated output without subs, time the subs to that, then encode the final video with properly timed subtitles?
That would be equivalent to AegiSub's timecodes file feature where you can designate a timecodes file to the subtitles file. I've tried that but I get nowhere, and the subtitles (albeit responding to the timecodes) plays too fast relative to the video.
But if I were to do it that, I would end back at square one because when the file is decimated and the timecodes muxed, the video would still be the same length as the original, just different number of frames and framerate. I'd have to correspond the subtitles to the frames instead, which is impossible.
By the way it's a VOB file I'm processing here, and to be more specific, it's a PV - Shimatani Hitomi's, "Perseus".

Mizuho
17th March 2008, 19:17
I've uploaded an extract of the video to MegaUpload.
http://www.megaupload.com/?d=LZFSHUE2

manono
17th March 2008, 22:42
Megaupload says, "The file you are trying to access is temporarily unavailable." I'll try again later.

manono
18th March 2008, 10:18
I got it a few minutes later. My, what an interesting video. It's a true hybrid, alright. I've spotted 3 different framerates in that short section, 41.958fps (when bobbing it and removing the dupes), 29.97fps progressive and 23.976fps progressive. And there are some 23.976fps graphics over some of the 41.958fps and 29.97fps sections. The 41.958 sections (essentially interlaced video converted to partly progressive) are missing frames and play slightly jerky, although you can't tell when watching it at full speed.

If it were I, I'd put a simple:

TFM()

on it, turn it into 29.97fps progressive and be done with it, although I'd understand if you don't want to do that. But it would solve your subtitle problem. In addition, because of the purposely dropped frames, and because of the overlayed grahics on top of video of a different framerate, even using some VFR format it's never going to come out completely smooth playing, although you won't be able to tell at full speed. That's one reason I think making the whole thing 29.97fps progressive would be almost as good a solution, and certainly an easier one. As for how to handle the subs in a VFR format, I have no idea, but I bet tritical (the TIVTC developer) or some of the other folks in the AviSynth Forum would know. Thanks for making that available.

Mizuho
18th March 2008, 17:49
I've just run a trial encoding of the video with VFR decimation with the subtitles processed before IVTC and decimation. Subtitles are very rough on the edges as I expected, and on top of that, there seems to be a bobbing/fuzzing line at the very bottom whenever I add MPEG2 deblocking in the AVS script. Plus, I couldn't even fix the bitrate calculation with the old frame count and average fps lines, so the filesize was way out.
I tried using Decomb's VFR decimation, and you know it gathers the 1st pass statistics after you save the script, the result it gave me was a script with no decimation. So maybe under Decomb, it had taken discretion similar to yours.

One question. This may seem very stupid of me to ask, but must one encode a two-pass with the second pass immediately proceeding the first pass? Or can I encode the pass to gather the statistics, then leave the second pass to another day and encode as many second passes as I want so long as the first pass stats file is present?

manono
18th March 2008, 18:04
My earlier suggestion was to run the filtering in between the TFM and the TDecimate steps. Maybe there's some reason you can't do it that way. But the subs would remain untouched if you then put them as the last line before TDecimate.

I don't know the answer about running the second pass later on and as many times as you want, so the question can't be that stupid. :) I know it's possible, and I've done it many times, when encoding for XviDs in VDubMod, but I've never used MeGUI encoding for whatever you're encoding to (MKV?). You might ask in the MPEG-4 Encoder GUIs Forum where they handle MeGUI questions.

Mizuho
18th March 2008, 19:16
Oh no, I use a mixture of VirtualDub, VirtualDubMod and MeGUI. I use MeGUI for the compiling of AVS scripts, analyses, encoding; VirtualDub for preview, encoding, muxing, and container labelling. So pretty much a 50:50 ratio.

In your case, you use VirtualDub as well, so do you always encode a two-pass with the second pass immediately following the first, and not first pass - minutes, hours or days later, run second pass?

Because how I've always encoded videos is run a batch two-pass encode, with first then second pass as though they're one event, and never just second-pass even when first pass had ran earlier.

Much appreciated your input and advice, manono. :thanks:

manono
18th March 2008, 22:30
Have you said anywhere which codec you're using? As I said, it's easy to do using XviD. Just run the first pass and don't run a second pass. Run it later. You just have to point to where the stats file is before running the second pass. I used to do that because I was saving the first pass as an AVI to study before running a second pass. I rarely ran a second pass immediately after the first pass. And if the second pass doesn't come out to be the size you want, run a new second pass after adjusting the bitrate or file size.

Mizuho
19th March 2008, 22:37
I found out that progressive video and/or bobbing the video results in huge file sizes. I don't want to make it progressive or bob it. So I want to just deinterlace it, but everytime I try TDeint, FieldDeinterlace or LeakKernelDeinterlace I get fuzzy lines at the bottom. However, if I use LeakKernelDeint but turn the threshold to 0, the fuzzy line goes away.
TDeint's method of deinterlacing is cleaner and sharper, perhaps because it's motion adaptive, so how can I remove that annoying bottom line artifact whilst using TDeint?
http://i29.tinypic.com/5n80md.jpg

http://i25.tinypic.com/oi5amu.png

manono
20th March 2008, 08:15
Hi,
I found out that progressive video and/or bobbing the video results in huge file sizes. I don't want to make it progressive or bob it. So I want to just deinterlace it...
I'm sorry to say this, but that makes no sense at all. First, deinterlacing it also makes it progressive. Second, the filesize you get is entirely dependent on the bitrate you set (unless you're running single passes for a specific quant), and has nothing to do with the filtering. But yes, bobbing it doubles the framerate and will need a larger file size for the same quality, but I didn't suggest bobbing it, but only mentioned the framerate of one section after bobbing it and removing dupes.

If you just want to deinterlace it, forget about using TDeint and apply a simple TFM(), as I suggested earlier. The result will be better. TFM has TDeint as a post-processor set to deinterlace any frames that can't be field matched (and there are a lot of those).
so how can I remove that annoying bottom line artifact whilst using TDeint?
Both TDeint and LeakKernelDeint are motion adaptive. When using TDeint, you're not using it as a bobber, are you (in Mode=1)? Anyway, to get rid of the line, crop it away when done. You'll have to crop the bottom 2 pixels. You don't get that when using TFM(), do you?

Mizuho
20th March 2008, 11:59
(manono, could you please move this topic into the AviSynth usage forum? It seems more relevant there. Thanks.)
I know you didn't suggest it but I was trying out mode 2 in TDeint, and it was still giving me huge filesizes. But not to worry because...

Sorry, manono, my bad (*duh*) I had a custom matrix (Didee's Six of Nine) loaded by default and it was making the filesize sky high regardless of the bitrate I enter whether it be 500 or 1000kb/s.
:stupid:

manono
20th March 2008, 12:40
Hi-
manono, could you please move this topic into the AviSynth usage forum?
Sorry, but I don't know how. And that's even if I have that right in this Forum, which I don't think I do. If you have any specific AviSynth questions, you can open a new thread there.

Edit later: I guess I do know how and do have the right. Welcome to the AviSynth Forum, where the big boys (and girls) play. :) And on that note I'll gracefully bow out.

J_Darnley
20th March 2008, 23:30
Are these sync troubles caused by the fact that AviSynth doesn't support VFR? TextSub() will only get video of one framerate so for any sections slower or faster it will cause it to render the subs out of sync.

Perhaps a quick diagram:

Time ->
| ---- 500 frames @ 24 fps ---- || - - - - 30 fps - - - -|
|-- 500 frames @ 30 fps --|| - - - - 30 fps - - - -|
^ ^ ^
Line 1 here Line 2 here Line 3 here

You may have to split the video into different parts and then adjust the timing on the subtitles, add/remove time from all timestamps.

If I have misunderstood, sorry.

Comatose
22nd March 2008, 04:17
You need to have TDecimate generate a timecodes file, then you can either:
(a) use Framerate Transform in Aegisub with the timecodes file loaded (video -> load timecodes)
(b) mux it into a mkv, applying the timecodes to the video and also muxing the subs into the mkv (as in, a softsub)

Just to make sure you understood: if you softsub, you don't need to do the Aegisub shift.

jiifurusu
2nd April 2008, 23:20
To expand on Comatose's option (a), you first load your subtitle file, then you load the timecodes file generated by TDecimate, and then you can use the Export function (File menu) enabling the Transform Framerate filter. Make sure the Framerate option for the VFR transform filter is set to the framerate of the VFRaC (http://www.uppcon.se/thefluff/hurfdurf/?p=7) video. Export to a different filename, and use that resulting file for the hardsubbing, it has the timings adjusted to match the VFRaC frame times.

But yes, just softsubbing is easier and saves you not just headaches from repeating encodes if a QC pass fails, but also lots of bitrate ;)