Coder Social home page Coder Social logo

nwoltman / srt-to-vtt-cl Goto Github PK

View Code? Open in Web Editor NEW
95.0 6.0 11.0 1.04 MB

A command line tool that converts subtitle files from SubRib (.srt) format to WebVTT (.vtt) format

License: MIT License

C++ 95.96% Makefile 2.00% Shell 2.04%
vtt srt webvtt converts-subtitle-files

srt-to-vtt-cl's Introduction

SRT to VTT Command Line

Build Status

A command line tool that converts subtitle files from SubRib (.srt) format to WebVTT (.vtt) format.

If you'd rather use a GUI than the command line, check out the SRT to VTT Converter.

Binaries

Usage

For the most basic usage, simply put the binary file in the same directory as the .srt files you want to convert and run the converter. This will convert all files in that directory and save them with the .vtt extension.

For more advanced usage, see below:

srt-vtt  [-q] [-v] [-r] [-o <string>] [-t <integer>] [--] [--version] [-h] <string>

  -q,  --quiet
    Prevents details about the conversion from being printed to the console.
    Overrides --verbose.

  -v,  --verbose
    Indicates that details about the conversion should be printed to the console.

  -r,  --recursive
    If the input is a directory, this flag indicates its subdirectories will be searched
    recursively for .srt files to convert. This flag is ignored if the input path is a
    file.

  -o <string>,  --output-dir <string>
    The path to a directory where all output VTT files will be saved.

  -t <integer>,  --offset <integer>
    Timing offset in milliseconds. Can be any integer between 2147483647 and -2147483648.

  --,  --ignore_rest
    Ignores the rest of the labeled arguments following this flag.

  --version
    Displays version information and exits.

  -h,  --help
    Displays usage information and exits.

  <string>
    Path to a file to convert or directory containing files to convert (to convert files
    in a directory and it's subdirectories, include the -r switch).

  If called without any arguments, all .srt files in the current directory will be
  converted and saved within the current directory.

Build

OS X / Linux

Compiler requirements: Clang v3.4+ or GCC v5.1+

git clone https://github.com/nwoltman/srt-to-vtt-cl.git
cd srt-to-vtt-cl
make

The built binary will be located in bin/Mac-OSX on OS X and bin/<uname -s>/<uname -m> on Linux (i.e. on Ubuntu: bin/Linux/x86_64)

Windows

  • Open the Visual Studio solution
  • If in Debug mode, change to Release mode
  • Press Ctrl+Shift+B or in the menu Build -> Build Solution

Test

make
make test

srt-to-vtt-cl's People

Contributors

nwoltman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

srt-to-vtt-cl's Issues

codecvt not available in Debian/Jessie

I've downloaded the last branch, when I try to Make, g++ says:

g++ -std=c++11 -O2 -MMD -I ./deps -c -o src/Utils.o src/Utils.cpp
src/Utils.cpp:11:19: fatal error: codecvt: No such file or directory
#include

the GCC output is:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.9.2 (Raspbian 4.9.2-10)

Different encoding is randomly detected for the same input file

The file encoding appears to be randomly determined when processing this file: http://durian.blender.org/wp-content/content/subtitles/sintel_en.srt

The file is UTF-8, so the output in the case UTF16 is detected is, of course, gibberish.

Log displayed below:

Searching for files to convert in: .
Converting file: .\sintel_en.srt => .\sintel_en.vtt ... UTF16_LE_NOBOM text encoding detected.  done!

c:\Source\x\x\x\bin\Release>srt-vtt.exe
Searching for files to convert in: .
Converting file: .\sintel_en.srt => .\sintel_en.vtt ... No text encoding detected.  done!

c:\Source\x\x\x\bin\Release>srt-vtt.exe
Searching for files to convert in: .
Converting file: .\sintel_en.srt => .\sintel_en.vtt ... No text encoding detected.  done!

c:\Source\x\x\x\bin\Release>srt-vtt.exe
Searching for files to convert in: .
Converting file: .\sintel_en.srt => .\sintel_en.vtt ... No text encoding detected.  done!

c:\Source\x\x\x\bin\Release>srt-vtt.exe
Searching for files to convert in: .
Converting file: .\sintel_en.srt => .\sintel_en.vtt ... No text encoding detected.  done!

c:\Source\x\x\x\bin\Release>srt-vtt.exe
Searching for files to convert in: .
Converting file: .\sintel_en.srt => .\sintel_en.vtt ... UTF16_LE_NOBOM text encoding detected.  done!```

Updated Windows binary file

Hello again,
Would it be possible to generate a new Windows binary that includes the fix from commit 1344e20? I don't have a Windows machine, so I was unable to generate a new binary with I made the pull request. Thanks.

Creates invalid VTT files

The timestamp format is supposed to use decimal points instead of commas. This program does not make that change.

Standard input and output

Hello
please add an option to read from standard input and an option to write to standard output.
Thanks.

comma to dots not converted

Describe the incorrect output

The commas in the srt are not converted to dots in vtt.

System Info

Windows 7 64b , command line version of converter

Sample SRT File

pressure_1b.zip

File was created manually in NotePad2. Using ANSI encoding (default).

Trying to run it from c#

Hello, I tried to run the code from c# but the process did not end and the file was not converted. this is a portion of the code used. Do you have any idea?

  public static void test7()// It did not end, no error but no file and still waiting
        {
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.FileName = "cmd.exe";
            startInfo.Arguments = "srt-vtt a.srt ";
            startInfo.WorkingDirectory = @"C:\Users\Salma\Desktop\test\";
            startInfo.UseShellExecute = true;
            process.StartInfo = startInfo;
            process.Start();
            process.WaitForExit();
            process.Close();

            var t = process.HasExited;
        }

Able to convert VTT to SRT?

Thanks for this awesome tool @nwoltman -- I was wondering if this can go in reverse, and convert a VTT file to SRT? I didn't see anything in the documentation but wanted to confirm.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.