Skip to main content
110 votes
Accepted

Best settings for FFMpeg with NVENC

Here is a rough guide to tuning the encoder: We'll start from the basics, as it would be detrimental to jump into the conclusion that a quick barrage of options will suddenly improve expected output ...
Dennis Mungai's user avatar
63 votes

Use ffmpeg copy codec to combine *.ts files into a single mp4

Using copy or cat to combine the files like szatmary's current top answer might leave you with a file that plays far past the limit and can't seek along with playback issues. Instead, to combine ...
Juan Aquino's user avatar
38 votes

How to extract subtitles from MP4 and MKV movies

Here is a solution for virtually any file format that is supported by ffmpeg (even remote files are supported): ffmpeg -i video.mp4 subtitle.srt ffmpeg is present in newer Ubuntu versions by default,...
TiGR's user avatar
  • 481
36 votes
Accepted

What makes a MP4 streamable?

As far as I know, MP4 container files may have their metadata (audio/video tracks, codec information) either at the beginning of the file before the actual data, or at the end. If the metadata is ...
grawity_u1686's user avatar
33 votes

How can I remove multiple segments from a video using FFmpeg?

For those having trouble following ptQa's approach, there's a slightly more streamlined way to go about it. Rather than concat each step of the way, just do them all at the end. For each input, define ...
shawnblais's user avatar
31 votes
Accepted

FFmpeg split video and merge back

Using trim and concat – source files with different codecs For this, make sure that your individual files have the same resolution, and ideally same framerate and chroma subsampling etc. This will ...
slhck's user avatar
  • 230k
28 votes

Use ffmpeg copy codec to combine *.ts files into a single mp4

Putting all together Using Juan Aquino's answer (and correcting the first command to be compatible with Bash and using the natural ordering of files), plus 7vujy0f0hy's answer, a simple working script ...
Francesco Galgani's user avatar
23 votes
Accepted

What archive compression makes .mp4 files the smallest?

First, a minor aside about terminology: ZIP is the only archive format you used. Gzip and Bzip2 are compression formats, not archive formats. To be a bit more specific: An archive format aggregates ...
Austin Hemmelgarn's user avatar
20 votes

Use ffmpeg copy codec to combine *.ts files into a single mp4

The correct way to concat multiple video files from m3u8 playlist is ffmpeg -i "index.m3u8" -codec copy output.mp4 the m3u8 playlist can be on web or locally in directory it contains list of file ...
Vlastimil Ovčáčík's user avatar
19 votes

FFMPEG Splitting MP4 with Same Quality

An Alternate way of doing it is: Create a 2-min clip, starting after 10 minutes: ffmpeg -i input.mp4 -ss 00:10:00 -to 00:12:00 -c copy output.mp4 -i input file -ss start time in seconds or in hh:mm:...
Niket Pathak's user avatar
19 votes

Change the frame rate of an MP4 video with ffmpeg

I know this is an old question but none of the current answers are the recommended way anymore. Lossless (video) remuxing As noted in the comments there is a way to do this where the video does not ...
pseudosavant's user avatar
14 votes

How do I replace the audio in an MP4 file without re-encoding?

An addition to the current solution: If the audio file does not match the video container's format, just avoid the -acodec parameter: ffmpeg.exe -i input_video.mp4 -i replacement_audio.m4a -vcodec ...
SommerEngineering's user avatar
13 votes

How To Convert Offline files downloaded from Lynda.com

