SRT or TXT subtitles to XML or PRTL converter (PHP script)
Bulk import of subtitles into Final Cut Pro (6,7) or to Adobe Premiere CC is a problem. Following php script subxml.php is my solution developed for One World international documentary film festival. // český manuál pro windows [cz] Easiest way to import subtitles is generating Final Cut Pro XML timeline file. Since Adobe Premiere CC doesn't understand all the font parameters of FCP XML, you have to mangle with premiere's own PRTL format. get the script: subxml.php SRT to XML subtitler ==================== parses .srt subtitles or .txt (utf-8) dialogue script (blank line separated) to XML timeline suitable for import to final cut pro. or to directory of PRTL files for import to adoshit premiere CC. usage: php subxml.php -i infile.[srt|txt] -o outfile.xml optionaly, you can use mode for generating directory of PRTL titles use parameter -blackbox to generate black overlays to hide original subtitles usage: php subxml.php -i infile.[srt|txt] -o outputdir -prtl [-blackbox] examples: ========= php subxml.php -i AngryInuk.txt -o angryinuk -prtl generates folder angryinuk with prtl files out of dialogue script in AngryInuk.txt (utf-8 encoded!) php subxml.php -i AngryInuk.txt -o angryinuk –prtl –blackbox the same, with blackbox overlays to hide original subtitles php subxml.php -i AngryInuk.srt -o angryinuk.xml generates final cut pro xml timeline out of srt known bugs ========== * in PRTL mode, more than 2 lines per title slate makes premiere crash. probably problem of persistentID and objectID [see PRTL] * blackboxes work only in -prtl mode and are not well-aligned * single line subtitles could be aligned lower to title safe line * tested on cygwin php under windows only // https://www.cygwin.com/ is a // toolbox of unix tools for windows. install with all the php packages * accepted-encoding of txt and srt is utf-8 only. use iconv to convert the encoding e.g. iconv -f windows-1250 -t utf-8 inputfile.srt > outputfile.srt to convert czech windows-1250 encoding to utf-8 * some parameters (font-size, screen-resolution, timebase etc..) are hardcoded into script. change the variables in the editor to work for you. * timing from srt is ignored in prtl mode now. should generate XML referencing PRTLs too. * sub-optimaly tested. made to work in my case. improvements and bug-reports mail to klokanek (*) eldar (doot) cz EOF Comments requested ~~~~~~~~~ Binary Sxizophreny - index of comp related stuff Kangaroo's Homepage (czech)