Skip to main content
29 votes
Accepted

ffmpeg: how to add several subtitle streams

Whenever's there's multiple inputs fed to ffmpeg, and you need one more than video/audio/subtitle stream sent to the output, -map statements are needed. ffmpeg -i $movie.mov -i $sub_en.srt -i $sub_de....
Gyan's user avatar
  • 33.4k
8 votes
Accepted

Convert mkv to mp4 (or webM) with the output file viewable in the process

This is possible for MP4, with a caveat. The command below will generate a fragmented MP4, which you can view in a browser while the conversion is taking place. However, only the fragments completely ...
Gyan's user avatar
  • 33.4k
5 votes
Accepted

How to convert 10-bit H.265 videos to H.264 without losing quality

It looks like the Video is encoded in 4000 kbit/s, instead of a Rate Factor (RF). But that isn't the issue here. The issue is: while 264 does support lossless encoding, it not widely compatible! (you ...
Pingger Shikkoken's user avatar
5 votes

Join multiple M4V to one file (maybe MKV?)

If you have ffmpeg installed, see this article that basically says to create a file that has all of the names, or to use the following command Concat Protocol ffmpeg -i 'concat:input1|input2' -...
bret7600's user avatar
  • 197
4 votes

MKVToolNix equivalent for .MP4's

I just went through a very similar use-case working with TS files. MoritzLost has the key point but as ffmpeg options can be quite difficult to sort out when you are first getting started, here is a ...
mattpr's user avatar
  • 141
4 votes
Accepted

Loop video for the duration of audio

To merge an audio stream with a repeated video stream ffmpeg -stream_loop -1 -i 20s.ts -i 120s.mp3 -map 0:v:0 -map 1:a:0 -shortest -c copy output.mp4 -stream_loop -1 : to loop infinity of video input ...
xer-rex's user avatar
  • 817
3 votes
Accepted

Trim audio stream to video stream length

One should use the avformat library flag to stop muxing with the shortest stream. ffmpeg -i file.mp4 -map 0 -c copy -fflags +shortest -max_interleave_delta 1G -movflags +faststart out.mp4
Gyan's user avatar
  • 33.4k
3 votes
Accepted

I have a .mkv video file I need to use but it is apparently infinite

So I've found the issue to be related to inconsistent framerates. I found that running the video through ffmpeg with ffmpeg -i yourfile.mkv -c:v copy -c:a copy -r 30 newfile.mkv actually fixed the ...
Caden Mitchell's user avatar
3 votes

Is it possible to encode MP4 video with VP9 codec?

ffmpeg v4.0.2 or higher can encode/transcode VP9 in mp4. Commandline (when transcoding): ffmpeg -i INPUT.MKV -c:v libvpx-vp9 OUTPUT.MP4 Commandline (when remuxing (Super fast)): ffmpeg -i INPUT.MKV -c:...
Manthaar Janyaro's user avatar
2 votes

MKVToolNix equivalent for .MP4's

dmMediaConverter is very similar to MKVToolnix. It is just a ffmpeg gui, so it can save in any format. To replicate the described MKVToolnix use, select "Convert", then "Add files", selecting both ...
cipricus's user avatar
  • 131
2 votes
Accepted

MKVToolNix equivalent for .MP4's

Muxing a file simply means to extract individual streams out of existing container files or mix existing streams together into a new container file. For MP4, this can be done with ffmpeg and the -c ...
MoritzLost's user avatar
  • 5,442
2 votes
Accepted

How to stop ffmpeg from interlacing when converting from m2ts to mkv

The source is interlaced. To deinterlace it, you can use the yadif filter. To use it with the default values: ffmpeg -i input.m2ts -vf yadif=parity=auto output.mkv
Gyan's user avatar
  • 33.4k
2 votes
Accepted

How to calculate the length of the video file that was encoded so far?

Short answer is No. Longer answer is, it depends. If you're encoding a file, then generally the output is the duration of the input, unless there's speed change or trim filters or -ss, -to, -t ...
Gyan's user avatar
  • 33.4k
2 votes

Is there any way to efficently compress multiangle recordings?

The name for this feature is Multiview Video Coding (MVC): an stereoscopic video coding standard for video compression that allows for the efficient encoding of video sequences captured ...
Gyan's user avatar
  • 33.4k
2 votes

