Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Change subtitle timing from frames to time #748

Closed
wzdev-ci opened this issue Jul 24, 2009 · 29 comments
Closed

Change subtitle timing from frames to time #748

wzdev-ci opened this issue Jul 24, 2009 · 29 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by Kreuvf


It seems like the overlay texts lag behind. See the introductory video for campaign 1, it is quite noticeable there.


Issue migrated from trac:748 at 2022-04-15 19:02:33 -0700

@wzdev-ci
Copy link
Contributor Author

Buginator commented


Can you be a bit more specific? Which part? What does the text in question begin with?

(I don't really have the time to sit and watch the whole thing, but the last time I did, I didn't see it was off by that big of a margin.)

@wzdev-ci
Copy link
Contributor Author

cybersphinx commented


I think that was messed with when the videos were not available, to have the subtitles not show with the original timing, but directly one after another. Not sure if it was restored properly when video playback was reimplemented.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Sep 4, 2009

cybersphinx changed title from Video overlay texts do not match video to Video overlay texts/subtitles do not match video

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Sep 6, 2009

anonymous commented


I likes to helps but no information is seen to fix this! Points me to directions!

I have French videos I like to use in wz how do I converts them and then uploads to svn to includes more French people?

thanx

@wzdev-ci
Copy link
Contributor Author

Ronny.Standtke@... commented


I noticed the same problem with warzone 2.2.3 (self compiled under Kubuntu-9.04) and the high quality videos. The text lags significantly behind the video. When using the low quality videos the lag is smaller but still very noticeable.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 5, 2010

Buginator commented


Replying to Warzone2100/old-trac-import#748 (comment:4):

I likes to helps but no information is seen to fix this! Points me to directions!

I have French videos I like to use in wz how do I converts them and then uploads to svn to includes more French people?

thanx

To convert the vids, there is rpl2avi in the tool directory of svn/trunk, then you need to convert them to theora.

However, I am not sure if we are allowed to have those videos.

Replying to Warzone2100/old-trac-import#748 (comment:5):

I noticed the same problem with warzone 2.2.3 (self compiled under Kubuntu-9.04) and the high quality videos. The text lags significantly behind the video. When using the low quality videos the lag is smaller but still very noticeable.

The only real way to fix them is for someone to tweak the values the game uses. Unfortunately, we don't have the time to fix it ourselves at this time. Patches will be gladly accepted.
You would need to fix the values in base\sequenceaudio\camX where X is campaign number, and the files are plain text, either *.txa or *.txt.

@wzdev-ci
Copy link
Contributor Author

Emdek commented


I've started to experimenting with converting frame numbers to make it match.
I've modified intro subtitles and it works much better now, after multiplying frame number by 0.6055.
I'll attach strings file.
I've created small PHP script to convert these files, I can convert others too (probably multiplier will be the same).
By the way, these texts should be frame independent, they should be shown depending on time, not frame number.

@wzdev-ci
Copy link
Contributor Author

Emdek uploaded file devastation.txt (1.3 KiB)

data/base/sequenceaudio/devastation.txt, tested on trunk

@wzdev-ci
Copy link
Contributor Author

cybersphinx commented


Maybe http://pastebin.com/mSHCSufS helps to find how things were changed, interesting files are probably src/seqdisp.c, and maybe those in lib/sequence.

@wzdev-ci
Copy link
Contributor Author

Emdek commented


It looks like we need to rework all these values in data files anyway, maybe we could move to use video time (looks safer than depending on frame number)?

In lib/sequence/sequence.c we have function:

// get relative time since beginning playback, compensating for A/V drift

static double getRelativeTime(void)

Maybe it could be used for checking time insetad of frames?

@wzdev-ci
Copy link
Contributor Author

Emdek commented


Here is patch:

http://wklej.to/ah8D

It does following:

  • frame number replaced by seconds for subtitle files;

  • enables option to enable / disable subtitles;

  • adds shadow to subtitles (makes them more readable on bright background);

  • removes some not used code;

  • allows to extract translation strings directly from subtitle files.

