Talk:Closed Captions

From Valve Developer Community
Jump to: navigation, search

One of my favourite benchmarks for when to add stuff to the VDC is when I look for info and don't find any. Case in point: I just spent the entire evening wrestling with why my closed caption edits had stopped working. Did I need to use scene_flush? Did I need to restart Source and/or Steam after editing the file? Did I need to make sure I had the right spaces and carriage returns? Eventually I discovered that it was because I had stopped editing the file with Notepad and had started using Textpad instead. Simple mistake, a lot of time wasted. :)

I'm not much of a programmer, so I'm not really familiar enough with the various different ways of encoding text files (ASCII/binary/unicode/etc) to know what Textpad was doing to them that Notepad didn't. Perhaps someone with more know-how can find out and make my Note more precise?

Anyway, this week looks likely to be Learn Closed Captions Week for me, so I'll probably be back a few times to flesh out this page with a few more discoveries. --Giles 13:32, 15 May 2006 (PDT)

i've been trying to get the closed captions to work in a mod that's based off of the source sdk base... have tried using notepad, wordpad, textpad, MSdev 2005... nothing works. the caption aliases show up under cc_emit's list but calling them produces no output at all. not even the caption box. the default captions that are stored in the .gcf can be called but they're missing the last line to be printed. if you call a 1 lined caption you get the caption box but no output. if you call another 1 liner you get the previous caption's text.

- Paegus 2007/01/22 02:47 (GMT)


Does someone know when this tool will be available ? Because the one given on this page keeps crashing... --NykO18 04:24, 23 Feb 2008 (PST)

It works for me. Run it from CMD (win+r, "cmd", enter) and you'll catch any error messages. --TomEdwards 04:54, 23 Feb 2008 (PST)
I'm talking about a Portal mod, under the Orange Box Engine. Basically, I already run it from CMD. Here's what it does :
C:\Jeux\Steam\steamapps\nyko18\sourcesdk\bin\orangebox\bin>captioncompiler.exe "C:\Jeux\Steam\steamapps\SourceMods\portal mod\resource\closecaption_english.txt"
And then :
Unhandled exception at 0x0b543c3e in captioncompiler.exe: 0xC0000005: Access violation reading location 0x00bb7580.
I have the Beta SDK installed, don't know if it can interfere. --NykO18 09:14, 23 Feb 2008 (PST)
It only works with -engine ep1 according from what I've just done. Try it.--Hurricaaane 09:15, 23 Feb 2008 (PST)
Yes, it looks like it. You don't need to use that command line though (and we can't anyway, since the beta doesn't have it) - just move the compiler to the ep1/bin/ folder. --TomEdwards 09:29, 23 Feb 2008 (PST)
Unfortunately the DAT file isn't compatible with the OB. :-( --TomEdwards 09:35, 23 Feb 2008 (PST)
Yes, looks like it's not. Damn it! I hope they'll release it before I finish my mod.. --NykO18 10:30, 23 Feb 2008 (PST)

Captioncompiler.exe was released

There we are ! The Orange Box captioncompiler.exe was released with the March 24th update of the SDK. And it seems to work perfectly, thanks Valve. --NykO18 15:54, 24 Mar 2008 (PDT)

Hmm, Ok. I think I talked a bit too fast. It works, but it doesn't seem to support the new features like colors, italics, bold and all, doesn't it ? Or am I just doing something wrong ? --NykO18 15:16, 1 Apr 2008 (PDT)
C:\Documents and Settings\Nicolas>"c:\jeux\steam\steamapps\nyko18_2\sourcesdk\bin\orangebox\bin\captioncompiler.exe" "C:\Jeux\Steam\steamapps\SourceMods\my portal mod\resource\closecaption_english.txt"

Valve Software - captioncompiler.exe (Mar 11 2008)
--- Close Caption File compiler ---
gamedir[ c:\jeux\steam\steamapps\SourceMods\my portal mod\ ]
infile[ resource\closecaption_english.txt ]
outfile[ resource\closecaption_english.dat ]
Compiling Captions for 'resource\closecaption_english.txt'...
Found 300 strings in 'resource\closecaption_english.txt'
Longest string 'myportalmod.level_07_test_18_entry-4' = (434) bytes average(136.533)
5 blocks (8192 bytes each), 2818 bytes wasted (563.600 per block average), total bytes 40960

