воскресенье, 30 октября 2016 г.

Spreadsheet tool to convert between .srt and .txt

Movie subtitles (*.SRT)

Audacity does not yet directly support movie subtitle files (*.srt). This page explains the use case for *.srt support in Audacity and offers tools to convert an .srt file to and from a .txt file which can display the subtitles as Audacity labels.

Contents

 [hide

Use Case

You can already use Audacity's labels feature to read or write subtitles (such as translations, transcriptions or comments) for a movie audio track. Use the current Audacity and add the optional FFmpeg library to your computer. This will allow you to import the audio from a video file such as AVI or MPEG, or from a VOB file from an unencrypted DVD. Then convert your .srt file to .txt using the converter below and choose File > Import > Labels to import the .txt file.
You can also use movie subtitles in Audacity to record your own dubbing of the subtitles and then mix your voice into the movie audio track.
Unfortunately the layout of timings and text in .srt subtitle files is slightly different to that used in the .txt files for Audacity labels. It would be easier if you could directly import and export .srt files instead of having to convert them to .txt to import them into Audacity, then convert them back to .srt for use in a video player. Other features suggested in Proposal Transcription Editor would also improve the experience of working with subtitles in Audacity, such as:
  • A movie window synchronised with the audio track
  • A way of nudging labels along with a shortcut in order to position them accurately
  • Text-to-Speech (TTS) support in Audacity would allow a synthesized voice to read or record the subtitles automatically.

Label2Srt: Label to SubRip / subtitles (.srt) converter

Label2Srt is a small open source Java application to convert label files into SubRip (.srt) files, written by AndrewTheArt. This is similar to Label2Cue released about 6 years ago.
See relevant forum post here.
SRT files are subtitle files that can be read by many video players (including Youtube)

Step 1: Create the label files in Audacity

In order to do the conversion, first create labels in your audio file in Audacity one of two ways:
  • (Method 1) Drop a label at specific location with CTRL+B and stretch it to create a "time span" for the subtitle. Name the label if you wish. This is the preferred method.
  • (Method 2) Drop a label at with CTRL+B. Drop a second label at another position. Name the labels if you wish. Label2Srt treats the first label as the start of the subtitle and the second label as the end of the subtitle. Repeat as many times as you want.
Label2Srt deals with both cases. In Method 2, a time span is created in the SRT from Label 1 to Label 2, then from Label 3 to Label 4, then from Label 4 to Label 5, and so on.

Step 2: Export the labels

In Audacity, select File > Export Labels and name your exported label file. It will be saved as a plain text document that represents the label positions in seconds (and optionally, the label titles).

Step 3: Execute the Label2Srt program

In both operating systems (Windows and Linux) you can simply double click on the jar file.
In Windows, you might also try right clicking on the file and selecting "Open With -> Java(TM) Platform SE Binary".
Optionally, execute,
java -jar Label2Srt.jar
via the Windows / Linux command line.

Step 4: Use the Label2Srt program

Select the label text file with "Select" button which opens a file browser. Then, press "Convert". The new SRT file is saved to the same directory as the label file.

Contact with Bug Reports

andrew1stein - AT - gmail - DOT - com

Spreadsheet tool to convert between .srt and .txt

Supported formats: Audacity Labels (TXT), Movie SubRip Subtitles (SRT), YouTube Captions (SBV)
It is an .xls (Microsoft Excel) file with a single sheet and two macros. To open it you have to install a spreadsheet application such as Microsoft Excel or OpenOffice.org.

Opening the Convertor

After opening the .xls file you may have to give authorisation for the macros to run. To do this you can just enable macros at the security prompt (menu bar or popup window) or better could be to mark the signed publisher (mederi) as a trusted source. Marking as "trusted" will remove any further prompts when you re-open the file. You can also either reduce the default security level for all documents (not recommended) in the spreadsheet tool's options, or add the location (folder) you are opening the file from in a list of trusted locations.

Converting Subtitles.srt to Labels.txt and vice versa

Follow the simple instructions in the file. There is an example of .srt format subtitles in the first column on the left.
To convert the movie subtitle file (*.srt) content to Audacity label file (*.txt) format:
  1. Press the SRT to TXT >> button - the converted content will appear in the three columns on the right
  2. CTRL + C to copy
  3. Open a text editor that supports Unicode or UTF-8 like Notepad++
  4. CTRL + V to paste the content in
  5. Save the file in UTF-8 or Unicode encoding with .txt extension.
If you use Microsoft Notepad (included with Windows) to save the file, be sure to use File > Save As and choose UTF-8 or a Unicode encoding. If you just File > Save, the file will be encoded in ANSI. This will result in Audacity not being able to open the saved file properly if it contains other than English characters.

Converting from .txt to .srt after exporting the labels.txt file from Audacity is similar:
  1. Open labels.txt in the text editor
  2. CTRL + A followed by CTRL + C
  3. Open the .xls file
  4. Click in column G of row 4 and CTRL + V to paste into the three columns on the right
  5. Press TXT to << SRT to place the result in the single column on the left
  6. Now you can copy this content, paste it into your text editor and save it with .srt extension (ANSI encoding should be fine).

1 коммент.:

  1. Ответ ещё проще. Открыть в исходной панели корневую папку, включающую всё необходимое, перейти в режим показа файлов без подкаталогов (Ctrl+B) - и копировать. Но если в разных исходных подкаталогах есть одноимённые файлы, хорошенький конфликт имён при копировании гарантирован. Внимательно следить за запросами на перезапись!

    ОтветитьУдалить