FFMPEG Fixes Your Video Files


FFMPEG’s stream copy is a mode that is really helpful to solve video glitches, slowness due to bad video-index, etc..

In that mode, ffmpeg omits the decoding and encoding step for the specified stream, so it does only demuxing and muxing (its very fast). It is useful for changing the container format or modifying container-level metadata. The diagram above will, in this case, simplify to this:

 _______              ______________            ________
|       |            |              |          |        |
| input |  demuxer   | encoded data |  muxer   | output |
| file  | ---------> | packets      | -------> | file   |
|_______|            |______________|          |________|


Since there is no decoding or encoding, it is very fast (few seconds for demuxing and muxing for full size 2 hours video), and there is no quality loss. However, it might not work in some cases because of many factors. Applying filters is obviously also impossible (since filters work on uncompressed data).

ffmpeg -threads 4 -i vid.avi -vcodec copy -acodec copy vidout.avi

the -threads 4 is optional, but recommended.

Continue reading