directory size 300 entries, 3600 bytes, data size 40960 bytes
Well, nevermind. I don't know if there's some caching with the compiled .dat files, but colors, italics and bold just appeared although I compiled the files 2 days ago. I really don't know what's happening. --NykO18 15:16, 1 Apr 2008 (PDT)
Okay, I'm running into a problem - regardless of what format I save my text file in, captioncompiler says "Ignoring non-unicode file." I've tried saving in two different Unicode formats, as well as ASCII and DOS. The only thing I haven't tried is UTF-8 (which I'll be trying tonight). Suggestions? -- BlackWolfe 10:23, 29 Jun 2008 (PDT)
Nevermind. I found the problem - all of the tags (lang, Language, Tokens, and the individual token names) need to be in quotes. And here I was treating it like a code snippet. -- BlackWolfe 21:29, 3 Jul 2008 (PDT)
Quotes are only needed if there's a space or tab within a block of data. Save yourself some typing. :-) --TomEdwards 00:52, 4 Jul 2008 (PDT)
Does that include underscores? Because I had no whitespace outside of the actual captions, which WERE in quotes. -- BlackWolfe 17:54, 5 Jul 2008 (PDT)
Underscores are OK. That's weird. You must had a space somewhere you weren't seeing. --TomEdwards 01:47, 6 Jul 2008 (PDT)
Possibly - or maybe too much whitespace between a name and its value. Either way, putting quotes around the value names fixed it, so I'm good. Now to fake forty-plus lines of GLaDOS dialog. For the moment, I've just got filler files made with a free TTS package. -- BlackWolfe 14:08, 9 Jul 2008 (PDT)

Ep1 compiler

Judging by this article and the discussion on this page, and the discussion here:

It seems like it is necessary to compile captions if you want to use them with the ep1 engine.

Searching through my sdk folder, I can only find the Orange Box compiler. I've been asking around as well, and no one seems to have an ep1 compiler. They only have the OB compiler.

What is this supposed to mean? Am I going crazy?

- Nih 2008/05/30 01:26 (GMT+1)

I found this bug in bugzilla:

Looks like the EP 1 caption compiler simply hasn't been included with the sdk. I've tried using the temporary download location on that page, but I simply get a file called attachment.cgi. Does anyone know where I can get the file?

- Nih 2008/05/30 13:44 (GMT+1)

You can get it here. I'd try using the orangebox compiler first though, as it may well be backwards-compatible. --TomEdwards 04:52, 30 May 2008 (PDT)
When I move my captions onto the ep1 and ob compiler, it ends too fast for me to read anything.
Using the ""%sourcesdk%\bin\orangebox\bin\captioncompiler.exe" %1
pause" trick simply produces this:
With the ep1 compiler
With the orangebox compiler
It doesn't work with the valve-made captions either.
Any tips? - Nih 2008/05/30 16:37 (GMT+1)
It's looking in resource\c:\.... Obviously you don't want that "resource" on the front there. I've never seen that myself so I don't know what you're doing wrong, but presumably it's related to the shortcut you're using. --TomEdwards 09:06, 30 May 2008 (PDT)
Actually, here's a thought: add quote marks around %1 as well. --TomEdwards 09:10, 30 May 2008 (PDT)
Didn't help. Here's what I'm doing: In my .cmd I have written:
"%sourcesdk%\bin\ep1\bin\captioncompiler.exe" "%1"
My .cmd file is located in C:\Steam\SteamApps\SourceMods\EnemyWithinmaj27\resource. So is my closecaption_english.txt. My captioncompiler.exe is located in C:\Steam\SteamApps\\sourcesdk\bin\ep1\bin, and I have placed an additional closecaption_english.txt there, just for good measure. Dragging my closecaption_english.txt unto the .cmd produces the results I showed above. --Nih 18:48, 30 May 2008 (GMT +1)
I can't reproduce that here. This is my CMD, which works with both ep1 and orangebox:
"%sourcesdk%"\bin\ep1\bin\captioncompiler.exe %1
I was wrong about "%1" by the way - Windows inserts quotemarks automatically. --TomEdwards 03:02, 31 May 2008 (PDT)
OK, I've worked it out now. You need to select the game you're compiling for in the SDK launcher before running the program. --TomEdwards 03:04, 31 May 2008 (PDT)
That seems to have helped, as I managed to create a .dat file. Log: jpg
Unfortunately, it produces very strange problems in-game. Sometimes the text isn't displayed, sometimes it's delayed, sometimes the text goes out of the box, and sometimes the text crosses over other text. It works perfectly fine when I set steamappid to 220 and it reads the .txt, but when I set it to 215 and it reads the .dat it simply goes crazy. Perhaps the .dat isn't being compiled right? --Nih 16:52, 31 May 2008 (GMT +1)
Never had that myself. Perhaps you're a doublequote short in the text file? You can use text highlighting to quickly check. --TomEdwards 08:58, 6 Jun 2008 (PDT)

