

Normally, while looking for streams, FFmpeg parses only few seconds of the input data as most formats have a global header there that describes everything present in the file. I'll discard Stream #0:2 as it contains the same data (English audio track) encoded in a different format. Starting from the first one, Stream #0:0 contains data regarding the DVD's menu navigation. Here FFmpeg reports that my VOB file contains five streams. Use FFmpeg for that, as follows: ffmpeg -i output.vobįor example, you might end up with something like: Input #0, mpeg, from 'output.vob':ĭuration: 01:50:40.99, start: 0.287267, bitrate: 7581 kb/s Now let's inspect the newly created file: we want to find what kind of stuff it contains. To do that, browse to the VIDEO_TS folder and do: cat *.VOB > output.vob The first step then is to join them into a single, big VOB file. VOB file are usually 1 Gb each in order to be compatible with all operating systems, as some cannot read files larger than that size. Audio tracks will be encoded in mp3 format. The video stream will be encoded with H.264 codec, currently the best guy in town. For our task I will be using Matroska Multimedia Container container (.mkv files), as it is capable of storing different audio, video and subtitle tracks together.
#FFMPEG COPY SUBTITLES HOW TO#
I hope this was of use to you.In this guide I'll show you how to do that by using FFmpeg (version 3.2.5 or greater) on a Linux-based operating system - I'm currently using Debian Stable, aka Jessie.įFmpeg is able to deal with a vast amount of audio/video formats and containters. Keep doing this till you find a balance of quality and size that you are happy with. If the file is too big, try raising crf instead. If the quality is not pleasing, try dropping the crf value by 1 or 2. “-an” discards audio.ģ) Run the batch file and wait.

In those examples, “-c:a copy” means the audio will just be copied, not re-encoded, a wise choice when dealing with lossy compression. Putting all this together, we might end up with a command that looks like:įfmpeg -i Video.mkv -vf subtitles=Video.mkv:original_size=1280x720 -c:v libx264 -profile:v high -level 4.1 -preset veryslow -tune film -crf 22 -c:a copy Final.mp4įfmpeg -i Video.mp4 -vf subtitles=English.ass:original_size=1920x1080 -c:v libx265 -preset slow -crf 26 -c:a copy Final.mp4įfmpeg -i Video.mp4 -vf subtitles="English SDH.srt":original_size=1920x1080 -c:v libaom-av1 -cpu-used 5 -crf 26 -b:v 0 -c:a copy Final.mp4 Of note, too, is the “-preset” parameter, which controls encoding speed and compression (try medium, slow, slower, or veryslow). For example, you might want to set “-tune film” if it is live-action, or “-tune animation” if anime. See the other article for a fuller discussion of this and other x264 parameters. Lower values: higher quality and bigger files.

Higher values lead to lower quality and smaller files. “-crf” controls the quality of the encoding and can be set to a value of your choice (0–51). If that is the case, the command-line would run something like this:įfmpeg -i Video.mkv -vf subtitles=Video.mkv:original_size=1280x720 -c:v libx264 -crf 22 -c:a copy Final.mp4 Many Matroska files have subtitles stored inside them.
#FFMPEG COPY SUBTITLES WINDOWS#
You can use the Windows command-line instead, but batch files are easier to correct, edit, and re-use. And note that “original_size” must be set to the size of the video. Replace “Video.mp4” and “English.srt” with the names of your files, and then save the text file, using the “.bat” extension, perhaps calling it “ffmpeg.bat” or something similar.
#FFMPEG COPY SUBTITLES MP4#
Also, this process re-encodes the video, which leads to further loss of quality.įirstly, download the latest Git build of FFmpeg and extract the zip file to a folder of your choice (trying to avoid a path with spaces).ġ) Copy your video and its subtitle file to the “bin” directory of FFmpeg.Ģ) Assuming a simple MP4 video and SRT subtitle file, open Notepad and type the following:įfmpeg -i Video.mp4 -vf subtitles=English.srt:original_size=1280x720 -c:v libx264 -crf 22 -c:a copy Final.mp4 Once burnt in, they will be part of the picture for good, so keep the originals if you can. What if one needs to burn the subtitles into the video itself, so that it becomes part of the picture? FFmpeg can do this quite easily-it is useful if a device cannot read subtitles or if they cannot be turned on for some reason. In the other article, I wrote about combining (or muxing) video and subtitles into a single file.
