What does "copy" do in a ffmpeg command line?

ccsalison picture ccsalison · Jul 14, 2016 · Viewed 17.3k times · Source

I know that it copies something but other than that what does it do (to what extend it affects the output file)? Is it a switch or option? Why does it not have a hyphen before the word itself?

I see from other questions that it can copy streams without transcode but what are other possibility that I can manipulate it?

I have done ffmpeg --help but I don't see any documentation about it. Is there a website I can read more about it?

Answer

Gyan picture Gyan · Jul 14, 2016

copy is neither a switch nor an option. It's the value that can be set for the codec option, and means what it suggests i.e. copy the frames over instead of going through a decode->filter->encode process.

In the question you linked, the string is -c copy, which means set all codec operations to copy i.e. video, audio, subtitles, data and attachments, if any. -c is short for -codec.

If you set -c:v copy, it means to copy any video streams being processed. Same holds for -c:a or -c:s or -c:d. Of course, FFmpeg must support muxing the targeted stream into the output container. If it does not, the command will fail.

You cannot use audio/video/multimedia filters when asking to copy the stream over, since filters need to decode the audio/video frames and manipulate them. So their result needs to be re-encoded. You can, however, use bitstream filters with copy since those don't alter the main payload but only the associated metadata stored in the stream.