Created
September 8, 2016 15:40
-
-
Save scottopell/5764a12aa488eb68e730b627c0ae06ef to your computer and use it in GitHub Desktop.
Embed SRT file into mp4 with ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# got this from http://stackoverflow.com/questions/8672809/use-ffmpeg-to-add-text-subtitles | |
ffmpeg -i infile.mp4 -f srt -i infile.srt -c:v copy -c:a copy -c:s mov_text outfile.mp4 | |
# confirmed working with the following ffmpeg | |
# (installed using `brew 'ffmpeg', args: ['with-libvorbis', 'with-libvpx']` ) | |
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers | |
built with Apple LLVM version 7.3.0 (clang-703.0.31) | |
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libvpx --disable-lzma --enable-vda | |
libavutil 55. 28.100 / 55. 28.100 | |
libavcodec 57. 48.101 / 57. 48.101 | |
libavformat 57. 41.100 / 57. 41.100 | |
libavdevice 57. 0.101 / 57. 0.101 | |
libavfilter 6. 47.100 / 6. 47.100 | |
libavresample 3. 0. 0 / 3. 0. 0 | |
libswscale 4. 1.100 / 4. 1.100 | |
libswresample 2. 1.100 / 2. 1.100 | |
libpostproc 54. 0.100 / 54. 0.100 |
Thank you! 👌
if you want to specify a language to subtitle please see my fork https://gist.github.com/donly/73f0fdb8f02ed6016c636fc12ee362dc
doesnt work for me, not sure why....
can you do quick way of doing like lowering the quality slight and speeding it up , mine takes 30 mins
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As we all know, .srt is one kind of text subtitle file, which is the most popular and frequently used. In fact, SRT file is a simple text file and its content looks like this:
1
00:01:00,000 --> 00:01:05,000
First sentence.
2
00:01:15,000 --> 00:01:20,000
Second sentence.
3
...
The format is simple and straightforward. The file is consisted of several blocks separated by empty line, and each block contains 3 lines. In each block, the first line is a number begin from 1 and increase by 1 each time. The second line is the show and hide time of the subtitle. The third line is the text of the subtitle. So, you can write such a subtitle file by yourself easily.
For more information about Add SRT to MP4, read this guide: http://www.faasoft.com/articles/add-srt-to-video.html