A strange bug I'm getting ...

I'm making a VCD scene for my mod; thing is, the closed captions don't always seem to want to work. In particular, a two-word exclamation of "Happy hunting!" at the end shows up fine in faceposer, it's perfectly audible, but the closed caption never appears, no matter what I do. I'm wondering if it's because it's so short (less than two seconds and just under 30kb) ... everything else is working just fine. I know it isn't improperly named, because I've copied and pasted it, twice. —Yar Kramer 10:10, 14 Aug 2008 (PDT)

Faceposer still reads from the text files, but the game will only load the compiled binary blob. --TomEdwards 10:34, 14 Aug 2008 (PDT)
I know about that ... I've tended to recompile the blob at least three times throughout my attempts to solve this. Adding to the confusion: all but the last caption work just fine when I load the mod through steam. Only the first caption appears when I test the map from within Hammer. —Yar Kramer 14:29, 14 Aug 2008 (PDT)
I'm somewhat having the same problem. Although, I have more than 450 lignes of closed captions, and in-game, there's a few of them that never show up when the NPCs are talking. The strange thing is that it shows up perfectly when I call them using cc_emit <soundname>... But not when the NPCs are talking. I noticed that it's always a continuous part of the captions that doesn't show up. I mean that, it's not one isolated caption, it's always a dozen of them in row. It stops working at a given caption, and restarts to work at another one. Always the same. --NykO18 08:50, 18 Aug 2008 (PDT)
I'm actually wondering if the problem isn't choreo-related. Could it be FacePoser 'the crappy' that messes up the .VCD preventing them to show up the closed caption? I'm wondering this because, when I made them (the vcds), I copy/pasted each one in a row to build my dialogues until I decided to take a break and start with a brand new empty choreo a few days later. That could explain why subtitles are not showing up in a row. I also tried to rewrite one VCD from scratch and there had been change. One closed caption showed up where it wasn't. It needs to be investigated a bit further. --NykO18 10:17, 22 Aug 2008 (PDT)
I don't think that's it -- I'm pretty sure I've gotten different results for different compiles of the same map, without having even touched FacePoser in the interim. —Yar Kramer 09:50, 24 Aug 2008 (PDT)
Ok, I found it. That was particularily stupid. In my case, it's a problem with Portal, because basically, GlaDOS is a generic_actor in a box far away from the map. And in the source engine, there's a command named "scene_maxcaptionradius" with a default value of 1200. This is why it stopped working at a given choreo... when the player was too far from the generic_actor. My god... several weeks, maybe months, wasted because of this. I can't believe it was so stupid. --NykO18 11:37, 25 Aug 2008 (PDT)
Ahaaaaaa. Yeah, that'd do it ... Me, I'm trying to do set up a system so that the player is being continually radioed by his home base, kinda like Alyx at one point in Nova Prospekt. I wonder if there's a better way to do it ... —Yar Kramer 09:09, 27 Aug 2008 (PDT)
Off the top of my head, make the actor who speaks !player. ambient_generic is also an option if you're simply playing sound files. --TomEdwards 12:29, 27 Aug 2008 (PDT)
Nope, ambient_generic are not a solution, because when you pause the game, they're not paused at all, and the NPCs continue to talk. Also, there's nothing else to do than just increasing the value of "scene_maxcaptionradius". I set it to 65535, just to be sure. --NykO18 15:59, 27 Aug 2008 (PDT)
And that was not the correct solution. First because zero is the official value to disable this command, and not some ridiculously large number. And second because if it's related to choreos, you should just add cc_noattenuate in each entry of the .VCD file you want the captions to always appear (see after). --NykO18 16:29, 26 Sep 2008 (PDT)
event speak "prelude.level_01_test_00_success-1"
    time 0.433333 6.379070
    param "prelude.level_01_test_00_success-1"
    cctype "cc_master"
    cctoken ""