Editing/Changing Cluster Timecode Element in mkv files (Amazon Kinesis Video)

MKV frame timestamps are relative to the start of the cluster. The cluster timestamps, however can be absolute or relative to the beginning of the "presentation". The frame timestamps are the ...
MushMal's user avatar
  • 21
2 votes
Accepted

Identify H.265 from the OSX Command Line?

You can use ffprobe for this ffprobe file.mkv -show_entries stream=codec_name -select_streams v:0 -of compact=p=0:nk=1 -v 0 For H.265/HEVC, this will print hevc; for H.264, h264 .
Gyan's user avatar
  • 33.4k
2 votes

How can we keep the subtitle track when converting from MKV to MP4 with ffmpeg?

You can find detailed answer on your question here Basically you need to add "-map" parameter to your command. ffmpeg -i myMovie.mkv -c copy -map 0:v:0 -map 0:a:0 -map 0:s:0 myMovieMP4.mp4 -...
Viktor Liashenko's user avatar
2 votes

Is it possible to embed a thumbnail in a .mkv file?

I was also going down this rabbit hole and found that there's an option -attach filename that's more specific to mkv files. It's at the end of the "Main Options" section of the manual: https:...
Samuel Powell's user avatar
2 votes
Accepted

Using FFMPEG to convert an MKV with multiple subtitles, audio tracks and chapters to a plain mp4

There are multiple questions; I'll try to answer them separately for simplicity. First of all, converting from mkv to mp4: The easiest way would be something like this ffmpeg -i input.mkv output.mp4 ...
Euklios's user avatar
  • 166
2 votes

Why has transport stream (TS) a much bigger file size than mkv?

The short answer: container overhead. MKV (and to a lesser extent, MP4/ISOBMFF) are very "flexible" containers, and basically adapt to whatever you're trying to shove into them, provided the ...
Haachamachama's user avatar
1 vote

Linux mkv packages for VLC

It is not an issue. VLC has many built-in codecs. MKV is not in them. So VLC rely on libmatroska to manipulate MKV. As VLC cannot know if you have it installed, it gives a warning. Check if ...
Abdullah Ibn Fulan's user avatar
1 vote

Can I use Apple Compressor software to convert mkv files to mp4

No Compressor does not take .mkv files. At least not my 4.5.1 version.
German Dude's user avatar
1 vote

Why aren't chapters being added to my m2ts using tsmuxer?

M2TS as a format / container is not able to store chapter information itself. On Blu-Ray disks, the chapter data is stored in the playlist files. Therefore you won't see chapters when you just load an ...
Binarus's user avatar
  • 141
1 vote

Widely compatible video format with lossless audio

To my knowledge, the only lossless audio format with really wide compatibility is plain old linear PCM. As container format, MP4 is the most wide-spread.
soundflix's user avatar
  • 142
1 vote

Widely compatible video format with lossless audio

According to Mozilla Developers MPEG-4 containers can include FLAC audio. Ditto for OGG containers.
user38574's user avatar
1 vote
Accepted

Is it possible to remove a border from a Webm video losslessly?

See here https://www.webmproject.org/docs/container/ under section Track. There you find PixelCropBottom, PixelCropTop, PixelCropLeft and PixelCropRight - all of which are supported. These parameters ...
Matt's user avatar
  • 1,421
1 vote

Removing streams in HEVC H.265 MKV file?

In the syntax -map 1:a:24, 1 stands for the input file index. Counting starts from 0, so 1 refers to the 2nd input file but the command only has one input. a stands for stream type, and in this case, ...
Gyan's user avatar
  • 33.4k
1 vote

How can I merge five mkv files I've created in OBS Studio?

In case you will be unable to use MKVToolsNix for whatever reason, there is an older tool which is able to append files quite well: AVIDemux. The process is trivial. Start the program and open your ...
v010dya's user avatar
  • 870
1 vote
Accepted

How can I merge five mkv files I've created in OBS Studio?

This is absolutely not a problem. You can do this with MKVToolNix (specifically with it's GUI, since that is what you have requested). I am on Debian GNU/Linux, if you use something different, your ...
v010dya's user avatar
  • 870
1 vote

FFmpeg does not preserve colors after resizing

There is already a solution here. But I will try to summarize it in brief. You need to specify the correct flags for color properties of the original file. Your original file (as probably many other ...
Tzamutzl's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible