Multiple \pos tags in one line, any way to use them?
I've started to collect the eia-608 captions of my DVD/VHS videos after I found out ffmpeg can convert them to .ass format maintaining positions, text color, etc.
But I recently found that lines tend to not really follow the original, intended layout. And it seems to be because the converter applies multiple \pos tags in the same line.
DVD on CRT:
VLC/MPlayer/WiiMC after converting to ass with ffmpeg:
Only the first \pos is represented. Note, there's a slight difference because the DVD player shrunk/letterboxed the image, and the captions are always fixed to the same spots they are designed to be in.
Here's a snippet:
[Script Info]
; Script generated by FFmpeg/Lavc
ScriptType: v4.00+
PlayResX: 384
PlayResY: 288
ScaledBorderAndShadow: yes
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Monospace,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,3,1,0,7,10,10,10,0
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:42.51,0:00:47.52,Default,,0,0,0,,{\pos(38,243)}{\i1}♪ TAKE LIFE ONE DAY AT A TIME ♪
Dialogue: 0,0:04:48.25,0:04:53.76,Default,,0,0,0,,{\pos(38,197)}I AM CONFUSED.\N{\pos(115,228)}GOOD. CONFUSION\N{\pos(115,243)}IS A PART OF LIFE,
Dialogue: 0,0:04:53.76,0:04:56.26,Default,,0,0,0,,{\pos(115,228)}AS ARE VENGEANCE,\N{\pos(115,243)}FEAR AND LOVE.
Dialogue: 0,0:04:56.26,0:04:59.76,Default,,0,0,0,,{\pos(76,243)}ALL FACETS MUST BE EMBRACED,
If this is a limitation, I plan to try and make a converter that replaces the extra \pos tags into new lines. Though it would be a waste of space and pretty tricky to do. Maybe ffmpeg has an option to do this, I'll look into that eventually.
Another problem with this idea is font size, the \N connects the lines so that changing font size will make both change evenly, but if the linebreak is "simulated" with \pos then changing the font size will not re-position the top part of the font, creating an overlap if the scale is too great. I hope that makes sense. A way to combat this would be to keep \N and read the x on \pos to replace it with adequate \h spaces. A monospaced font is needed anyways for best results.
It is impossible to have multiple \pos tags per Dialogue event. Just split them into multiple Dialogue events. Given that every one of your lines has a \pos, this is actually much less tricky than in the general case, although you’ll presumably want to collect and reapply other tags such as \i1 if FFmpeg doesn’t already repeat in on each line.
If you do this, I assume it’d be great to have the patch submitted to FFmpeg so that other people could benefit from it, too.
Another problem with this idea is font size, the \N connects the lines so that changing font size will make both change evenly, but if the linebreak is "simulated" with \pos then changing the font size will not re-position the top part of the font, creating an overlap if the scale is too great. I hope that makes sense.
I think I understand what you’re saying, but I’m not sure I understand why: it sounds more like a wish that the DVD-to-ASS converter wouldn’t have used \pos in the first place. If that’s what it is, yes, I suppose it makes sense, although I don’t know the source subtitle format enough to tell whether this is possible.
I wanted to do it a bit more involved, split to new dialogue events but also calculate the y pos to determine if it's supposed to be a linebreak (this would avoid the overlap issue.) But I couldn't get it working perfectly, so I just stuck with splitting every \N to a new line. And I'm quite satisfied with the result, the overlap issue isn't much of a problem anyway.
The only thing that still sticks out is when a line uses \h to adjust itself on screen, this makes BorderStyle 3 render unnecessarily the blank space. I need to compare this more with how it is on TV, my dvd player is broken, so I only have a few photos to compare with. But otherwise it's fine.
I'm gonna leave the tool here in case anyone runs into the same issue. I would like to tackle ffmpeg, too, but for now I'll try submitting a bug report and see what they think of it.
If the CC data is not saved correctly (usually VHS recordings) ffmpeg might add multiple \N to 1 dialogue event, but since the EIA-608 standard only mentions 4 lines being possible, I have this limit in place, so those files will not be adjusted correctly with this tool.
EDIT: Update with support for splitting italic tags across events, only when \i0 is not found. EIA6082SubStationAlpha_italics.zip
I think all questions were answered, but feel free to reopen if there’s something unresolved i missed