Adding captions to TF2

I've been working on a mod for TF2 that adds closed captions/subtitles, and it's nearing completion (for English at least). However, there is one issue: the Announcer's lines never appear. Every other classes' lines appear as would be expected (similar to the sample image in the article), but the Announcer's do not. If anyone would be willing to help me, or point me in the right direction to find an answer, I would greatly appreciate it. Sven 23:09, 24 June 2012 (PDT)

  • cough* Yes, seriously. I'd like some help with this so I can stop sitting on these files. Sven 22:49, 12 July 2012 (PDT)
From my understanding the announcer lines are actually going into a separate voice channel "CHAN_VOICE2", and are therefore not able to be captioned. I don't know if Valve did this to make sure the Announcer lines were less likely to be cut off or not, or if there was a separate reason. Note that this is only an assumption; I would have to test this with a modified game_sounds_vo.txt to be sure (and will probably test that soon). In addition, I've had a complete-at-one-point TF2 captions project ( )- would you care to collaborate on this? --Programzeta 21:33, 25 July 2012 (PDT)

Strange glitch

I've been unable to compile custom closedcaptions to Portal 2. There are no errors, but the problem is that captioncompiler.exe sets a very, VERY weird outfile path.

When I'm dragging txt file on exe nothing happens.

When I'm using cmd in C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin localization with command captioncompiler.exe "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2\resource\subtitles_english.txt" this is what I'm getting:

================== (to seperate code from my question)

gamedir[ C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\ ]

infile[ resource\c:\program files (x86)\steam\steamapps\common\portal 2\portal2\resource\subtitles_english.txt ]

outfile[ resource\c:\program files (x86)\steam\steamapps\common\portal 2\portal2\resource\subtitles_english.dat ]

ILocalize::AddFile() failed to load file "resource\c:\program files (x86)\steam\steamapps\common\portal 2\portal2\resource\subtitles_english.txt".

Unable to add localization file 'resource\c:\program files (x86)\steam\steamapps\common\portal 2\portal2\resource\subtitles_english.txt'

================== (to seperate code from my question)

As you can see both infile and outfile paths make literally no sense. BUT! I've decided to go a step further and use a batch script found on this wiki.

The script looks like this

"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\captioncompiler.exe" %1 -game "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2" -d 0 pause

When I drag my txt file over it, I get no errors, but the file isn't saved anywhere. The problem is obviously... an outfile path.

Here's what the cmd output I got:

================== (to seperate code from my question)

--- Close Caption File compiler ---

gamedir[ C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2\ ]

infile[ resource\subtitles_english.txt ]

outfile[ C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2\resource\c:\program files (x86)\steam\steamapps\common\portal 2\portal2\resource\subtitles_english.dat ]

Compiling Captions for 'resource\subtitles_english.txt'...

Found 2750 strings in 'resource\subtitles_english.txt'

Longest string '#commentary\com-destruction.wav' = (5608) bytes average(241.292)

81 blocks (8192 bytes each), 29584 bytes wasted (365.235 per block average), total bytes 663552

directory size 2750 entries, 33000 bytes, data size 663552 bytes

CDynamicFunction: Closing library 'Kernel32.dll' (75880000)

================== (to seperate code from my question)

I found out that using this method, the output file is made like that: game_path_given_in_a_bat_script\resource\the_location_of_my_txt

So EVEN ignoring the game path, the outfile would look like resource\c:\... and that makes NO SENSE!

Is there a way to manually set an outfile location? Or any other way to fix this issue?

Thanks for help

Mazab IZW