Currently, the answer's Yes! There's a fairly new GitHub repository that provides a tool for the decryption of such files. The files themselves are AES-encrypted (which is decrypted using the ...
Dev-iL's user avatar
  • 1,329
12 votes
Accepted

Can VLC play unfinished MP4 files?

MP4 files can have the metadata chunk at the beginning or at the end. It is usually at the end for freshly encoded files because the encoder might not know what values to write until it's done ...
grawity_u1686's user avatar
11 votes

How to open and repair an m4v or mp4 video file?

You can install docker (available for all major operating systems) and run: docker run -v $(pwd):/vol -it synctree/untrunc /vol/GOOD-reference-file.MP4 /vol/BAD-corrupt-file.mdt The syntax is for ...
abourget's user avatar
  • 211
10 votes

How can I remove multiple segments from a video using FFmpeg?

Edit: This approach will notacibly descync audio and video if the number of segements gets too large (>5-ish). For few segments, it's fine. This will do it: ffmpeg -i input.avi -vf "select='1-...
pulp_user's user avatar
  • 221
10 votes

Shouldn't we always use Web Optimized for Handbrake?

If the video is going to be streamed, ever, then you should web-optimize it. This places a special block of the video file at the front called an "moov atom", which is sort of like a table-of-contents....
zip zinzel's user avatar
10 votes

Is AV scanning zip files with non-exe contains re-assuring/reliable?

ZIP doesn't change much. A competent AV program should report the same results for zipped and unzipped files. Non-executable files will generally be less likely to contain malicious code because ...
gronostaj's user avatar
  • 57.5k
9 votes

Use ffmpeg copy codec to combine *.ts files into a single mp4

2017 answer But when I try commands like ..., it complains about not being able to read various files. When I execute ffmpeg -i some.ts -c copy some.mp4 on a certain video, I get this error ...
7vujy0f0hy's user avatar
8 votes
Accepted

change mp4 `ftyp` from `isom` to `mp42`

ffmpeg could do the job. ffmpeg -i isom.mp4 -brand mp42 mp42.mp4
Jichao's user avatar
  • 7,590
8 votes

Rotate a MP4 file, while preserving codec and quality attributes

If you actually recorded video in landscape mode, but phone erroneously saved in metadata that it is 90 degrees rotated (it happen to me today during helicopter flight) just download ffmpeg and use ...
Nenad Bulatović's user avatar
7 votes

Join mp4 files in linux

Here is a one-liner that makes it all that much easier. It does everything needed to be done in order to finally provide you with one resulting video file. Cheers! find *.mp4 | sed 's:\ :\\\ :g'| sed ...
Anonymous's user avatar
  • 179
7 votes

How to open and repair an m4v or mp4 video file?

@sparrowt Your current instructions did not work on my recent Ubuntu 16.10 installation. I got the following error while compilining untrunc: track.cpp: In member function ‘int Codec::getLength(...
Giulio Genovese's user avatar
7 votes

How can I remove multiple segments from a video using FFmpeg?

Converting ABCDEFG to ACDFG is essentially cutting three segments from the video, and then joining those three segments. If all segments will be cut from the same video, and there is no need to change ...
detic's user avatar
  • 93
7 votes

Use ffmpeg copy codec to combine *.ts files into a single mp4

You can use pipe these ts files in to ffmpeg and output the mp4 file. cat *.ts | ffmpeg -i pipe: -c:a copy -c:v copy output.mp4 or If you ts file name not have order, grep .*.ts index.m3u8 | xargs ...
LF-DevJourney's user avatar
7 votes
Accepted

How to completely remove audio channels from video

Using FFmpeg its really simple: ffmpeg -i videoAndAudio.mp4 -c copy -an onlyVideo.mp4 -i path/to/input_file: give the path to your file -c copy: tell FFmpeg to copy codecs (prevent transcoding) -...
Dimitri Podborski's user avatar
7 votes
Accepted

Can I transcode a file with FFmpeg and read the output file on-the-fly?

Regular MP4 files cannot be played while being transcoded, since the MOOV atom (which is required to parse the file) is written at the end, once the encoding is finished. In many cases it then gets ...
slhck's user avatar
  • 230k
6 votes
Accepted

25% of my .mp4 have "error reading header" in FFMPEG, OpenCV - but videos all play fine

The sample MP4 is fragmented and so instead of having a global index for samples i.e. frames, the metadata is per fragment. Within each fragment's metadata, there is a track run box trun which has ...
Gyan's user avatar
  • 37.1k
6 votes
Accepted

How can I limit the number of colors used in a GIF file while converting a MP4 to a GIF with FFmpeg?

Use max_colors and reserve_transparent options in palettegen: ffmpeg -i input.mp4 -vf "fps=16,scale=160:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32:reserve_transparent=0[p];[s1][p]...
llogan's user avatar
  • 60.6k

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