This change needs subtitle conversion (I've converted it locally), moving it's files to data/base/messages/subtitles/ and moving audio files from audiosequence/ to audio/extras/. Additionally it looks like some files in messages/ are now obsolete (these containing duplicates of subtitles for extraction).

This would close tickets:

#747

#748

#854

#1207

#1728

@wzdev-ci
Copy link
Contributor Author

cybersphinx uploaded file subtitle.diff (18.6 KiB)

Emdek's patch inlined.

@wzdev-ci
Copy link
Contributor Author

cybersphinx commented


Basic approach looks ok, I think. How are the subtitles in the .txt files handled for translation? I think for stats or something we surrounded the strings with _("") and adapted the parser.

For the file renames, can you leave that part out for now?

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Apr 17, 2010

Emdek commented


Replying to Warzone2100/old-trac-import#748 (comment:12):

Basic approach looks ok, I think. How are the subtitles in the .txt files handled for translation? I think for stats or something we surrounded the strings with _("") and adapted the parser.
Yes, it's done this way (doesn't affect display).

For the file renames, can you leave that part out for now?
OK, this can be done later, for example with renaming ogg files, as suggested in another ticket.

@wzdev-ci
Copy link
Contributor Author

Emdek uploaded file videoframestoseconds.diff (7.9 KiB)

Part of patch that replaces frame number usage by seconds

@wzdev-ci
Copy link
Contributor Author

Emdek commented


I've prepared editor / previewer for subtitles, it can also rescale theirs timestamps using given multiplier.
I've also have small script that uses constant value (based on value used for devastation.txt) to rescale all files.
I can attach them when needed.

@wzdev-ci
Copy link
Contributor Author

Beliar commented


Hi, i also noticed that the subtitles lag behind considerably when using the german sequences. I found out, that this is due to the english videos have a framerate 25fps while the german ones have 13fps (and the game use the frames to determine the time to display the text)

I have then investigated the source and made changes to use the seconds elapsed to determine that. I also made a small python script that can automatically change the values subtitle files to seconds (actually it makes a copy of the folders containing the files and makes the changes there) - yeah, i did all that before checking for already present tickets, and i don't really mind.

If you want i can add both a patch and either the python script (after some cleanup) or the changed files. My patch isn't too much different from Emdek though - at least the part that makes the change from frames to seconds.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 2, 2011

cybersphinx changed type from bug to patch (an actual patch, not a request for one)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 2, 2011

cybersphinx changed title from Video overlay texts/subtitles do not match video to Change subtitle timing from frames to time

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 2, 2011

cybersphinx commented


The main thing missing iirc was the conversion script, but another patch can't hurt (especially if it's done anyway).

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 3, 2011

beliar uploaded file seq_text_time.diff (5.6 KiB)

Patch for subtitles to use time instead of frame

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 3, 2011

beliar uploaded file convert.py (3.4 KiB)

Python script that converts the subtitle files

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 3, 2011

beliar commented


Just another note. If I remember correctly - and nothing changed, most videos had a fps of 25, but there where a few that had a different one.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 3, 2011

beliar commented


Well, I'll upload both files. I can't guarantee that they work any more though. The python script has an optional dependency of some theora module to get the actual fps of the video files - which would my recommendation to use. I can't remember what the actual module was though. Maybe someone can replace that with something else. Anyway I updated the script so it can be run as a program. It needs Python 2.7.

@wzdev-ci
Copy link
Contributor Author

cybersphinx changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

cybersphinx changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

cybersphinx commented


Change subtitle timing from frames to seconds.

Based on patches by Emdek and Beliar. Closes #748.

@wzdev-ci
Copy link
Contributor Author

cybersphinx commented


Took a while, sorry for the delay.

Emdek: Is your subtitle editor (http://emdek.pl/testy/tmp/wz-header/SubtitlesEditor.tar.bz2) under the GPLv2+?

@wzdev-ci
Copy link
Contributor Author

Emdek commented


It can be. ;-)

I can prepare version with license and minor cleanups during weekend.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant